Changeset 1113
- Timestamp:
- Mar 22, 2005, 11:00:33 AM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pyvolution/data_manager.py
r1103 r1113 1230 1230 file_u = NetCDFFile(basename_in + '_ua.nc', 'r') #Velocity (x) (cm/s) 1231 1231 file_v = NetCDFFile(basename_in + '_va.nc', 'r') #Velocity (y) (cm/s) 1232 file_e = NetCDFFile(basename_in + '_va.nc', 'r') #Elevation (z) (m) 1232 1233 1233 1234 if basename_out is None: … … 1279 1280 uspeed = file_u.variables['UA'][jmin:jmax, kmin:kmax, lmin:lmax] #Lon 1280 1281 vspeed = file_v.variables['VA'][jmin:jmax, kmin:kmax, lmin:lmax] #Lat 1281 1282 elevations = file_e.variables['ELEVATION'][kmin:kmax, lmin:lmax] 1282 1283 #Get missing values 1283 1284 nan_ha = file_h.variables['HA'].missing_value[0] 1284 1285 nan_ua = file_u.variables['UA'].missing_value[0] 1285 1286 nan_va = file_v.variables['VA'].missing_value[0] 1287 nan_e = file_e.variables['ELEVATION'].missing_value[0] 1286 1288 1287 1289 … … 1317 1319 1318 1320 1321 missing = (elevations == nan_e) 1322 if sometrue (missing): 1323 if fail_on_NaN: 1324 msg = 'NetCDFFile %s contains missing values'\ 1325 %(basename_in+'_e.nc') 1326 raise msg 1327 else: 1328 elevations = elevations*(missing==0) + missing*NaN_filler 1319 1329 1320 1330 ####### … … 1355 1365 print ' %s in [%f, %f]' %(name, min(q), max(q)) 1356 1366 1367 q = elevations.flat 1368 name = 'Elevations (e) [m]' 1369 print ' %s in [%f, %f]' %(name, min(q), max(q)) 1370 1357 1371 1358 1372 #print number_of_latitudes, number_of_longitudes … … 1364 1378 file_u.close() 1365 1379 file_v.close() 1380 file_e.close() 1366 1381 1367 1382 … … 1371 1386 #Create new file 1372 1387 outfile.institution = 'Geoscience Australia' 1373 outfile.description = 'Converted from Ferret files: %s, %s, %s '\1388 outfile.description = 'Converted from Ferret files: %s, %s, %s, %s'\ 1374 1389 %(basename_in + '_ha.nc', 1375 1390 basename_in + '_ua.nc', 1376 basename_in + '_va.nc') 1391 basename_in + '_va.nc' 1392 basename_in + '_e.nc') 1377 1393 1378 1394 … … 1479 1495 1480 1496 1481 if elevation is not None:1482 z = elevation 1497 if elevations is not None: 1498 z = elevations 1483 1499 else: 1484 1500 pass
Note: See TracChangeset
for help on using the changeset viewer.