source: trunk/libIGCM/libIGCM_post/IGCM_Patch_20140801_ncks_cdo.ksh @ 1045

Last change on this file since 1045 was 1045, checked in by sdipsl, 10 years ago

remove executable properties when not needed

  • Property svn:keywords set to Date Author Rev
File size: 2.7 KB
Line 
1#!/bin/ksh
2
3#**************************************************************
4# Author: Marie-Alice Foujols
5# Contact: Marie-Alice.Foujols__at__ipsl.jussieu.fr
6# $Revision::                                          $ Revision of last commit
7# $Author::                                            $ Author of last commit
8# $Date::                                              $ Date of last commit
9# IPSL (2009)
10#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
11#
12#**************************************************************
13
14#------------------------------------------------------------
15# ncks CPL files for 1D frequency, ncra for 1M averaged files
16#------------------------------------------------------------
17
18function IGCM_Patch_20140801_ncks_cdo {
19    IGCM_debug_PushStack "IGCM_Patch_ncks_ncra" $@
20
21    PREFIX=TEMPO
22    if [ -f FIRST_TIME_CPL ] ; then
23       echo FIRST_TIME_CPL exists
24    else
25       # create FIRST_TIME_CPL file
26       date > FIRST_TIME_CPL
27
28       # Get date from directory name
29       DateDeb=$( basename $(pwd) | awk -F _ '{ print $2}' )
30       DateDeb=$( IGCM_date_ConvertFormatToHuman ${DateDeb} )
31       
32       rm -f ${PREFIX}_*_cpl_*.nc
33
34       for file in S*lmdz.x*.nc C*lmdz.x*.nc S*LMDZ*.nc C*LMDZ*.nc
35       do
36           IGCM_sys_ncks -A ${file} ${PREFIX}_1D_cpl_atm.nc  > /dev/null 2>&1
37       done
38       rm -f S*lmdz.x*.nc C*lmdz.x*.nc S*LMDZ*.nc C*LMDZ*.nc
39
40       ## Correctly defines the time axis for CDO
41       # DateDeb is first date of the file, not start date of run
42       # (according to time var in OASIS files)
43       #
44       ncatted \
45           -a axis,time,c,c,"T"                                  \
46           -a long_name,time,c,c,"Time axis"                     \
47           -a title,time,c,c,"Time"                              \
48           -a calendar,time,c,c,"noleap"                         \
49           -a units,time,c,c,"seconds since ${DateDeb} 00:00:00" \
50           -a time_origin,time,c,c,"${DateDeb} 00:00:00"         \
51           ${PREFIX}_1D_cpl_atm.nc
52
53       for file in O*oceanx*.nc
54       do
55           IGCM_sys_ncks -A ${file} ${PREFIX}_1D_cpl_oce.nc   > /dev/null 2>&1
56       done
57       rm -f O*oceanx*.nc
58
59       ncatted \
60           -a axis,time,c,c,"T"                                  \
61           -a long_name,time,c,c,"Time axis"                     \
62           -a title,time,c,c,"Time"                              \
63           -a calendar,time,c,c,"noleap"                         \
64           -a units,time,c,c,"seconds since ${DateDeb} 00:00:00" \
65           -a time_origin,time,c,c,"${DateDeb} 00:00:00"         \
66           ${PREFIX}_1D_cpl_oce.nc
67    fi
68
69    # Monthly average
70    IGCM_sys_cdo monavg ${PREFIX}_1D_cpl_atm.nc  ${PREFIX}_1M_cpl_atm.nc
71    IGCM_sys_cdo monavg ${PREFIX}_1D_cpl_oce.nc  ${PREFIX}_1M_cpl_oce.nc
72   
73    IGCM_debug_PopStack "IGCM_Patch_ncks_ncra"
74}
Note: See TracBrowser for help on using the repository browser.