Changeset 3744
- Timestamp:
- 04/12/18 15:06:04 (7 years ago)
- Location:
- TOOLS/CMIP6_FORCING/OZONE
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TOOLS/CMIP6_FORCING/OZONE/clims_CMIP6.bash
r3595 r3744 1 1 #!/bin/bash 2 module load nco/4. 4.82 module load nco/4.6.9 3 3 4 4 ia="1" #=== Indices of chosen Amip datasets (see below AMIP_VERSION_NAMES/AMIP_VERSION_FOLDERS) … … 19 19 local=$PWD 20 20 case $machine in 21 ada) work=$WORKDIR; DATAIN="" 22 DATAOU='/workgpfs/rech/psl/rpsl035/IGCM' ;; 23 curie) work=$CCCWORKDIR; DATAIN="" 24 DATAOU='/ccc/work/rech/psl/rpsl035/IGCM' ;; 25 ciclad) work=/data/$USER; DATAIN=/prodigfs/project/input4MIPs/CMIP6/CMIP 26 DATAOU='/prodigfs/ipslfs/igcmg/IGCM' ;; 21 ada) work=$WORKDIR 22 DATAIN="" 23 DATAOU='/workgpfs/rech/psl/rpsl035/IGCM/ATM' ;; 24 curie) work=$WORKDIR 25 DATAIN="" 26 DATAOU='/ccc/work/cont003/igcmg/igcmg/IGCM/ATM' ;; 27 ciclad) work=/data/$USER 28 DATAIN='/prodigfs/project/input4MIPs/CMIP6/CMIP' 29 DATAOU='/prodigfs/ipslfs/igcmg/IGCM/ATM' ;; 27 30 esac 28 DATAOU=/home/tlurton/IGCM ##### !!!!!! PROVISOIRE !!!!!!! 29 31 if [ "$DATAIN" = "" ]; then echo "Raw data folder for $machine has to be specified."; exit; fi 32 DATAOU=/data/dcugnet$DATAOU 30 33 #--- INPUT DATA: AMIP 31 34 AMIP_VERSION_NAMES=('PCMDI-AMIP-1-1-3') … … 43 46 ozon_vname_in='vmro3' 44 47 ozon_fname_in='${V}_input4MIPs_ozone_CMIP_${ozon_version_name}_${ozon_version_folder%/*}_${Yi}01-${Yf}12.nc' 48 res3D='144x96x66' 49 res2D='96x66_zonal' 50 45 51 46 52 #--- VERSIONS OF INPUT FILES EFFECTIVELY CHOSEN … … 48 54 49 55 #--- OUTPUT DATA 50 DATAOU=${DATAOU%/*}/ANTICHAMBRE;if [ ! -d $DATAOU ]; then mkdir -p $DATAOU; fi51 AMIP_FOLDER_OU=$DATAOU/' ATM/LIMIT/AMIP.${amip_version_folder##*/}/${suf}'52 OZON_FOLDER_OU=$DATAOU/' ATM/OZONE/UReading.${ozon_version_folder##*/}'56 if [ ! -d $DATAOU ]; then mkdir -p $DATAOU; fi 57 AMIP_FOLDER_OU=$DATAOU/'LIMIT/AMIP.${amip_version_folder##*/}/${suf}' 58 OZON_FOLDER_OU=$DATAOU/'OZONE/UReading/historical.${ozon_version_folder##*/}/original' 53 59 amip_vname_ou=('tosbcs' 'sicbcs'); amip_fname_ou='amip${bc}_${V}_360x180_${Y}.nc' 54 60 ozon_vname_ou='tro3' ; ozon_fname_ou='${V}_${Y}.nc' … … 233 239 } 234 240 #================================================================================== 241 function get_boundsvar { 242 # Input arguments: 243 # $1: file name $2: variable name 244 local a=$(ncdump -h $1 | grep -P "\t$2:bounds") 245 if [ "$a" != "${a#*\"}" ]; then a=${a#*\"}; echo ${a%\"*}; else echo ""; fi 246 } 247 #================================================================================== 248 function rename_bounds { 249 # Input arguments: 250 # $1: file name $2: variable name $3: new variable name 251 local vin=$(get_boundsvar $1 $2) beg end vou 252 if [ "$vin" = "" ]; then return 1; fi 253 beg=${vin##*$2}; if [ "$beg" = "$vin" ]; then beg=$vin; fi 254 beg=${vin%%$2*}; if [ "$end" = "$vin" ]; then end=$vin; fi 255 if [[ "$beg" = "" && "$end" = "" ]]; then return 1; fi 256 vou=$beg$3$end 257 echo "$2,$vin,$vou" 258 } 259 #================================================================================== 235 260 function renam_dims { 236 261 # Input arguments: … … 238 263 # 239 264 # Purpose: 240 # Rename dimensions, dimensional variables and possibly bounds_<variable>. 241 # 242 local f=$1 out="" nam_in nam_ou 265 # Rename dimensions, dimensional variables. 266 # In case of boundary grid variables with bounds_<variable> names are available, 267 # they are renamed together with the corresponding "bounds" attributes. 268 local vio f=$1 out="|" nam_in nam_ou 243 269 shift 244 270 while [ $# -ge 1 ]; do … … 246 272 if [ "$nam_in" != "$nam_ou" ]; then 247 273 out="$out -d $nam_in,$nam_ou -v $nam_in,$nam_ou" 248 nam_in=bounds_$nam_in; nam_ou=bounds_$nam_ou249 test_var $f $nam_in250 if [ $? -eq 0 ]; then out="$out -d $nam_in,$nam_ou -v $nam_in,$nam_ou"; fi274 #--- CHECK WETHER "bounds" ATTRIBUTE IS THERE 275 vio="$(rename_bounds $f $nam_in $nam_ou)" 276 if [ "$vio" != "" ]; then out="-a bounds,${vio%%,*},m,c,${vio##*,} ${out} -v ${vio#*,}"; fi 251 277 fi 252 278 ((ia++)) … … 351 377 352 378 nm=12 353 d_o2=$d_ou/ 2D_12Fields#--- Output folder (2D)354 d_o3=$d_ou/ 3D_12Fields#--- Output folder (3D)379 d_o2=$d_ou/${res2D} #--- Output folder (2D) 380 d_o3=$d_ou/${res3D} #--- Output folder (3D) 355 381 if [ ! -d $d_o2 ]; then mkdir -p $d_o2; fi; f_o2=$d_o2/$f_ou 356 382 if [ ! -d $d_o3 ]; then mkdir -p $d_o3; fi; f_o3=$d_o3/$f_ou 357 383 358 384 echo ">> BUILDING $nm MONTHS OZONE FILES FOR PERIOD ${Y_ozon_beg}-${Y_ozon_end} USING $OZON_VERSION_NAMES DATASET (${ozon_version_folder##*/})..." 359 for Y in $(eval echo {${Y_ozon_beg}..${Y_ozon_end}}); do #--- Loop on years385 for Y in $(eval echo {${Y_ozon_beg}..${Y_ozon_end}}); do #--- Loop on years 360 386 361 387 #--- RECOMPUTE OR NOT … … 365 391 extract $v_in,$v_ou $f_in,$f_o3 $Y_ozon_beg,$Y_ozon_end,50 $Y 0 366 392 367 #--- RENAME DIM ENSIONS ACCORDING TO $coords VARIABLE393 #--- RENAME DIMS/VARS ACCORDING TO $coords VARIABLE + "bounds" ATTRIBUTE IF REQUIRED 368 394 fo3=$(Y=$Y; eval echo $f_o3); fo2=$(Y=$Y; eval echo $f_o2) 369 if [ $Y -eq $Y_ozon_beg ]; then args_ren=$(renam_dims $fo3 $coords); fi 395 if [ $Y -eq $Y_ozon_beg ]; then 396 args_all=$(renam_dims $fo3 $coords) 397 args_att=${args_all%|*}; args_ren=${args_all#*|} 398 fi 399 if [ "$args_att" != "" ]; then ncatted $args_att $fo3 2>&1 > /dev/null ; fi 370 400 if [ "$args_ren" != "" ]; then ncrename $args_ren $fo3 2>&1 > /dev/null ; fi 371 401 … … 389 419 v_ou=${ozon_vname_ou} #--- Output variable 390 420 391 for r ank in 3 2; do #--- Loop on rank392 d 12=$d_ou/${rank}D_12Fields421 for res in ${res3D} ${res2D}; do #--- zonal/3D loop 422 dr=$d_ou/$res 393 423 394 424 #--- CLIMATOLOGY ON GIVEN YEARS INTERVAL (Y_clim_beg-Y_clim_end) 395 425 f_ou=$(V=$v_ou; Y=${Y_clim_beg}_${Y_clim_end}_clim; eval echo $ozon_fname_ou) #--- Regular climatology name 396 if [[ ! -f $d 12/$f_ou || $recomp = 'y' ]]; then397 echo ">> BUILDING 12 MONTHS $ {rank}D$v_ou CLIMATOLOGY ON PERIOD ${Y_clim_beg}-${Y_clim_end}..."398 make_clim $v_ou $d 12/\$ozon_fname_ou ${Y_clim_beg},${Y_clim_end} 0426 if [[ ! -f $dr/$f_ou || $recomp = 'y' ]]; then 427 echo ">> BUILDING 12 MONTHS $res $v_ou CLIMATOLOGY ON PERIOD ${Y_clim_beg}-${Y_clim_end}..." 428 make_clim $v_ou $dr/\$ozon_fname_ou ${Y_clim_beg},${Y_clim_end} 0 399 429 fi 400 430 … … 404 434 f_in=$(V=$v_in; Yi=1850; Yf=1850; ozon_version_name=$ozon_version_name; ozon_version_folder=$ozon_version_folder; clim='C'; eval echo $OZON_FOLDER_IN/$ozon_fname_in); #f_in=${f_in%.nc*}-clim.nc 405 435 f_ou=$(V=$v_ou; Y=1850_1850_clim; eval echo $ozon_fname_ou) 406 if [[ ! -f $d 12/$f_ou || $recomp = 'y' ]]; then407 echo ">> BUILDING 12 MONTHS $ {rank}D$v_ou PRE-INDUSTRIAL CLIMATOLOGY..."408 if [ $rank -eq 3 ]; then f_ou0=$d12/$f_ou436 if [[ ! -f $dr/$f_ou || $recomp = 'y' ]]; then 437 echo ">> BUILDING 12 MONTHS $res $v_ou PRE-INDUSTRIAL CLIMATOLOGY..." 438 if [ "$res" = "${res3D}" ]; then f_ou0=$dr/$f_ou 409 439 410 440 #--- DUPLICATE FILE AND RENAME DIMENSIONS 411 cp $f_in $d12/$f_ou ; args_ren=$(renam_dims $d12/$f_ou $coords) 412 ncrename $args_ren -v $ozon_vname_in,$ozon_vname_ou $d12/$f_ou 2>&1 > /dev/null 413 441 cp $f_in $dr/$f_ou 442 args_all=$(renam_dims $dr/$f_ou $coords) 443 args_att=${args_all%|*}; args_ren=" -v $ozon_vname_in,$ozon_vname_ou ${args_all#*|}" 444 if [ "$args_att" != "" ]; then ncatted $args_att $dr/$f_ou 2>&1 > /dev/null ; fi 445 if [ "$args_ren" != "" ]; then ncrename $args_ren $dr/$f_ou 2>&1 > /dev/null ; fi 414 446 else 415 447 #--- ZONAL MEAN 416 ncwa -a longitude $f_ou0 $tmp ; mv $tmp $d12/$f_ou417 ncks -x -v longitude $d 12/$f_ou $tmp ; mv $tmp $d12/$f_ou448 ncwa -a longitude $f_ou0 $tmp ; mv $tmp $dr/$f_ou 449 ncks -x -v longitude $dr/$f_ou $tmp ; mv $tmp $dr/$f_ou 418 450 419 451 #--- REMOVE USELESS VARIABLE 420 452 v="bounds_longitude" 421 test_var $d 12/$f_ou $v422 if [ $? -eq 0 ]; then ncks -x -v $v $d 12/$f_ou $tmp ; mv $tmp $d12/$f_ou; fi453 test_var $dr/$f_ou $v 454 if [ $? -eq 0 ]; then ncks -x -v $v $dr/$f_ou $tmp ; mv $tmp $dr/$f_ou; fi 423 455 fi 424 456 fi … … 430 462 #++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 431 463 464 -
TOOLS/CMIP6_FORCING/OZONE/description_ozone.txt
r3389 r3744 1 Utilisation du script /home/dcugnet/CLIMS_CMIP6/clims_CMIP6.bash, qui fournit à la fois les fichiers zonaux et les fichiers 3D à 12 enregistrements.2 => fichiers annuels et quelques climatologies. Seuls les fichiers à 14 champs sont actuellement utilisés.1 Utilisation du script clims_CMIP6.bash, qui fournit à la fois les fichiers zonaux et les fichiers 3D à 12 enregistrements. 2 => fichiers annuels et quelques climatologies. 3 3 4 4 Utilisation des archives officielles CMIP6 ; extraction par années (12 mois). … … 9 9 10 10 En sortie de co0l: 11 climoz_ lmdz.nc interpolé horizontalement (3D ou zonal)11 climoz_LMDZ.nc interpolé horizontalement (3D ou zonal), 14 mois. 12 12 13 13 Pour les versions zonales: nco. … … 17 17 Période industrielle pour l'ozone: 1979_2008. 18 18 19 Quels fichiers *.def et quelle version de ce0l ? A venir... 19 ce0l à partir de la révision de 3278. 20 Les fichiers *.def proviennent du dossier DefLists/ correspondant. 21 Ils peuvent être construits: 22 * via modipsl 23 * à l'aide de "gen_jobs_ce0l.bash", qui construit des jobs pour différentes configurations (masque, résolution...) 20 24
Note: See TracChangeset
for help on using the changeset viewer.