Changeset 340 in lmdz_wrf for trunk


Ignore:
Timestamp:
Mar 1, 2015, 11:12:17 PM (10 years ago)
Author:
lfita
Message:

Adding check when simulated variable has dimensions not given as reference [X,Y,Z,T]

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/validation_sim.py

    r339 r340  
    33## e.g. sfcEneAvigon # validation_sim.py -d X@west_east@None,Y@south_north@None,T@Time@time -D X@XLONG@longitude,Y@XLAT@latitude,T@time@time -k single-station -l 4.878773,43.915876,12. -o /home/lluis/DATA/obs/HyMeX/IOP15/sfcEnergyBalance_Avignon/OBSnetcdf.nc -s /home/lluis/PY/wrfout_d01_2012-10-18_00:00:00.tests -v HFX@H,LH@LE,GRDFLX@G
    44## e.g. AIREP # validation_sim.py -d X@west_east@lon2D,Y@south_north@lat2D,Z@bottom_top@z2D,T@Time@time -D X@XLONG@longitude,Y@XLAT@latitude,Z@WRFz@alti,T@time@time -k trajectory -o /home/lluis/DATA/obs/HyMeX/IOP15/AIREP/2012/10/AIREP_121018.nc -s /home/lluis/PY/wrfout_d01_2012-10-18_00:00:00.tests -v WRFt@t,WRFtd@td,WRFws@u,WRFwd@dd
    5 ## e.g. ATRCore # validation_sim.py -d X@west_east@lon2D,Y@south_north@lat2D,Z@bottom_top@z2D,T@Time@CFtime -D X@XLONG@longitude,Y@XLAT@latitude,Z@WRFz@altitude,T@time@time -k trajectory -o /home/lluis/DATA/obs/HyMeX/IOP15/ATRCore/V3/ATR_1Hz-HYMEXBDD-SOP1-v3_20121018_as120051.nc -s /home/lluis/PY/wrfout_d01_2012-10-18_00:00:00.tests -v WRFT@air_temperature@subc@273.15
    6 ## e.g. BAMED # validation_sim.py -d X@west_east@lon2D,Y@south_north@lat2D,Z@bottom_top@z2D,T@Time@CFtime -D X@XLONG@longitude,Y@XLAT@latitude,Z@WRFz@altitude,T@time@time -k trajectory -o /home/lluis/DATA/obs/HyMeX/IOP15/BAMED/BAMED_SOP1_B12_TOT5.nc -s /home/lluis/PY/wrfout_d01_2012-10-18_00:00:00.tests -v WRFT@tas_north
     5## e.g. ATRCore # validation_sim.py -d X@west_east@lon2D,Y@south_north@lat2D,Z@bottom_top@z2D,T@Time@CFtime -D X@XLONG@longitude,Y@XLAT@latitude,Z@WRFz@altitude,T@time@time -k trajectory -o /home/lluis/DATA/obs/HyMeX/IOP15/ATRCore/V3/ATR_1Hz-HYMEXBDD-SOP1-v3_20121018_as120051.nc -s /home/lluis/PY/wrfout_d01_2012-10-18_00:00:00.tests -v WRFt@air_temperature@subc@273.15,WRFp@air_pressure,WRFrh@relative_humidity,WRFrh@relative_humidity_Rosemount,WRFwd@wind_from_direction,WRFws@wind_speed
     6## e.g. BAMED # validation_sim.py -d X@west_east@lon2D,Y@south_north@lat2D,Z@bottom_top@z2D,T@Time@CFtime -D X@XLONG@longitude,Y@XLAT@latitude,Z@WRFz@altitude,T@time@time -k trajectory -o /home/lluis/DATA/obs/HyMeX/IOP15/BAMED/BAMED_SOP1_B12_TOT5.nc -s /home/lluis/PY/wrfout_d01_2012-10-18_00:00:00.tests -v WRFt@tas_north,WRFp@pressure,WRFrh@hus,U@uas,V@vas
    77
    88import numpy as np
     
    796796    quit(-1)
    797797else:
     798    simdims = {}
     799    obsdims = {}
    798800    print main +': couple of dimensions _______'
    799801    dims = {}
     
    807809            quit(-1)
    808810        dims[dsecs[0]] = [dsecs[1], dsecs[2]]
     811        simdims[dsecs[0]] = dsecs[1]
     812        obsdims[dsecs[0]] = dsecs[2]
     813
    809814        print '  ',dsecs[0],':',dsecs[1],',',dsecs[2]
    810815       
     
    11041109for ivar in range(Nvars):
    11051110    simobsvalues = []
    1106 # Values spatially around the point (+/- [Ngrid] points)
    1107     simobsSvalues = []
    11081111
    11091112    varsimobs = valvars[ivar][0] + '_' + valvars[ivar][1]
     1113    print '  ' + varsimobs + '... .. .'
    11101114
    11111115    if not oobs.variables.has_key(valvars[ivar][1]):
     
    11251129    else:
    11261130        ovsim = osim.variables[valvars[ivar][0]]
     1131
     1132    for idn in ovsim.dimensions:
     1133        if not searchInlist(simdims.values(),idn):
     1134            print errormsg
     1135            print '  ' + main + ": dimension '" + idn + "' of variable '" +          \
     1136              valvars[ivar][0] + "' not provided as reference coordinate [X,Y,Z,T] !!"
     1137            quit(-1)
    11271138
    11281139    ovobs = oobs.variables[valvars[ivar][1]]
     
    11901201                    sliceS.append(slice(0,maxy-miny))
    11911202                    sliceS.append(slice(0,maxx-minx))
    1192                    
     1203
    11931204                    simobsSvalues[tuple(sliceS)] = slicevar
    11941205                    if ivar == 0:
Note: See TracChangeset for help on using the changeset viewer.