Changeset 4289
- Timestamp:
- 02/22/19 14:16:18 (5 years ago)
- Location:
- TOOLS/CPLRESTART
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TOOLS/CPLRESTART/CreateRestartAtm4Oasis.bash
r3707 r4289 156 156 mv tmp_flxat_fields_notime.nc flxat_fields_notime.nc 157 157 (( dim_lat = dim_lat - 1 )) 158 #ATM=lmdz${dim_lon}x${dim_lat}159 158 ATM=LMD${dim_lon}${dim_lat} 160 (( n_lat = dim_lat -1 ))159 (( n_lat = dim_lat - 1 )) 161 160 cat<<EOF > lonlat2xyz.nco 162 161 // Value at North Pole for LMDZ lon/lat grid -
TOOLS/CPLRESTART/CreateRestartOce4Oasis.bash
r4249 r4289 26 26 # $HeadURL$ 27 27 28 # Usage exemples : 29 # CreateRestartOce4Oasis.bash /ccc/store/cont003/dsm/p25sepul/IGCM_OUT/IPSLCM5A2/PROD/piControl/CM5A2.1.pi.00/OCE/Output/MO/CM5A2.1.pi.00_40100101_40191231_1M_grid_T.nc/ccc/store/c# CreateRestartOce4Oasis.bash /ccc/store/cont003/gencmip6/p86mart/IGCM_OUT/IPSLCM6/DEVT/pdControl/CM6010.2.rivgeo-LR-pdCtrl/OCE/Output/MO/CM6010.2.rivgeo-LR-pdCtrl_22400101_22491231_1M_grid_T.nc 28 ## Usage exemples : 29 # 30 # CreateRestartOce4Oasis.bash --ocefile /ccc/store/cont003/dsm/p25sepul/IGCM_OUT/IPSLCM5A2/PROD/piControl/CM5A2.1.pi.00/OCE/Output/MO/CM5A2.1.pi.00_40100101_40191231_1M_grid_T.nc --icefile /ccc/store/cont003/dsm/p25sepul/IGCM_OUT/IPSLCM5A2/PROD/piControl/CM5A2.1.pi.00/ICE/Output/MO/CM5A2.1.pi.00_40100101_40191231_1M_icemod.nc --icefrc ice_pres --icetem tsice --icealb ialb 31 # 32 # CreateRestartOce4Oasis.bash --ocefile /ccc/store/cont003/gencmip6/p86mart/IGCM_OUT/IPSLCM6/DEVT/pdControl/CM6010.2.rivgeo-LR-pdCtrl/OCE/Output/MO/CM6010.2.rivgeo-LR-pdCtrl_22400101_22491231_1M_grid_T.nc --icefrc siconc 33 34 # CreateRestartOce4Oasis.bash --ocefile /ccc/store/cont003/gen7451/personr/IGCM_OUT/ORCA025_LIM3_PISCES/DEVT/ORCA025ia/eOR025L3P-IA-REF07-MUSCL/OCE/Output/MO/eOR025L3P-IA-REF07-MUSCL_20090101_20091231_1M_grid_T.nc 35 # 36 # CreateRestartOce4Oasis.bash --ocefile /ccc/work/cont003/gencmip6/p48ethe/ICMC-TOOLS/DATA/eOR025L3P-IA-REF07-MUSCL_20090101_20091231_1M_grid_T.nc --icefile /ccc/work/cont003/gencmip6/p48ethe/ICMC-TOOLS/DATA/eOR025L3P-IA-REF07-MUSCL_20090101_20091231_1M_icemod.nc --icefrc siconc/oce --icetem sistem 37 # 38 # 30 39 ## =========================================================================== 31 40 ## … … 39 48 # Default values 40 49 Comment="Preliminary attempt - Do not trust !" 41 ##IceVar=ice_pres # siconc #> Variable containing sea ice fraction [0-1] 42 IceVar=siconc #> Variable containing sea ice fraction [0-1] 50 # 51 # --ocefile : file in which sea surface temperature is read 52 # --icefile : file in which sea ice fraction, albedo and surface temperature are read. 53 # if not specified, these variables are readed in the ocean file 54 # 55 ## Variable in ocean file : 56 OceSst=tos #> Variable containing sea surface temperature (°C) : --ocesst tos 57 ## Variables in ice file 58 IceFrc=ice_pres #> Variable containing sea ice fraction [0-1] : --icefrc ice_pres 59 IceAlb=none #> Variable containing sea ice albedo [0-1]. If 'none', set to 0.65 : --icealb ialb 60 IceTem=none #> Variable containing sea ice surface temperature (°C). If 'none', set to -20°C : --icetem tsice 61 62 # Complementary syntaxes for variables names 63 # --icefrc siconc/oce means that siconc variable should be taken in the ocean file ... 64 # --icealb ialb/oce 65 # --icetem tsice/oce 66 67 ## Filling 68 # If the ocean in the coupled model has a different geometry that the one in the files. 69 # In general, the forced ocean does run with no closed sea, when the coupled model does. 70 # This step is he mandatory 71 Fill=yes # If yes, fill the continents. --fill / --nofill 72 73 # nperio parameter for ORCA. Normally guess from name or dimensions. For ORCA2, set to nperio=4, but should be set to nperio=6 for some paleo configs 74 # --nperio 4 75 76 DefaultIceAlb=0.65 77 DefaultIceTem=-20.0 78 79 #OceFile=/ccc/store/cont003/dsm/p25sepul/IGCM_OUT/IPSLCM5A2/PROD/piControl/CM5A2.1.pi.00/OCE/Output/MO/CM5A2.1.pi.00_40100101_40191231_1M_grid_T.nc 80 #OceFile=/ccc/store/cont003/gencmip6/p86mart/IGCM_OUT/IPSLCM6/DEVT/pdControl/CM6010.2.rivgeo-LR-pdCtrl/OCE/Output/MO/CM6010.2.rivgeo-LR-pdCtrl_22400101_22491231_1M_grid_T.nc 81 # 43 82 44 83 # 45 84 # Defines computer 46 85 # ================ 47 if [[ $(hostname) = curie* ]] ; then arch=curie ; center=tgcc ; fi48 86 if [[ $(hostname) = irene* ]] ; then arch=irene ; center=tgcc ; fi 49 87 50 88 case ${arch} in 51 ( curie |irene )89 ( irene ) 52 90 set +vx 53 91 module unload cdo nco ferret 54 92 module unload netcdf hdf5 55 93 module load python # /2.7.12 56 module load netcdf/4.3.3.1_hdf5_parallel # Version for XIOS94 #module load netcdf/4.3.3.1_hdf5_parallel # Version for XIOS 57 95 module load nco 96 module load python3 58 97 R_IN=$(ccc_home -u igcmg --cccwork)/IGCM 59 98 TMPDIR=${SCRATCHDIR}/TMP … … 68 107 set -e 69 108 109 Nperio="" 110 70 111 while [[ ${1} = -* ]] ; do 71 112 case ${1} in 72 113 ( -- ) shift ; break ;; 73 ( -c | --comment ) shift ; Comment=${1} ;; 74 ( -i | --ice ) shift ; IceVar=${1} ;; 75 ( -a | --alb ) shift ; AlbVar=${1} ;; 114 ( -c | --comment ) shift ; Comment=${1} ;; 115 ( --ocefile ) shift ; OceFile=${1} ;; 116 ( --icefile ) shift ; IceFile=${1} ;; 117 ( --ocesst ) shift ; OceSst=${1} ;; 118 ( --icefrc ) shift ; IceFrc=${1} ;; 119 ( --icetem ) shift ; IceTem=${1} ;; 120 ( --icealb ) shift ; IceAlb=${1} ;; 121 ( --fill ) Fill="yes" ;; 122 ( --nofill ) Fill="no" ;; 123 ( --nperio ) shift ; Nperio="--nperio ${1}" ;; 76 124 ( -v | --verbose ) set -o verbose ;; 77 125 ( -x | --xtrace ) set -o xtrace ;; … … 82 130 ( -XV | -VX ) set +o xtrace verbose ;; 83 131 ( -E ) set +e ;; 84 ( -* ) echo ${Bold}"Unknown option : ${1}"${Norm} ; return1 ;;132 ( -* ) echo ${Bold}"Unknown option : ${1}"${Norm} ; exit 1 ;; 85 133 esac 86 134 shift 87 135 done 88 136 89 OceFile=${1:-/ccc/store/cont003/dsm/p25sepul/IGCM_OUT/IPSLCM5A2/PROD/piControl/CM5A2.1.pi.00/OCE/Output/MO/CM5A2.1.pi.00_40100101_40191231_1M_grid_T.nc}90 91 #OceFile=${1:-/ccc/store/cont003/gencmip6/p86mart/IGCM_OUT/IPSLCM6/DEVT/pdControl/CM6010.2.rivgeo-LR-pdCtrl/OCE/Output/MO/CM6010.2.rivgeo-LR-pdCtrl_22400101_22491231_1M_grid_T.nc}92 #93 94 137 # 95 138 # Format for OASIS files : should be NetCDF3 classic or NetCDF3 64 bits … … 100 143 ## Defines associated sea ice file 101 144 ## =========================================================================== 102 ###IceFile=$(echo ${OceFile} | sed 's=/OCE/=/ICE/=' | sed 's=grid_T=icemod=') 103 IceFile=${OceFile} 145 if [[ -z ${IceFile} ]] ; then IceFile=${OceFile} ; fi 146 IceFrcFile=${IceFile} 147 IceTemFile=${IceFile} 148 IceAlbFile=${IceFile} 149 150 ## Select file for each variable 151 OceSstFile=${OceFile} 152 if [[ ${OceSst} = */ice ]] ; then 153 OceSstFile=${IceFile} 154 OceSst=${OceSst%%/*} 155 fi 156 157 158 if [[ ${IceAlb} = */oce ]] ; then 159 IceAlbFile=${OceFile} 160 IceAlb=${IceFrc%%/*} 161 fi 162 if [[ ${IceFrc} = */oce ]] ; then 163 IceFrcFile=${OceFile} 164 IceFrc=${IceFrc%%/*} 165 fi 166 if [[ ${IceTem} = */oce ]] ; then 167 IceTemFile=${OceFile} 168 IceTem=${IceTem%%/*} 169 fi 170 171 172 echo "Oce sst - Variable ${OceSst} - File ${OceSstFile}" 173 echo "Ice fraction - Variable ${IceFrc} - File ${IceFrcFile}" 174 echo "Ice albedo - Variable ${IceAlb} - File ${IceAlbFile}" 175 echo "Ice temperature - Variable ${IceTem} - File ${IcetemFile}" 176 104 177 105 178 ## 106 179 ## Extract variables 107 180 ## =========================================================================== 108 ncks --overwrite --fl_fmt=${FL_FMT} --history -d time_counter,0,0 --variable ${IceVar} ${IceFile} sstoce_fields.nc 109 ncks --overwrite --fl_fmt=${FL_FMT} --history -d time_counter,0,0 --variable tos ${OceFile} oce_fields.nc 110 ncks --append --fl_fmt=${FL_FMT} --history oce_fields.nc sstoce_fields.nc 181 ncks --overwrite --fl_fmt=${FL_FMT} --history -d time_counter,0,0 --variable ${IceFrc} ${IceFrcFile} sstoce_fields.nc 182 ncks --overwrite --fl_fmt=${FL_FMT} --history -d time_counter,0,0 --variable ${OceSst} ${OceSstFile} oce_sst.nc 183 184 ncks --append --fl_fmt=${FL_FMT} --history oce_sst.nc sstoce_fields.nc 185 if [[ "X${IceAlb}" != "Xnone" ]] ; then 186 ncks --overwrite --fl_fmt=${FL_FMT} --history -d time_counter,0,0 --variable ${IceAlb} ${IceAlbFile} ice_alb.nc 187 ncks --append --fl_fmt=${FL_FMT} --history ice_alb.nc sstoce_fields.nc 188 fi 189 if [[ "X${IceTem}" != "Xnone" ]] ; then 190 ncks --overwrite --fl_fmt=${FL_FMT} --history -d time_counter,0,0 --variable ${IceTem} ${IceTemFile} ice_tem.nc 191 ncks --append --fl_fmt=${FL_FMT} --history ice_tem.nc sstoce_fields.nc 192 fi 111 193 ncwa --overwrite --fl_fmt=${FL_FMT} --history --average time_counter sstoce_fields.nc sstoce_fields_notime.nc # Remove time dimension 112 194 ncatted --history --attribute history,global,d,c,"" sstoce_fields_notime.nc # Clean attributes … … 115 197 ## Find ocean name 116 198 ## =========================================================================== 117 dim_y=$(ncdump -h sstoce_fields_notime.nc | grep "y *=" | awk '{print $3}' )199 dim_y=$(ncdump -h sstoce_fields_notime.nc | grep "y *=" | grep -v "nvertex" | awk '{print $3}' ) 118 200 dim_x=$(ncdump -h sstoce_fields_notime.nc | grep "x *=" | grep -v "nvertex" | awk '{print $3}' ) 119 201 echo ${dim_x} ${dim_y} 120 202 121 [[ ${dim_x} = 182 && ${dim_y} =149 ]] && OCE=ORCA2.3122 [[ ${dim_x} = 362 && ${dim_y} = 332 ]] && OCE=eORCA2.1203 [[ ${dim_x} = 182 && ${dim_y} = 149 ]] && OCE=ORCA2.3 204 [[ ${dim_x} = 362 && ${dim_y} = 332 ]] && OCE=eORCA1.2 123 205 [[ ${dim_x} = 1442 && ${dim_y} = 1207 ]] && OCE=eORCA025.1 124 206 125 126 207 ## 127 208 ## Creates sstoce file 128 209 ## =========================================================================== 129 130 210 cat <<EOF > create_sstoce.nco 131 OIceFrc[y,x] = double ( ${IceVar}(:,:) ) ; 132 //tos.simple_fill_miss(tos) ; 133 O_SSTSST[y,x] = double ( (tos (:,:) + 273.15d) * (1.0d-OIceFrc(:,:)) ) ; 134 //O_AlbIce[y,x] = double ( ialb (:,:) * OIceFrc(:,:) ) ; 135 //O_TepIce[y,x] = double ( (tsice (:,:) + 273.15d) * OIceFrc(:,:) ) ; 136 O_AlbIce[y,x] = double ( 0.65d * OIceFrc(:,:) ) ; 137 O_TepIce[y,x] = double ( (-20.0d + 273.15d) * OIceFrc(:,:) ) ; 211 *OceSst[y,x] = double ( ${OceSst}(:,:) + 273.15d ) ; 212 OIceFrc[y,x] = double ( ${IceFrc}(:,:) ) ; 213 // 214 EOF 215 216 if [[ "X${IceAlb}" != "Xnone" ]] ; then 217 cat <<EOF >> create_sstoce.nco 218 *IceAlb[y,x] = double ( ${IceAlb}(:,:) ) ; 219 // 220 EOF 221 else 222 cat <<EOF >> create_sstoce.nco 223 *IceAlb[y,x] = double ( ${DefaultIceAlb}d ) ; 224 // 225 EOF 226 fi 227 228 if [[ "X${IceTem}" != "Xnone" ]] ; then 229 cat <<EOF >> create_sstoce.nco 230 *IceTem[y,x] = double ( ${IceTem}(:,:) + 273.15d ) ; 231 // 232 EOF 233 else 234 cat <<EOF >> create_sstoce.nco 235 *IceTem[y,x] = double ( ${DefaultIceTem}d + 273.15d ) ; 236 // 237 EOF 238 fi 239 240 cat <<EOF >> create_sstoce.nco 241 O_SSTSST[y,x] = OceSst (:,:) * (1.0d-OIceFrc(:,:)) ; 242 O_AlbIce[y,x] = IceAlb (:,:) * OIceFrc(:,:) ; 243 O_TepIce[y,x] = IceTem (:,:) * OIceFrc(:,:) ; 138 244 O_OCurx1[y,x] = 0.0d ; 139 245 O_OCury1[y,x] = 0.0d ; … … 143 249 ncap2 --overwrite --fl_fmt=${FL_FMT} --history --script-file create_sstoce.nco sstoce_fields_notime.nc tmp_sstoc.nc 144 250 ncks --fl_fmt=${FL_FMT} --overwrite --history --variable OIceFrc,O_SSTSST,O_AlbIce,O_TepIce,O_OCurx1,O_OCury1,O_OCurz1 tmp_sstoc.nc sstoc.nc 145 ncatted --history --attribute comment,O_SSTSST,o,c,"SST weighted by fraction of open ocean" sstoc.nc 146 ncatted --history --attribute comment,O_AlbIce,o,c,"Albedo weighted by fraction of sea ice" sstoc.nc 147 ncatted --history --attribute comment,O_TepIce,o,c,"Ice temperature weighted by fraction of sea ice" sstoc.nc 148 149 ## 150 ## Add some information in file headers 251 ncatted --history --attribute long_name,O_SSTSST,o,c,"SST weighted by fraction of open ocean" sstoc.nc 252 ncatted --history --attribute long_name,O_AlbIce,o,c,"Albedo weighted by fraction of sea ice" sstoc.nc 253 ncatted --history --attribute long_name,O_TepIce,o,c,"Ice temperature weighted by fraction of sea ice" sstoc.nc 254 255 ncatted --history --attribute comment,O_SSTSST,o,c,"Variable ${OceSst} taken in ${OceSstFile}" sstoc.nc 256 ncatted --history --attribute comment,OIceFrc,o,c,"Variable ${IceFrc} taken in ${IceFrcFile}" sstoc.nc 257 258 if [[ ${IceAlb} = none ]] ; then ncatted --history --attribute comment,O_AlbIce,o,c,"Set to ${DefaultIceAlb}" sstoc.nc 259 else ncatted --history --attribute comment,O_AlbIce,o,c,"Variable ${IceAlb} taken in ${IceAlbFile}" sstoc.nc 260 fi 261 if [[ ${IceTem} = none ]] ; then ncatted --history --attribute comment,O_TepIce,o,c,"Set to ${DefaultIceTem}" sstoc.nc 262 else ncatted --history --attribute comment,O_TepIce,o,c,"Variable ${IceTem} taken in ${IceTemFile}" sstoc.nc 263 fi 264 265 ## 266 ## Filling the fields 267 ## =========================================================================== 268 if [[ ${Fill} = yes ]] ; then 269 mv sstoc.nc sstoc_nofilled.nc 270 python3 FillOceRestart.py --input sstoc_nofilled.nc --output sstoc.nc ${Nperio} 271 fi 272 273 ## 274 ## Add some information in file header 151 275 ## =========================================================================== 152 276 … … 183 307 ## Cleaning 184 308 ## =========================================================================== 185 rm -f sstoce_fields.nc sstoce_fields_notime.nc tmp_flxat.nc oce_fields.nc309 #rm -f sstoce_fields.nc sstoce_fields_notime.nc tmp_sstoce.nc oce_fields.nc 186 310 187 311 mv sstoc.nc sstoc_${OCE}.nc -
TOOLS/CPLRESTART/FillOceRestart.py
r4249 r4289 50 50 -o <file> | --output=<file> : output file (default : build a name form input file) 51 51 -r | --replace : replace input file by new file with filled variables 52 -v <varlist> | --variable=<variables> : list of variable to fill (defau tlt: all variable in file)52 -v <varlist> | --variable=<variables> : list of variable to fill (default: all variable in file) 53 53 -x | --exclude : fills all variable in files, except those given in -v|--variable 54 54 -n <perio> | --perio=<perio> : periodicity type (default: try to guess) … … 92 92 sys.exit(1) 93 93 else : 94 if Debug : print ("Out file set to "+OuFile)95 94 OuFile = myval ; 95 if Debug : print ("Out file set to " + OuFile) 96 96 elif myopt in [ '-r', '--replace' ] : 97 97 if OuFile != None : … … 111 111 ListExclude = ListVarName 112 112 ListVarName = None 113 113 114 114 if OuFile == None : 115 print ( 'Definition OuFile' ) 115 116 OuFile = InFile.replace ( ".nc", "_filled.nc" ) 116 print ("Creates output file name: " +OuFile)117 print ("Creates output file name: " + OuFile) 117 118 118 119 # Copy the input file if needed … … 131 132 print ("Grid dimensions: ("+str(jpoj)+", "+str(jpoi)+")") 132 133 if 'ORCA2' in InFile : 134 nperio=4 133 135 print ("ORCA 2 grid found from file name: nperio may vary for this configuration") 134 print ("Choosen nperio= 4")136 print ("Choosen nperio=" + str(nperio) ) 135 137 elif 'ORCA1' in InFile : 136 if 'eORCA1' in InFile : 137 print ("eORCA 1 grid found from file name, nperio=6") 138 if 'eORCA1' in InFile : 139 nperio=6 140 print ("eORCA 1 grid found from file name, nperio=" + str(nperio)) 138 141 else : 139 print ("ORCA 1 grid found from file name, nperio=6") 142 nperio=6 143 print ("ORCA 1 grid found from file name, nperio=" + str(nperio)) 140 144 elif (jpoj, jpoi) == (149, 182) : 145 nperio = 4 141 146 print ("ORCA 2 grid found from dimension: nperio may vary for this configuration") 142 print ("Choosen nperio=4") 143 nperio = 4 147 print ("Choosen nperio=" + str(nperio)) 144 148 elif (jpoj, jpoi) == (332, 292) : 145 149 nperio = 6 146 print ("ORCA1 grid found from dimensions, nperio =6")150 print ("ORCA1 grid found from dimensions, nperio" + str(nperio) ) 147 151 elif (jpoj, jpoi) == (332, 362) : 148 152 nperio = 6 149 print ("eORCA1 grid found from dimensions, nperio =6")153 print ("eORCA1 grid found from dimensions, nperio" + str(nperio) ) 150 154 elif (jpoj, jpoi) == (1021, 1442) : 151 nperio = 4152 print ("ORCA025 grid found from dimensions, nperio =6")155 nperio = 6 156 print ("ORCA025 grid found from dimensions, nperio" + str(nperio) ) 153 157 elif (jpoj, jpoi) == (1207, 1442) : 154 nperio = 4155 print ("eORCA025 grid found from dimensions, nperio= 6")158 nperio = 6 159 print ("eORCA025 grid found from dimensions, nperio=" + str(nperio) ) 156 160 157 161 if nperio == None :
Note: See TracChangeset
for help on using the changeset viewer.