- Timestamp:
- 02/07/19 10:04:07 (5 years ago)
- Location:
- TOOLS/MOSAIX
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
TOOLS/MOSAIX/CalvingWeights.py
r4199 r4259 347 347 v_remap_matrix = f_calving.createVariable ( 'remap_matrix', 'f8', ('num_links', 'num_wgts') ) 348 348 v_src_address = f_calving.createVariable ( 'src_address' , 'i4', ('num_links',) ) 349 v_src_address = f_calving.createVariable ( 'dst_address' , 'i4', ('num_links',) ) 349 v_src_address.convention = "Fortran style addressing, starting at 1" 350 v_dst_address = f_calving.createVariable ( 'dst_address' , 'i4', ('num_links',) ) 351 v_dst_address.convention = "Fortran style addressing, starting at 1" 350 352 351 353 v_remap_matrix[:] = remap_matrix 352 354 v_src_address [:] = src_address 353 v_ src_address [:] = src_address355 v_dst_address [:] = dst_address 354 356 355 357 v_src_grid_dims = f_calving.createVariable ( 'src_grid_dims' , 'i4', ('src_grid_rank',) ) -
TOOLS/MOSAIX/CreateOasisGrids.bash
r4199 r4259 178 178 179 179 ncks --history -C --variable OceMask ${ATM}_grid_maskFrom_${OCE}.nc OceMask_tmp.nc 180 ncwa --history --overwrite --average time_counter OceMask_tmp.nc OceMask_tmp2.nc # Suppress time dimension180 #ncwa --history --overwrite --average time_counter OceMask_tmp.nc OceMask_tmp2.nc # Suppress time dimension 181 181 ncatted --history \ 182 182 --attribute cell_methods,OceMask,d,c, \ … … 186 186 --attribute missing_value,OceMask,d,, \ 187 187 OceMask_tmp.nc 188 ncap2 --history --append --script "OceMask=int(1-OceMask)" OceMask_tmp 2.nc masks_${CplModel}.nc # For OASIS, ocean=0, land=1188 ncap2 --history --append --script "OceMask=int(1-OceMask)" OceMask_tmp.nc masks_${CplModel}.nc # For OASIS, ocean=0, land=1 189 189 rm OceMask_tmp.nc 190 190 ncatted --history \ … … 398 398 done 399 399 400 401 echo ${Titre}"Add time axis and coordinates information"${Norm} 402 # (needed if files need to be read by XIOS) ??? 403 ## =========================================================================== 404 ncap2 --overwrite --history --script 'defdim("time_counter",1) ;' ${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}_time.nc 405 406 if [[ ${atm} = ico ]] ; then 407 cat <<EOF > add_time.nco 408 OceFrac [time_counter,cell] = OceFrac [cell] ; 409 OceMask [time_counter,cell] = OceMask [cell] ; 410 EOF 411 ncap2 --overwrite --history --script-file add_time.nco ${ATM}_grid_maskFrom_${OCE}_time.nc tmp_${ATM}_grid_maskFrom_${OCE}_time.nc ; mv tmp_${ATM}_grid_maskFrom_${OCE}_time.nc ${ATM}_grid_maskFrom_${OCE}_time.nc 412 ncatted --history \ 413 -a coordinates,OceFrac,m,c,"time_counter lat lon" \ 414 -a coordinates,OceMask,m,c,"time_counter lat lon" \ 415 -a coordinates,aire,c,c,"lat lon" \ 416 ${ATM}_grid_maskFrom_${OCE}.nc 417 fi 418 419 if [[ ${atm} = lmd ]] ; then 420 cat <<EOF > add_time.nco 421 OceFrac [time_counter,lat,lon] = OceFrac [lat,lon] ; 422 OceMask [time_counter,lat,lon] = OceMask [lat,lon] ; 423 EOF 424 ncap2 --overwrite --history --script-file add_time.nco ${ATM}_grid_maskFrom_${OCE}_time.nc tmp_${ATM}_grid_maskFrom_${OCE}_time.nc 425 ncdump -h tmp_${ATM}_grid_maskFrom_${OCE}_time.nc 426 mv tmp_${ATM}_grid_maskFrom_${OCE}_time.nc ${ATM}_grid_maskFrom_${OCE}_time.nc 427 428 ncatted --history \ 429 -a coordinates,OceFrac,m,c,"time_counter lat lon" \ 430 -a coordinates,OceMask,m,c,"time_counter lat lon" \ 431 -a coordinates,aire,m,c,"lat lon" \ 432 ${ATM}_grid_maskFrom_${OCE}.nc 433 fi 434 ncks --alphabetize --history --overwrite --mk_rec time_counter ${ATM}_grid_maskFrom_${OCE}_time.nc tmp_${ATM}_grid_maskFrom_${OCE}_time.nc 435 mv tmp_${ATM}_grid_maskFrom_${OCE}_time.nc ${ATM}_grid_maskFrom_${OCE}_time.nc 400 436 ## 401 437 echo ${Titre}"Add some useful information in NetCDF headers"${Norm} -
TOOLS/MOSAIX/CreateWeightsMask.bash
r4199 r4259 46 46 export Reve=$(tput rev ) 47 47 couleurs=( "Black" "Blue" "Green" "Cyan" "Red" "Magenta" "Yellow" "White" ) 48 for i in $(seq 0 7 ) ; do eval "export ${couleurs[$i]}=$(tput setf $i)" ; done48 for i in $(seq 0 7) ; do eval "export ${couleurs[$i]}=$(tput setf ${i})" ; done 49 49 export Norm=$(tput sgr0) 50 50 export Titre=${Bold}${Blue} … … 58 58 echo ${Titre}"Defines models"${Norm} 59 59 # ================================== 60 OCE=ORCA2.361 #OCE=eORCA1.260 #OCE=ORCA2.3 61 OCE=eORCA1.2 62 62 #OCE=eORCA025 63 63 64 ATM=ICO3064 #ATM=ICO30 65 65 #ATM=ICO40 66 66 #ATM=ICO450 67 67 #ATM=LMD9695 68 #ATM=LMD14414268 ATM=LMD144142 69 69 #ATM=LMD256256 70 70 … … 116 116 # maskDst : true to use the destination grid mask, false to use all grid points 117 117 # 118 # Classic cases for IPSLCM6 119 AtmOceFluxes=" Direction=a2o,Order=1st,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=t,useArea=true,maskSrc=true,maskDst=true,Name=HeatWaterFluxes" # Heat and water fluxes 120 OceAtmTemp=" Direction=o2a,Order=1st,Quantity=false,Renormalize=true,oceGrid=t,atmGrid=t,useArea=false,maskSrc=true,maskDst=true,Name=TempIceAlb" # Temperature, sea-ice fraction, albedo 121 AtmOceStressU=" Direction=a2o,Order=2nd,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=u,useArea=true,maskSrc=true,maskDst=true,Name=WindStress" # Wind stress to NEMO U point 122 AtmOceStressV=" Direction=a2o,Order=2nd,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=v,useArea=true,maskSrc=true,maskDst=true,Name=WindStress" # Wind stress to NEMO V point 123 AtmOceQuantity="Direction=a2o,Order=1st,Quantity=true,Renormalize=false,atmGrid=t,oceGrid=t,useArea=false,maskSrc=true,maskDst=true,Name=Quantity" # e.g. runoff 118 ## Classic cases for IPSLCM6 119 AtmOceFluxes=" Direction=a2o,Order=1st,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=t,useArea=true,maskSrc=true,maskDst=true,Name=HeatWaterFluxes" # Heat and water fluxes 120 AtmOceFluxes2nd="Direction=a2o,Order=2nd,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=t,useArea=true,maskSrc=true,maskDst=true,Name=HeatWaterFluxes" # Heat and water fluxes 121 OceAtmTemp=" Direction=o2a,Order=1st,Quantity=false,Renormalize=true,oceGrid=t,atmGrid=t,useArea=false,maskSrc=true,maskDst=true,Name=TempIceAlb" # Temperature, sea-ice fraction, albedo 122 OceAtmTemp2nd=" Direction=o2a,Order=2nd,Quantity=false,Renormalize=true,oceGrid=t,atmGrid=t,useArea=false,maskSrc=true,maskDst=true,Name=TempIceAlb" # Temperature, sea-ice fraction, albedo 123 AtmOceStressU=" Direction=a2o,Order=2nd,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=u,useArea=true,maskSrc=true,maskDst=true,Name=WindStress" # Wind stress to NEMO U point 124 AtmOceStressV=" Direction=a2o,Order=2nd,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=v,useArea=true,maskSrc=true,maskDst=true,Name=WindStress" # Wind stress to NEMO V point 125 AtmOceQuantity=" Direction=a2o,Order=1st,Quantity=true,Renormalize=false,atmGrid=t,oceGrid=t,useArea=false,maskSrc=true,maskDst=true,Name=Quantity" # e.g. runoff 124 126 # Other cases 125 OceAtmFluxes=" Direction=o2a,Order=1st,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=t,useArea=true,maskSrc=true,maskDst=true,Name=OceAtmFluxes" # e.g. CO2 fluxes 126 AtmOceTemp=" Direction=o2a,Order=1st,Quantity=false,Renormalize=true,oceGrid=t,atmGrid=t,useArea=false,maskSrc=true,maskDst=true,Name=OceTemp" # e.g. T and S correction from DWL parametrization 127 OceAtmFluxes=" Direction=o2a,Order=1st,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=t,useArea=true,maskSrc=true,maskDst=true,Name=OceAtmFluxes" # e.g. CO2 fluxes 128 OceAtmFluxes2nd="Direction=o2a,Order=2nd,Quantity=false,Renormalize=false,atmGrid=t,oceGrid=t,useArea=true,maskSrc=true,maskDst=true,Name=OceAtmFluxes" # e.g. CO2 fluxes 129 AtmOceTemp=" Direction=o2a,Order=1st,Quantity=false,Renormalize=true,oceGrid=t,atmGrid=t,useArea=false,maskSrc=true,maskDst=true,Name=OceTemp" # e.g. T and S correction from DWL parametrization 130 AtmOceTemps2nd=" Direction=o2a,Order=2nd,Quantity=false,Renormalize=true,oceGrid=t,atmGrid=t,useArea=false,maskSrc=true,maskDst=true,Name=OceTemp" # e.g. T and S correction from DWL parametrization 131 132 ## Creates the list 127 133 128 134 # Standard list for IPSLCM6 129 135 #CommandList=( ${AtmOceFluxes} ${OceAtmTemp} ${AtmOceStressU} ${AtmOceStressV} ${OceAtmFluxes} Runoff Calving Grids ) 130 136 131 # More comprehesive list for IPSLCM6 with new features 132 CommandList=( ${AtmOceFluxes} ${OceAtmTemp} ${AtmOceStressU} ${AtmOceStressV} ${OceAtmFluxes} ${AtmOceTemp} Runoff Calving Grids ) 137 # More comprehensive list for IPSLCM6 with new features 138 #CommandList=( ${AtmOceFluxes} ${OceAtmTemp} ${AtmOceStressU} ${AtmOceStressV} ${OceAtmFluxes} ${AtmOceTemp} Runoff Calving Grids ) 139 140 # With 2nd order 141 CommandList=( ${AtmOceFluxes} ${AtmOceFluxes2nd} ${OceAtmTemp} ${OceAtmTemp2nd} ${AtmOceStressU} ${AtmOceStressV} ${OceAtmFluxes} ${OceAtmFluxes2nd} ${AtmOceTemp} ${AtmOceTemp2nd} Runoff Calving Grids ) 133 142 134 143 # Debugs 135 #CommandList=( Runoff )136 144 #CommandList=( ${AtmOceFluxes} ${OceAtmTemp} Runoff Calving Grids ) 137 145 #CommandList=( ${AtmOceFluxes} Runoff Calving Grids ) 138 CommandList=( ${AtmOceFluxes} ) 146 #CommandList=( ${AtmOceFluxes} ) 147 #CommandList=( Runoff ) 148 #CommandList=( Runoff Calving Grids ) 139 149 #CommandList=( Calving ) 140 150 #CommandList=( Grids ) 141 151 142 143 144 152 ## =========================================================================== 145 153 ## … … 149 157 Tag="MOSAIX" 150 158 SUBMIT_DIR=$(pwd) 159 FMT_XIOS=netcdf4 151 160 152 161 # Functions to handle command parameters … … 194 203 195 204 if [[ "${Name}" != "None" ]] ; then 196 FullName=${Name} 205 FullName=${Name}_${Order}Order 197 206 else 198 207 FullName=${Order}Order_${NormName}_${QuantName}_${AreaName} … … 224 233 ( irene ) 225 234 set +vx 235 set +e 226 236 R_IN=$(ccc_home -u igcmg --cccwork)/IGCM 227 237 TMPDIR=${CCCWORKDIR}/TMP … … 230 240 MpiRun="time ccc_mprun" 231 241 PyRun="time ccc_mprun -n 1" # Needed to force python to run on one process only 242 #module purge 243 source $(ccc_home -u igcmg)/MachineEnvironment/irene/env_irene 232 244 source ${SUBMIT_DIR}/arch.env 233 module load nco 234 #source $(ccc_home -u igcmg)/MachineEnvironment/irene/env_irene 245 #module load nco 235 246 module load python3 236 247 module load datadir/igcmg 237 248 module list 249 set -e 238 250 ;; 239 251 ( spip ) … … 273 285 esac 274 286 # 275 echo ${Titre}"Format for OASIS files : should be NetCDF3 classic or NetCDF3 64 bits"${Norm}276 # ---------------------------------------------------------------------------277 FMT_OASIS=64bit278 FMT_XIOS=netcdf4279 287 280 288 cp ${SUBMIT_DIR}/bin/interpol.exe . … … 491 499 ${MpiRun} ./interpol.exe --mask_src=${maskSrc} --mask_dst=${maskDst} --use_area=${useArea} 492 500 done 493 494 echo ${Titre}"Add time axis and coordinates information"${Norm}495 ## (needed if files need to be read by XIOS)496 ## ===========================================================================497 ncap2 --overwrite --history --script 'defdim("time_counter",1) ;' ${ATM}_grid_maskFrom_${OCE}.nc tmp_${ATM}_grid_maskFrom_${OCE}.nc ; mv tmp_${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}.nc498 499 if [[ ${atm} = ico ]] ; then500 cat <<EOF > add_time.nco501 OceFrac [time_counter,cell] = OceFrac [cell] ;502 OceMask [time_counter,cell] = OceMask [cell] ;503 EOF504 ncap2 --overwrite --history --script-file add_time.nco ${ATM}_grid_maskFrom_${OCE}.nc tmp_${ATM}_grid_maskFrom_${OCE}.nc ; mv tmp_${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}.nc505 ncatted --history \506 -a coordinates,OceFrac,m,c,"time_counter lat lon" \507 -a coordinates,OceMask,m,c,"time_counter lat lon" \508 -a coordinates,aire,c,c,"lat lon" \509 ${ATM}_grid_maskFrom_${OCE}.nc510 fi511 512 if [[ ${atm} = lmd ]] ; then513 cat <<EOF > add_time.nco514 OceFrac [time_counter,lat,lon] = OceFrac [lat,lon] ;515 OceMask [time_counter,lat,lon] = OceMask [lat,lon] ;516 EOF517 ncap2 --overwrite --history --script-file add_time.nco ${ATM}_grid_maskFrom_${OCE}.nc tmp_${ATM}_grid_maskFrom_${OCE}.nc518 ncdump -h tmp_${ATM}_grid_maskFrom_${OCE}.nc519 mv tmp_${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}.nc520 521 ncatted --history \522 -a coordinates,OceFrac,m,c,"time_counter lat lon" \523 -a coordinates,OceMask,m,c,"time_counter lat lon" \524 -a coordinates,aire,m,c,"lat lon" \525 ${ATM}_grid_maskFrom_${OCE}.nc526 fi527 ncks --alphabetize --history --overwrite --mk_rec time_counter ${ATM}_grid_maskFrom_${OCE}.nc tmp_${ATM}_grid_maskFrom_${OCE}.nc ; mv tmp_${ATM}_grid_maskFrom_${OCE}.nc ${ATM}_grid_maskFrom_${OCE}.nc528 501 529 502 ## … … 621 594 echo ${Titre}"Add missing variables in rmp files"${Norm} 622 595 ## =========================================================================== 623 for rmpFile in $(ls rmp_?${atm}_to_[tuv]${oce}_*.nc rmp_[tuv]${oce}_to_t${atm}_*.nc 2> &/dev/null ) ; do596 for rmpFile in $(ls rmp_?${atm}_to_[tuv]${oce}_*.nc rmp_[tuv]${oce}_to_t${atm}_*.nc 2> /dev/null ) ; do 624 597 echo ${rmpFile} 625 598 a_to_o=false ; o_to_a=false … … 690 663 dst_grid_area [dst_grid_size] = 0.0d ; 691 664 dst_grid_frac [dst_grid_size] = 1.0d ; 692 dst_grid_imask (:) = 1 - OceMask( 0,:) ;665 dst_grid_imask (:) = 1 - OceMask(:) ; 693 666 dst_grid_imask.int() ; 694 667 dst_grid_area (:) = aire(:) ; 695 dst_grid_frac (:) = OceFrac( 0,:) ;668 dst_grid_frac (:) = OceFrac(:) ; 696 669 EOF 697 670 cp add_varatm.nco add_varatm_$(basename ${rmpFile} .nc)_o_to_a.nco … … 734 707 dst_grid_area [dst_grid_size] = 0.0d ; 735 708 dst_grid_frac [dst_grid_size] = 1.0d ; 736 dst_grid_imask (:) = 1 - OceMask( 0,:,:) ;709 dst_grid_imask (:) = 1 - OceMask(:,:) ; 737 710 dst_grid_imask.int() ; 738 711 dst_grid_area (:) = aire(:,:) ; 739 dst_grid_frac (:) = OceFrac( 0,:,:) ;712 dst_grid_frac (:) = OceFrac(:,:) ; 740 713 EOF 741 714 cp add_varatm.nco add_varatm_$(basename ${rmpFile} .nc)_o_to_a.nco … … 767 740 echo ${Titre}"Runoff weights"${Norm} 768 741 ## =========================================================================== 769 #if [[ "X${okRunoff}" = "Xyes" && "${atm}" = "lmd" ]] ; then770 742 if [[ "X${okRunoff}" = "Xyes" ]] ; then 771 743 ${PyRun} python3 -u RunoffWeights.py --oce=${OCE} --atm=${ATM} \ … … 824 796 echo ${Titre}"Rename rmp and dia files"${Norm} 825 797 ## =========================================================================== 826 for File in $(ls dia_*.nc rmp_*.nc 2>&/dev/null ); do798 for File in $(ls *${oce}*${atm}* *${atm}*${oce}* 2> /dev/null ); do 827 799 NewFile=$(echo ${File} | sed -e "s/${atm}/${ATM}/" -e "s/${oce}/${OCE}/" ) 828 mv ${File} ${ SUBMIT_DIR}/${NewFile}800 mv ${File} ${NewFile} 829 801 done 830 802 … … 914 886 EOF 915 887 916 cp README.txt ${SUBMIT_DIR}/README_${CplModel}_MOSAIX.txt 917 888 if [[ "X${Version}" != "X" ]] ; then 889 cp README.txt ${SUBMIT_DIR}/README_${CplModel}_MOSAIX_${Version}.txt 890 else 891 cp README.txt ${SUBMIT_DIR}/README_${CplModel}_MOSAIX.txt 892 fi 918 893 ## =========================================================================== 919 894 ## -
TOOLS/MOSAIX/RunoffWeights.py
r4199 r4259 32 32 import sys, os, platform, argparse, textwrap, time 33 33 34 ## Use rful constants34 ## Useful constants 35 35 zero = np.dtype('float64').type(0.0) 36 36 zone = np.dtype('float64').type(1.0) … … 235 235 # Address on destination grid 236 236 oce_address_local = oceCoast_address[z_mask] 237 # Append to global tabs237 # Append to global arrays 238 238 remap_matrix = np.append ( remap_matrix, matrix_local ) 239 239 atm_address = np.append ( atm_address , atm_address_local ) … … 257 257 f_runoff.associatedFiles = grids + " " + areas + " " + masks 258 258 f_runoff.directory = os.getcwd () 259 f_runoff.description = "Generated with cotes_etal.py"259 f_runoff.description = "Generated with RunoffWeights.py" 260 260 f_runoff.title = runoff 261 261 f_runoff.Program = "Generated by " + sys.argv[0] + " with flags " + str(sys.argv[1:]) … … 263 263 f_runoff.oceCoastWidth = str(oceCoastWidth) + " grid points" 264 264 f_runoff.searchRadius = str(searchRadius/1000.) + " km" 265 f_runoff.atmQuantity = myargs.atmQuantity 266 f_runoff.oceQuantity = myargs.oceQuantity 265 267 f_runoff.gridsFile = grids 266 268 f_runoff.areasFile = areas … … 299 301 300 302 v_atm_address = f_runoff.createVariable ( 'src_address' , 'i4', ('num_links',) ) 303 v_atm_address.convention = "Fortran style addressing, starting at 1" 301 304 v_oce_address = f_runoff.createVariable ( 'dst_address' , 'i4', ('num_links',) ) 305 v_oce_address.convention = "Fortran style addressing, starting at 1" 302 306 303 307 v_remap_matrix[:] = remap_matrix 304 v_atm_address [:] = atm_address + 1 # OASIS uses Fortran style indexing 308 v_atm_address [:] = atm_address + 1 # OASIS uses Fortran style indexing, starting at one 305 309 v_oce_address [:] = oce_address + 1 306 310 -
TOOLS/MOSAIX/make_mosaix
r4102 r4259 21 21 echo "make_xios [options]" 22 22 echo "options :" 23 echo " [--xios path] : path to XIOS. Default is ../XIOS"23 echo " [--xios path] : path to XIOS. Default is ${xios_dir}" 24 24 echo " [--full] : to generate dependencies and recompile from scratch" 25 25 echo "Example : ./make_mosaix --xios ../XIOS" … … 58 58 # Use config.fcm from XIOS 59 59 rm -f ${install_dir}/config.fcm 60 #cp ${xios_dir}/config.fcm ${install_dir} 60 61 61 echo "%XIOS_DIR ${xios_dir} " > ${install_dir}/config.fcm 62 62 cat ${xios_dir}/config.fcm >> ${install_dir}/config.fcm -
TOOLS/MOSAIX/nemo.py
r4083 r4259 21 21 __HeadURL = "$HeadURL$" 22 22 23 def lbc (ptab, nperio=6, cd_type='T', psgn=1.0) : 24 # Set periodicity on input fields 23 import sys, numpy as np 24 25 def __guessNperio__ (jpi, nperio) : 25 26 """ 27 Tries to guess the value of nperio 28 """ 29 if nperio == None : 30 if jpi == 182 : nperio = 4 # ORCA2. We choose legacy orca2 31 if jpi == 362 : nperio = 6 # ORCA1. 32 if jpi == 1442 : nperio = 6 # ORCA025. 33 # 34 if nperio == None : 35 sys.exit ('in nemo.lbc : nperio not found, and cannot by guessed' ) 36 else : 37 print ('nperio set as {:d} (deduced from jpi={:d}'.format(nperio, jpi)) 38 39 return nperio 40 41 def lbc (ptab, nperio=None, cd_type='T', psgn=1.0) : 42 """ 43 Set periodicity on input fields 26 44 ptab : Input array 27 rank 2 at least : p atb[...., lat, lon]45 rank 2 at least : ptab[...., lat, lon] 28 46 nperio : Type of periodicity 29 47 1, 4, 6 : Cyclic on i dimension (generaly longitudes) … … 32 50 5, 6 : North fold F-point pivot (ORCA1, ORCA025, ORCA2 with new grid for paleo) 33 51 cd_type : Grid specification : T, U, V or F 34 psgn : For change of sign for vector components 52 psgn : For change of sign for vector components (1 for scalars, -1 for vector components) 35 53 36 54 See NEMO documentation for further details 37 55 """ 38 56 39 jpi = ptab.shape[-1] 57 jpi = ptab.shape[-1] 58 nperio = __guessNperio__ ( jpi, nperio ) 59 psgn = ptab.dtype.type(psgn) 40 60 41 61 # 42 62 #> East-West boundary conditions 43 # ------------------------------ --63 # ------------------------------ 44 64 45 65 if nperio in [1, 4, 6] : … … 50 70 # 51 71 #> North-South boundary conditions 52 # -------------------------------- --53 if nperio in [3, 4] : # North fold T-point pivot 72 # -------------------------------- 73 if nperio in [3, 4] : # North fold T-point pivot 54 74 if cd_type in [ 'T', 'W' ] : # T-, W-point 55 75 ptab[..., -1, 1: ] = psgn * ptab[..., -3, -1:0:-1 ] … … 84 104 if cd_type == 'V' : 85 105 ptab[..., -1, 0: ] = psgn * ptab[..., -3, -1::-1 ] 86 ptab[..., -2, jpi/ 2: ] = psgn * ptab[..., -2, jpi/2-1::-1]106 ptab[..., -2, jpi//2: ] = psgn * ptab[..., -2, jpi//2-1::-1 ] 87 107 88 108 if cd_type == 'F' : … … 94 114 95 115 96 def lbc_mask (ptab, nperio= 6, cd_type='T', psgn=1.0) :97 # Mask fields on duplicate points116 def lbc_mask (ptab, nperio=None, cd_type='T') : 117 # 98 118 """ 119 Mask fields on duplicated points 99 120 ptab : Input array 100 rank 2 at least : p atb[...., lat, lon]121 rank 2 at least : ptab[...., lat, lon] 101 122 nperio : Type of periodicity 102 123 1, 4, 6 : Cyclic on i dimension (generaly longitudes) … … 105 126 5, 6 : North fold F-point pivot (ORCA1, ORCA025, ORCA2 with new grid for paleo) 106 127 cd_type : Grid specification : T, U, V or F 107 psgn : For change of sign for vector components108 128 109 129 See NEMO documentation for further details 110 130 """ 111 112 jpi = ptab.shape[-1]113 #114 zero = 0131 132 jpi = ptab.shape[-1] 133 nperio = __guessNperio__ ( jpi, nperio ) 134 zero = ptab.dtype.type(0) 115 135 116 136 # 117 137 #> East-West boundary conditions 118 # -------------------------------- 119 138 # ------------------------------ 120 139 if nperio in [1, 4, 6] : 121 140 # ... cyclic 122 141 ptab [...,:, 0] = zero 123 142 ptab [...,:, -1] = zero 124 143 144 # 145 #> South (in which nperio cases ?) 146 # -------------------------------- 147 if nperio in [1, 3, 4, 5, 6] : 148 ptab[...,0,:] = zero 149 125 150 # 126 151 #> North-South boundary conditions 127 # -------------------------------- --152 # -------------------------------- 128 153 if nperio in [3, 4] : # North fold T-point pivot 129 154 if cd_type in [ 'T', 'W' ] : # T-, W-point … … 146 171 ptab[..., -2, 0:-1 ] = zero 147 172 ptab[..., -1, 0:-1 ] = zero 148 ptab[..., -1, 0 ] = zero173 ptab[..., -1, 0 ] = zero 149 174 ptab[..., -1, -1 ] = zero 150 175 … … 159 184 if cd_type == 'V' : 160 185 ptab[..., -1, 0: ] = zero 161 ptab[..., -2, jpi/ 2:] = zero186 ptab[..., -2, jpi//2: ] = zero 162 187 163 188 if cd_type == 'F' :
Note: See TracChangeset
for help on using the changeset viewer.