Changeset 500 in lmdz_wrf for trunk/tools/validation_sim.py


Ignore:
Timestamp:
Jun 15, 2015, 4:48:34 PM (9 years ago)
Author:
lfita
Message:

Working version with the function and the addition of the station description

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/validation_sim.py

    r498 r500  
    992992    fname = 'adding_station_desc'
    993993
    994     newvar = objfile.createVariable( 'station', 'c', ('StrLength'))
     994    newvar = onc.createVariable( 'station', 'c', ('StrLength'))
    995995    newvar[0:len(stdesc[0])] = stdesc[0]
    996996
     
    10051005        lonname = 'lon'
    10061006
    1007     newvar = objfile.createVariable( lonname, 'f4', ('nst'))
     1007    newvar = onc.createVariable( lonname, 'f4', ('nst'))
    10081008    basicvardef(newvar, lonname, 'longitude', 'degrees_West' )
    10091009    newvar[:] = stdesc[1]
     
    10171017        latname = 'lat'
    10181018
    1019     newvar = objfile.createVariable( latname, 'f4', ('nst'))
     1019    newvar = onc.createVariable( latname, 'f4', ('nst'))
    10201020    basicvardef(newvar, lonname, 'latitude', 'degrees_North' )
    10211021    newvar[:] = stdesc[2]
     
    10291029        heightname = 'height'
    10301030
    1031     newvar = objfile.createVariable( heightname, 'f4', ('nst'))
     1031    newvar = onc.createVariable( heightname, 'f4', ('nst'))
    10321032    basicvardef(newvar, heightname, 'height above sea level', 'm' )
    10331033    newvar[:] = stdesc[3]
     
    12931293            print '    [DIM]@[dimnsim]@[dimnobs]'
    12941294            quit(-1)
    1295         dims[dsecs[0]] = [dsecs[1], dsecs[2]]
    1296         simdims[dsecs[0]] = dsecs[1]
    1297         obsdims[dsecs[0]] = dsecs[2]
    1298 
    1299         print '  ',dsecs[0],':',dsecs[1],',',dsecs[2]
     1295        if dsecs[1] != 'None':
     1296            dims[dsecs[0]] = [dsecs[1], dsecs[2]]
     1297            simdims[dsecs[0]] = dsecs[1]
     1298            obsdims[dsecs[0]] = dsecs[2]
     1299
     1300            print '  ',dsecs[0],':',dsecs[1],',',dsecs[2]
    13001301       
    13011302if opts.vardims is None:
     
    13161317            print '    [DIM]@[vardimnsim]@[vardimnobs]'
    13171318            quit(-1)
    1318         vardims[dsecs[0]] = [dsecs[1], dsecs[2]]
    1319         print '  ',dsecs[0],':',dsecs[1],',',dsecs[2]
     1319        if dsecs[1] != 'None':
     1320            vardims[dsecs[0]] = [dsecs[1], dsecs[2]]
     1321            print '  ',dsecs[0],':',dsecs[1],',',dsecs[2]
    13201322
    13211323if opts.obskind is None:
     
    15511553
    15521554print main + ': found',Nexactt,'Temporal same values in simulation and observations'
    1553 print '  ',exacttvalues
    1554 
    15551555# Sim Coincident times
    15561556##
     
    15711571print main + ': found',Ncoindt,'Simulation time-interval (within consecutive ' +     \
    15721572  'observed times) coincident times between simulation and observations'
    1573 print '  ',coindtvalues
    15741573
    15751574if Ncoindt == 0:
     
    18401839        onewnc.sync()
    18411840
    1842 newvar = onewnc.createVariable('simtrj','i',('time','simtrj'))
    1843 basicvardef(newvar, 'simtrj', 'coordinates [X,Y,Z,T] of the coincident trajectory ' +\
    1844   'in sim', obstunits)
    1845 newvar[:] = trjsim.transpose()
     1841if trjsim is not None:
     1842    newvar = onewnc.createVariable('simtrj','i',('time','simtrj'))
     1843    basicvardef(newvar,'simtrj','coordinates [X,Y,Z,T] of the coincident ' +         \
     1844      'trajectory in sim', obstunits)
     1845    newvar[:] = trjsim.transpose()
    18461846
    18471847# Adding three variables with the station location, longitude, latitude and height
    18481848if obskind == 'single-station':
    1849     adding_station_desc(objfile,stationdesc)
     1849    adding_station_desc(onewnc,stationdesc)
    18501850
    18511851# Global attributes
Note: See TracChangeset for help on using the changeset viewer.