Changeset 354 in lmdz_wrf for trunk


Ignore:
Timestamp:
Mar 10, 2015, 6:25:39 PM (10 years ago)
Author:
lfita
Message:

Adding last changes (I forgot which were...)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/create_stations-list_simulations.py

    r262 r354  
    44#  for LMDZ: pointlocations.txt
    55## e.g. # create_stations-list_simulations.py -a -2,1.3,37.5,40.0:3,6.7,41.7,45.4 -m WRF -n 0.30 -s AEMET_sfcst.dat,sfcstations.dat,MeteoFrance_sfcst.dat -z lidarstations.dat,dropsondes.dat,soundingsstations.dat
     6## e.g. # create_stations-list_simulations.py -a -2,1.3,37.5,40.0:3,6.7,41.7,45.4 -m LMDZ -n 0.30 -s AEMET_sfcst.dat,sfcstations.dat,MeteoFrance_sfcst.dat -z lidarstations.dat,dropsondes.dat,soundingsstations.dat
    67import numpy as np
    78import os
     
    9394    obsstn = []
    9495    posst = []
     96
     97    print fname + 'model:',model
    9598
    9699    for filen in fobs:
     
    114117                                str(iobs).zfill(4) + ' ' + '{0:7.5g}'.format(stlat) +\
    115118                                '  ' + '{0:6.4g}'.format(stlon) + '\n')
    116                           else:
    117                               oout.write('{0:24s}'.format(stname) + '  h' +          \
    118                                 str(iobs).zfill(3) + '   '+ '{0:6.4g}'.format(stlon) +  \
    119                                 '  ' + '{0:7.5g}'.format(stlat) + '\n')
     119                          elif model == 'LMDZ':
     120                              oout.write('{0:5g}, '.format(iobs) +                   \
     121                                '{0:7.4g}, '.format(stlon) +                         \
     122                                '{0:7.4g}, '.format(stlat) + "'" + stname + "'\n")
    120123
    121124                          obsstn.append(vals[0])
     
    195198            quit(-1)
    196199
     200if opts.mindist is None:
     201    print warnmsg
     202    print '  ' + main + ': no minimal distance is provided!!'
     203    print '    asuming mindist=0.'
     204    mindist = 0.
     205else:
     206    mindist = np.float(opts.mindist)
     207
    197208if opts.model is None:
    198209    print errormsg
     
    212223            oscff.close()
    213224
    214     elif opts.model == 'LMDZ':
    215         sfilename = 'pointlocations.txt'
    216         hfilename = 'pointlocations.txt'
    217 
    218 if opts.mindist is None:
    219     print warnmsg
    220     print '  ' + main + ': no minimal distance is provided!!'
    221     print '    asuming mindist=0.'
    222     mindist = 0.
    223 else:
    224     mindist = np.float(opts.mindist)
    225 
    226225# Height observations
    227226##
    228 objout = open(hfilename, 'a')
    229 #print main + ": creation of height observational file '" + hfilename + "' ..."
    230 hstations = writting_stations(objout, hobs, areas, opts.model, mindist)
    231 print main + "' succesfull written of height location observations '" + hfilename +  \
    232   "' !!"
    233 objout.close()
     227        objout = open(hfilename, 'a')
     228#        print main + ": creation of height observational file '" + hfilename + "' ..."
     229        hstations = writting_stations(objout, hobs, areas, opts.model, mindist)
     230        print main + "' succesfull written of height location observations '" +      \
     231          hfilename + "' !!"
     232        objout.close()
    234233
    235234# surface observations
    236235##
    237 objout = open(sfilename, 'a')
    238 #print main + ": creation of surface observational file '" + sfilename + "' ..."
    239 sstations = writting_stations(objout, sobs, areas, opts.model, mindist)
    240 print main + "' succesfull written of height location observations '" + sfilename +  \
    241   "' !!"
    242 objout.close()
    243 quit()
     236        objout = open(sfilename, 'a')
     237        sstations = writting_stations(objout, sobs, areas, opts.model, mindist)
     238        print main + "' succesfull written of surface location observations '" +     \
     239          sfilename + "' !!"
     240        objout.close()
     241
     242    elif opts.model == 'LMDZ':
     243# Only one file as output
     244        shfilename = 'pointlocations.txt'
     245        shobs = hobs + sobs
     246
     247        objout = open(shfilename, 'w')
     248        sstations = writting_stations(objout, shobs, areas, opts.model, mindist)
     249        print main + "' succesfull written of location observations '" +             \
     250          shfilename + "' !!"
     251        objout.close()
     252    else:
     253        print errormsg
     254        print '  ' + main + ": model '" + opts.model + "' not ready !!"
     255        quit(-1)
Note: See TracChangeset for help on using the changeset viewer.