Changeset 6228


Ignore:
Timestamp:
08/08/22 10:39:24 (6 months ago)
Author:
omamce
Message:

O.M. : CPLRESTART
Switch complexe nco script to python

Location:
TOOLS/CPLRESTART
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • TOOLS/CPLRESTART/CreateRestartAtm4Oasis.bash

    r6226 r6228  
    2828# Usage exemples : 
    2929# CreateRestartAtm4Oasis.bash --oce ORCA2.3 /ccc/store/cont003/dsm/p25sepul/IGCM_OUT/IPSLCM5A2/PROD/piControl/CM5A2.1.pi.00/ATM/Output/MO/CM5A2.1.pi.00_40100101_40191231_1M_histmth.nc 
     30# CreateRestartAtm4Oasis.bash --oce eORCA1.2 /ccc/store/cont003/gencmip6/p86maf/IGCM_OUT/IPSLCM6/PROD/piControl/CM61-LR-pi-03/ATM/Output/MO/CM61-LR-pi-03_23400101_23491231_1M_histmth.nc 
    3031# CreateRestartAtm4Oasis.bash --oce ORCA2.3 /ccc/work/cont003/gencmip6/bedidil/SAVE8_ORCA2/STORE1/dynamico_grid.nc 
    3132# CreateRestartAtm4Oasis.bash --oce ORCA2.3 /ccc/work/cont003/gencmip6/bedidil/SAVE9_ORCA2_DYN30_1MO/STORE1/histmth.nc 
     
    4950if [[ $(hostname) = curie* ]] ; then arch=curie ; center=tgcc ; fi 
    5051if [[ $(hostname) = irene* ]] ; then arch=irene ; center=tgcc ; fi 
     52if [[ $(hostname) = lsce*  ]] ; then arch=spip  ; center=spip ; fi 
    5153 
    5254case ${arch} in 
    53     ( curie | irene ) 
    54     set +vx 
    55     module unload cdo nco ferret 
    56     module unload netcdf hdf5 
    57     module load python # /2.7.12 
    58     module load netcdf/4.3.3.1_hdf5_parallel # Version for XIOS 
     55    ( irene ) 
     56    set +e 
     57    R_IN=$(ccc_home -u igcmg --cccwork)/IGCM 
     58    TMPDIR=${CCCWORKDIR}/TMP 
     59    SUBMIT_DIR=${BRIDGE_MSUB_PWD:-${SUBMIT_DIR}} 
     60    MpiRun="time ccc_mprun" 
     61    PyRun="time ccc_mprun -n 1" # Needed to force python to run on one process only 
     62    module purge 
     63    module load hdf5 
     64    module load netcdf-c 
    5965    module load nco 
    60     R_IN=$(ccc_home -u igcmg --cccwork)/IGCM 
    61     TMPDIR=${SCRATCHDIR}/TMP 
    62     SUBMIT_DIR=${BRIDGE_MSUB_PWD:-${SUBMIT_DIR}} 
     66    module load cdo 
     67    module load python3 
     68    module load datadir/igcmg 
     69    module list 
     70    set -e 
     71    ;; 
     72    ( spip ) 
     73    R_IN=${HOME}/Scratch/IGCM 
     74    TMPDIR=${HOME}/Scratch/TMP 
     75    SUBMIT_DIR=$(pwd) 
     76    MpiRun="/opt/local/bin/mpirun -n 1" 
     77    PyRun="time" 
    6378    ;; 
    6479    ( * ) 
     
    87102    shift 
    88103done 
     104 
     105 
     106set -e 
    89107 
    90108#AtmFile=${1:-/ccc/store/cont003/dsm/p25sepul/IGCM_OUT/IPSLCM5A2/PROD/piControl/CM5A2.1.pi.00/ATM/Output/MO/CM5A2.1.pi.00_40100101_40191231_1M_histmth.nc} 
     
    135153    ncap2 --history --overwrite --fl_fmt=${FL_FMT} --script-file add_dim.nco flxat_fields_notime.nc tmp_flxat_fields_notime.nc 
    136154    mv tmp_flxat_fields_notime.nc flxat_fields_notime.nc 
    137  
    138 cat<<EOF > lonlat2xyz.nco 
    139 // Value at North Pole for DYNAMICO grid  
    140 where ( lat(:,:) >= 90.0d ) COTAUXXU = double(-tau_y) ; 
    141 where ( lat(:,:) >= 90.0d ) COTAUYYU = double( tau_x) ; 
    142 // Value at South Pole for DYNAMICO grid ? 
    143 EOF 
    144155else 
    145156    # lat/lon 
     
    158169    ATM=LMD${dim_lon}${dim_lat} 
    159170    (( n_lat = dim_lat - 1 )) 
    160 cat<<EOF > lonlat2xyz.nco 
    161 // Value at North Pole for LMDZ lon/lat grid 
    162 COTAUXXU(0,:) = double( -tau_x (0, 0) ) ; 
    163 COTAUYYU(0,:) = double( -tau_y (0, 0) ) ; 
    164 COTAUZZU(0,:) =  0.0d ;  
    165 // Value at south Pole for LMDZ lon/lat grid ? 
    166 COTAUXXU(${n_lat},:) = double( -tau_x (${n_lat}, 0) ) ; 
    167 COTAUYYU(${n_lat},:) = double( -tau_y (${n_lat}, 0) ) ; 
    168 COTAUZZU(${n_lat},:) =  0.0d ;  
    169 EOF 
     171 
    170172 
    171173fi 
     
    178180## =========================================================================== 
    179181 
    180 cat <<EOF > create_flxat.nco 
    181 // 
    182 *fract_oce_plus_sic  = double(fract_oce + fract_sic) ; // ocean fraction 
    183 *fract_oce_norm[y,x] = 0.0d ; *fract_sic_norm[y,x] = 0.0d ;  
    184 where (fract_oce_plus_sic >  0.0d ) fract_oce_norm = double(fract_oce)/fract_oce_plus_sic ; // free ocean vs. total ocean fraction 
    185 where (fract_oce_plus_sic >  0.0d ) fract_sic_norm = double(fract_sic)/fract_oce_plus_sic ; // sea ice vs. total ocean fraction 
    186 // 
    187 COTOTRAI[y,x] = double(precip-snow)    ;  //  Liquid precip 
    188 COTOTSNO[y,x] = double(snow)           ;  //  Solid precipitation 
    189 COTOTEVA[y,x] = double(evap_oce*fract_oce_norm + evap_sic*fract_sic_norm) ; 
    190 COICEVAP[y,x] = double(evap_sic)       ; // Evaporation on sea ice 
    191 COQSRMIX[y,x] = double(sols)           ; // Heat flux short wave 
    192 COQNSMIX[y,x] = double(soll)           ; // Heat flux minus short wave 
    193 COSHFICE[y,x] = double(sols)           ; // Heat flux short wave over sea ice 
    194 CONSFICE[y,x] = double(soll)           ; // Heat flux minus short wave over sea ice 
    195 CODFLXDT[y,x] = -20.0d       ; // W/m2 - dQ/dt 
    196 COCALVIN[y,x] =   0.0d       ; // Calving of icebergs, solid 
    197 COLIQRUN[y,x] =   0.0d       ; // River run-off , liquid 
    198 COWINDSP[y,x] = double( wind10m )      ; // Wind speed at 10m high 
    199 COTAUMOD[y,x] =   0.0d                 ; // Wind stress modulus 
    200 // Wind stress 
    201 *tau_x[y,x] = double(taux_oce*fract_oce_norm + taux_sic*fract_sic_norm) ;  
    202 *tau_y[y,x] = double(tauy_oce*fract_oce_norm + tauy_sic*fract_sic_norm) ; 
    203 COTAUMOD[y,x] = sqrt ( double(tau_x*tau_x + tau_y*tau_y) )  ;  
    204 // Wind stress, from east/north components to geocentric 
    205 *rpi = acos (-1.0d) ;  *rad = rpi / 180.0d  ;  
    206 COTAUXXU[y,x] = double( -tau_x * sin(rad * lon) - tau_y * sin(rad * lat) * cos(rad * lon) );  
    207 COTAUYYU[y,x] = double(  tau_x * cos(rad * lon) - tau_y * sin(rad * lat) * sin(rad * lon) ); 
    208 COTAUZZU[y,x] = double(  tau_y * cos(rad * lat) ) ; 
    209 // Value at North Pole 
    210 #include "lonlat2xyz.nco" 
    211 // 
    212 COTAUXXV[y,x] = COTAUXXU ; 
    213 COTAUYYV[y,x] = COTAUYYU ; 
    214 COTAUZZV[y,x] = COTAUZZU ; 
    215 // 
    216 EOF 
    217 ncap2 --overwrite --fl_fmt=${FL_FMT} --history --script-file create_flxat.nco flxat_fields_notime.nc tmp_flxat.nc 
    218  
    219 ncks --fl_fmt=${FL_FMT} --overwrite --history --variable lon,lat tmp_flxat.nc flxat.nc 
    220 [[ ${IsUnstructured} = yes ]] && ncks --fl_fmt=${FL_FMT} --history --append --variable bounds_lon,bounds_lat tmp_flxat.nc flxat.nc 
     182python3 create_flxat.py --IsUnstructured=${IsUnstructured} --input flxat_fields_notime.nc --output tmp_flxat.nc 
     183 
     184[[ ${IsUnstructured} = yes ]] && ncks --fl_fmt=${FL_FMT} --history --append --variable bounds_lon,bounds_lat flxat.nc  tmp_flxat.nc  
    221185ncks --fl_fmt=${FL_FMT} --append --history --variable COTAUXXU,COTAUYYU,COTAUZZU,COTAUXXV,COTAUYYV,COTAUZZV,COTOTRAI,COTOTSNO,COTOTEVA,COICEVAP,COQSRMIX,COQNSMIX,COSHFICE,CONSFICE,CODFLXDT,COCALVIN,COLIQRUN,COWINDSP,COTAUMOD tmp_flxat.nc flxat.nc 
    222186 
     
    251215        --attribute Comment,global,o,c,"Preliminary attempt - Do not trust !" \ 
    252216        --attribute SVN_Author,global,o,c,"$Author$"                 \ 
    253         --attribute SVN_Date,global,o,c,"$Date$"                            \ 
     217        --attribute SVN_Date,global,o,c,"$Date$" \ 
    254218        --attribute SVN_Revision,global,o,c,"$Revision$"               \ 
    255         --attribute SVN_Id,global,o,c,"$Id$"                                \ 
     219        --attribute SVN_Id,global,o,c,"$Id$" \ 
    256220        flxat.nc 
    257221 
  • TOOLS/CPLRESTART/CreateRestartOce4Oasis.bash

    r5155 r6228  
    3030# 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 
    3131# 
    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 
     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/gencmip6/p86maf/IGCM_OUT/IPSLCM6/PROD/piControl/CM61-LR-pi-03/OCE/Output/MO/CM61-LR-pi-03_23400101_23491231_1M_grid_T.nc --icefile /ccc/store/cont003/gencmip6/p86maf/IGCM_OUT/IPSLCM6/PROD/piControl/CM61-LR-pi-03/ICE/Output/MO/CM61-LR-pi-03_23400101_23491231_1M_icemod.nc --icefrc siconc 
    3335 
    3436# 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 
     
    5052# 
    5153# --ocefile : file in which sea surface temperature is read 
    52 # --icefile : file in which sea ice fraction, albedo and surface temperature are read. 
     54# --icefile : file in which sea ice fraction, albedo and ice surface temperature are read. 
    5355#             if not specified, these variables are readed in the ocean file 
    5456# 
     
    8890case ${arch} in 
    8991    ( irene ) 
    90     set +vx 
    91     module unload cdo nco ferret 
    92     module unload netcdf hdf5 
    93     module load python # /2.7.12 
    94     #module load netcdf/4.3.3.1_hdf5_parallel # Version for XIOS 
     92    set +e 
     93    R_IN=$(ccc_home -u igcmg --cccwork)/IGCM 
     94    TMPDIR=${CCCWORKDIR}/TMP 
     95    SUBMIT_DIR=${BRIDGE_MSUB_PWD:-${SUBMIT_DIR}} 
     96    MpiRun="time ccc_mprun" 
     97    PyRun="time ccc_mprun -n 1" # Needed to force python to run on one process only 
     98    module purge 
     99    module load hdf5 
     100    module load netcdf-c 
    95101    module load nco 
     102    module load cdo 
    96103    module load python3 
    97     R_IN=$(ccc_home -u igcmg --cccwork)/IGCM 
    98     TMPDIR=${SCRATCHDIR}/TMP 
    99     SUBMIT_DIR=${BRIDGE_MSUB_PWD:-${SUBMIT_DIR}} 
     104    module load datadir/igcmg 
     105    module list 
     106    set -e 
     107    ;; 
     108    ( spip ) 
     109    R_IN=${HOME}/Scratch/IGCM 
     110    TMPDIR=${HOME}/Scratch/TMP 
     111    SUBMIT_DIR=$(pwd) 
     112    MpiRun="/opt/local/bin/mpirun -n 1" 
     113    PyRun="time" 
    100114    ;; 
    101115    ( * ) 
     
    203217[[ ${dim_x} =  182 && ${dim_y} =  149 ]] && OCE=ORCA2.3 
    204218[[ ${dim_x} =  362 && ${dim_y} =  332 ]] && OCE=eORCA1.2 
     219[[ ${dim_x} =  360 && ${dim_y} =  331 ]] && OCE=eORCA1.4 
    205220[[ ${dim_x} = 1442 && ${dim_y} = 1207 ]] && OCE=eORCA025.1 
    206221 
     
    209224## =========================================================================== 
    210225cat <<EOF > create_sstoce.nco 
    211 *OceSst[y,x]    = double ( ${OceSst}(:,:) + 273.15d ) ; 
    212 OIceFrc[y,x]   = double ( ${IceFrc}(:,:) ) ;  
     226*OceSst[y,x] = double ( ${OceSst}(:,:) + 273.15d ) ; 
     227OIceFrc[y,x] = double ( ${IceFrc}(:,:) ) ;  
    213228// 
    214229EOF 
     
    216231if [[ "X${IceAlb}" != "Xnone" ]] ; then 
    217232    cat <<EOF >> create_sstoce.nco 
    218 *IceAlb[y,x]  = double ( ${IceAlb}(:,:) ) ; 
     233*IceAlb[y,x] = double ( ${IceAlb}(:,:) ) ; 
    219234// 
    220235EOF 
     
    239254 
    240255cat <<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(:,:)  ; 
    244 O_OCurx1[y,x]  = 0.0d ; 
    245 O_OCury1[y,x]  = 0.0d ; 
    246 O_OCurz1[y,x]  = 0.0d ; 
     256O_SSTSST[y,x] = OceSst (:,:) * (1.0d-OIceFrc(:,:)) ; 
     257O_AlbIce[y,x] = IceAlb (:,:)       * OIceFrc(:,:)  ; 
     258O_TepIce[y,x] = IceTem (:,:)       * OIceFrc(:,:)  ; 
     259O_OCurx1[y,x] = 0.0d ; 
     260O_OCury1[y,x] = 0.0d ; 
     261O_OCurz1[y,x] = 0.0d ; 
    247262EOF 
    248263 
Note: See TracChangeset for help on using the changeset viewer.