Changeset 1689 in lmdz_wrf
- Timestamp:
- Dec 5, 2017, 1:20:45 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/get_stations.py
r1688 r1689 280 280 281 281 # surface stations 282 osfcstatf = open(sfcstatfile, 'r') 283 284 sfclonvals = [] 285 sfclatvals = [] 286 sfclabvals = [] 287 sfchgtvals = [] 288 289 for line in osfcstatf: 290 if line[0:1] != comchar and len(line) > 1: 291 vals = line.replace('\n','').split(sepchar) 292 if not gen.searchInlist(missvalS, vals[sfcloncol]) and \ 293 not gen.searchInlist(missvalS, vals[sfclatcol]): 294 stlon = np.float(vals[sfcloncol]) 295 stlat = np.float(vals[sfclatcol]) 296 if stlon >= nlon and stlon <= xlon and stlat >= nlat and stlat <= xlat: 297 sfclonvals.append(stlon) 298 sfclatvals.append(stlat) 299 sfclabvals.append(vals[sfclabcol]) 300 if gen.searchInlist(missvalS, vals[sfchgtcol]): 301 if vals[sfchgtcol] == '0': 282 if stcstatfile != 'None': 283 osfcstatf = open(sfcstatfile, 'r') 284 285 sfclonvals = [] 286 sfclatvals = [] 287 sfclabvals = [] 288 sfchgtvals = [] 289 290 for line in osfcstatf: 291 if line[0:1] != comchar and len(line) > 1: 292 vals = line.replace('\n','').split(sepchar) 293 if not gen.searchInlist(missvalS, vals[sfcloncol]) and \ 294 not gen.searchInlist(missvalS, vals[sfclatcol]): 295 stlon = np.float(vals[sfcloncol]) 296 stlat = np.float(vals[sfclatcol]) 297 if stlon >= nlon and stlon <= xlon and stlat >= nlat and stlat <= xlat: 298 sfclonvals.append(stlon) 299 sfclatvals.append(stlat) 300 sfclabvals.append(vals[sfclabcol]) 301 if gen.searchInlist(missvalS, vals[sfchgtcol]): 302 if vals[sfchgtcol] == '0': 303 sfchgtvals.append(np.float(vals[sfchgtcol])) 304 else: 305 sfchgtvals.append(gen.fillValueF) 306 else: 302 307 sfchgtvals.append(np.float(vals[sfchgtcol])) 303 else: 304 sfchgtvals.append(gen.fillValueF) 305 else: 306 sfchgtvals.append(np.float(vals[sfchgtcol])) 307 308 osfcstatf.close() 309 310 Nsfcstats = len(sfclonvals) 311 print ' Number of surface stations: ', Nsfcstats 308 309 osfcstatf.close() 310 Nsfcstats = len(sfclonvals) 311 print ' Number of surface stations: ', Nsfcstats 312 else: 313 Nsfcstats = 0 314 print ' No surface stations !!' 312 315 313 316 # sounding stations 314 osndstatf = open(sndstatfile, 'r') 315 316 sndlonvals = [] 317 sndlatvals = [] 318 sndlabvals = [] 319 sndhgtvals = [] 320 321 for line in osndstatf: 322 if line[0:1] != comchar and len(line) > 1: 323 vals = line.replace('\n','').split(sepchar) 324 if vals[sndloncol] != missvalS and vals[sndlatcol] != missvalS: 325 stlon = np.float(vals[sndloncol]) 326 stlat = np.float(vals[sndlatcol]) 327 if stlon >= nlon and stlon <= xlon and stlat >= nlat and stlat <= xlat: 328 sndlonvals.append(stlon) 329 sndlatvals.append(stlat) 330 sndlabvals.append(vals[sndlabcol]) 331 sndhgtvals.append(np.float(vals[sndhgtcol])) 332 333 osndstatf.close() 334 Nsndstats = len(sndlonvals) 335 print ' Number of sounding stations: ', Nsndstats 317 if stcstatfile != 'None': 318 osndstatf = open(sndstatfile, 'r') 319 320 sndlonvals = [] 321 sndlatvals = [] 322 sndlabvals = [] 323 sndhgtvals = [] 324 325 for line in osndstatf: 326 if line[0:1] != comchar and len(line) > 1: 327 vals = line.replace('\n','').split(sepchar) 328 if vals[sndloncol] != missvalS and vals[sndlatcol] != missvalS: 329 stlon = np.float(vals[sndloncol]) 330 stlat = np.float(vals[sndlatcol]) 331 if stlon >= nlon and stlon <= xlon and stlat >= nlat and stlat <= xlat: 332 sndlonvals.append(stlon) 333 sndlatvals.append(stlat) 334 sndlabvals.append(vals[sndlabcol]) 335 sndhgtvals.append(np.float(vals[sndhgtcol])) 336 337 osndstatf.close() 338 Nsndstats = len(sndlonvals) 339 print ' Number of sounding stations: ', Nsndstats 340 else: 341 Nsndstats = 0 342 print ' No sounding stations !!' 343 336 344 337 345 if not os.path.isfile(simfilen):
Note: See TracChangeset
for help on using the changeset viewer.