Ignore:
Timestamp:
Jun 7, 2010, 1:04:42 PM (14 years ago)
Author:
hudson
Message:

urs2sww has an extra urs_ungridded2sww function.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga/file_conversion/file_conversion.py

    r7776 r7800  
    316316    sww.store_connectivity()
    317317    sww.store_timestep()
    318 
    319 
    320 ##
    321 # @brief Convert URS file to SWW file.
    322 # @param basename_in Stem of the input filename.
    323 # @param basename_out Stem of the output filename.
    324 # @param verbose True if this function is to be verbose.
    325 # @param remove_nc_files
    326 # @param minlat Sets extent of area to be used.  If not supplied, full extent.
    327 # @param maxlat Sets extent of area to be used.  If not supplied, full extent.
    328 # @param minlon Sets extent of area to be used.  If not supplied, full extent.
    329 # @param maxlon Sets extent of area to be used.  If not supplied, full extent.
    330 # @param mint
    331 # @param maxt
    332 # @param mean_stage
    333 # @param origin A 3-tuple with geo referenced UTM coordinates
    334 # @param zscale
    335 # @param fail_on_NaN
    336 # @param NaN_filler
    337 # @param elevation
    338 # @note Also convert latitude and longitude to UTM. All coordinates are
    339 #       assumed to be given in the GDA94 datum.
    340 def urs2sww(basename_in='o', basename_out=None, verbose=False,
    341             remove_nc_files=True,
    342             minlat=None, maxlat=None,
    343             minlon=None, maxlon=None,
    344             mint=None, maxt=None,
    345             mean_stage=0,
    346             origin=None,
    347             zscale=1,
    348             fail_on_NaN=True,
    349             NaN_filler=0):
    350     """Convert a URS file to an SWW file.
    351     Convert URS C binary format for wave propagation to
    352     sww format native to abstract_2d_finite_volumes.
    353 
    354     Specify only basename_in and read files of the form
    355     basefilename-z-mux2, basefilename-e-mux2 and
    356     basefilename-n-mux2 containing relative height,
    357     x-velocity and y-velocity, respectively.
    358 
    359     Also convert latitude and longitude to UTM. All coordinates are
    360     assumed to be given in the GDA94 datum. The latitude and longitude
    361     information is for  a grid.
    362 
    363     min's and max's: If omitted - full extend is used.
    364     To include a value min may equal it, while max must exceed it.
    365     Lat and lon are assumed to be in decimal degrees.
    366     NOTE: minlon is the most east boundary.
    367 
    368     origin is a 3-tuple with geo referenced
    369     UTM coordinates (zone, easting, northing)
    370     It will be the origin of the sww file. This shouldn't be used,
    371     since all of anuga should be able to handle an arbitary origin.
    372 
    373     URS C binary format has data orgainised as TIME, LONGITUDE, LATITUDE
    374     which means that latitude is the fastest
    375     varying dimension (row major order, so to speak)
    376 
    377     In URS C binary the latitudes and longitudes are in assending order.
    378     """
    379 
    380     if basename_out == None:
    381         basename_out = basename_in
    382 
    383     files_out = urs2nc(basename_in, basename_out)
    384 
    385     ferret2sww(basename_out,
    386                minlat=minlat,
    387                maxlat=maxlat,
    388                minlon=minlon,
    389                maxlon=maxlon,
    390                mint=mint,
    391                maxt=maxt,
    392                mean_stage=mean_stage,
    393                origin=origin,
    394                zscale=zscale,
    395                fail_on_NaN=fail_on_NaN,
    396                NaN_filler=NaN_filler,
    397                inverted_bathymetry=True,
    398                verbose=verbose)
    399    
    400     if remove_nc_files:
    401         for file_out in files_out:
    402             os.remove(file_out)
    403318
    404319
Note: See TracChangeset for help on using the changeset viewer.