Changeset 1113


Ignore:
Timestamp:
Mar 22, 2005, 11:00:33 AM (20 years ago)
Author:
prow
Message:

making ferret2sww read the elevations

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/pyvolution/data_manager.py

    r1103 r1113  
    12301230    file_u = NetCDFFile(basename_in + '_ua.nc', 'r') #Velocity (x) (cm/s)
    12311231    file_v = NetCDFFile(basename_in + '_va.nc', 'r') #Velocity (y) (cm/s)   
     1232    file_e = NetCDFFile(basename_in + '_va.nc', 'r') #Elevation (z) (m)   
    12321233
    12331234    if basename_out is None:
     
    12791280    uspeed = file_u.variables['UA'][jmin:jmax, kmin:kmax, lmin:lmax] #Lon
    12801281    vspeed = file_v.variables['VA'][jmin:jmax, kmin:kmax, lmin:lmax] #Lat
    1281 
     1282    elevations = file_e.variables['ELEVATION'][kmin:kmax, lmin:lmax]
    12821283    #Get missing values
    12831284    nan_ha = file_h.variables['HA'].missing_value[0]
    12841285    nan_ua = file_u.variables['UA'].missing_value[0]
    12851286    nan_va = file_v.variables['VA'].missing_value[0]
     1287    nan_e  = file_e.variables['ELEVATION'].missing_value[0]
    12861288
    12871289   
     
    13171319
    13181320
     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
    13191329
    13201330    #######
     
    13551365        print '  %s in [%f, %f]' %(name, min(q), max(q))               
    13561366
     1367        q = elevations.flat
     1368        name = 'Elevations (e) [m]'               
     1369        print '  %s in [%f, %f]' %(name, min(q), max(q))               
     1370
    13571371
    13581372    #print number_of_latitudes, number_of_longitudes
     
    13641378    file_u.close()
    13651379    file_v.close()   
     1380    file_e.close()   
    13661381
    13671382
     
    13711386    #Create new file
    13721387    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'\
    13741389                          %(basename_in + '_ha.nc',
    13751390                            basename_in + '_ua.nc',
    1376                             basename_in + '_va.nc')
     1391                            basename_in + '_va.nc'
     1392                            basename_in + '_e.nc')
    13771393
    13781394
     
    14791495
    14801496
    1481     if elevation is not None:
    1482         z = elevation
     1497    if elevations is not None:
     1498        z = elevations
    14831499    else:
    14841500        pass
Note: See TracChangeset for help on using the changeset viewer.