- Timestamp:
- Mar 10, 2015, 6:25:39 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/create_stations-list_simulations.py
r262 r354 4 4 # for LMDZ: pointlocations.txt 5 5 ## 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 6 7 import numpy as np 7 8 import os … … 93 94 obsstn = [] 94 95 posst = [] 96 97 print fname + 'model:',model 95 98 96 99 for filen in fobs: … … 114 117 str(iobs).zfill(4) + ' ' + '{0:7.5g}'.format(stlat) +\ 115 118 ' ' + '{0:6.4g}'.format(stlon) + '\n') 116 el se: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") 120 123 121 124 obsstn.append(vals[0]) … … 195 198 quit(-1) 196 199 200 if opts.mindist is None: 201 print warnmsg 202 print ' ' + main + ': no minimal distance is provided!!' 203 print ' asuming mindist=0.' 204 mindist = 0. 205 else: 206 mindist = np.float(opts.mindist) 207 197 208 if opts.model is None: 198 209 print errormsg … … 212 223 oscff.close() 213 224 214 elif opts.model == 'LMDZ':215 sfilename = 'pointlocations.txt'216 hfilename = 'pointlocations.txt'217 218 if opts.mindist is None:219 print warnmsg220 print ' ' + main + ': no minimal distance is provided!!'221 print ' asuming mindist=0.'222 mindist = 0.223 else:224 mindist = np.float(opts.mindist)225 226 225 # Height observations 227 226 ## 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() 234 233 235 234 # surface observations 236 235 ## 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.