Ignore:
Timestamp:
Jun 3, 2010, 6:03:07 PM (14 years ago)
Author:
hudson
Message:

Removed redundant data_manager class. Unit tests are running, but may fail.

File:
1 edited

Legend:

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

    r7744 r7776  
    414414
    415415        return basename_out
     416
     417
     418
     419
     420##
     421# @brief
     422# @param basename_in
     423# @param extra_name_out
     424# @param quantities
     425# @param timestep
     426# @param reduction
     427# @param cellsize
     428# @param number_of_decimal_places
     429# @param NODATA_value
     430# @param easting_min
     431# @param easting_max
     432# @param northing_min
     433# @param northing_max
     434# @param verbose
     435# @param origin
     436# @param datum
     437# @param format
     438# @return
     439def sww2dem_batch(basename_in, extra_name_out=None,
     440                quantities=None, # defaults to elevation
     441                reduction=None,
     442                cellsize=10,
     443                number_of_decimal_places=None,
     444                NODATA_value=-9999,
     445                easting_min=None,
     446                easting_max=None,
     447                northing_min=None,
     448                northing_max=None,
     449                verbose=False,
     450                origin=None,
     451                datum='WGS84',
     452                format='ers'):
     453    """Wrapper for sww2dem.
     454    See sww2dem to find out what most of the parameters do.
     455
     456    Quantities is a list of quantities.  Each quantity will be
     457    calculated for each sww file.
     458
     459    This returns the basenames of the files returned, which is made up
     460    of the dir and all of the file name, except the extension.
     461
     462    This function returns the names of the files produced.
     463
     464    It will also produce as many output files as there are input sww files.
     465    """
     466
     467    if quantities is None:
     468        quantities = ['elevation']
     469
     470    if type(quantities) is str:
     471            quantities = [quantities]
     472
     473    # How many sww files are there?
     474    dir, base = os.path.split(basename_in)
     475
     476    iterate_over = get_all_swwfiles(dir, base, verbose)
     477
     478    if dir == "":
     479        dir = "." # Unix compatibility
     480
     481    files_out = []
     482    for sww_file in iterate_over:
     483        for quantity in quantities:
     484            if extra_name_out is None:
     485                basename_out = sww_file + '_' + quantity
     486            else:
     487                basename_out = sww_file + '_' + quantity + '_' + extra_name_out
     488
     489            file_out = sww2dem(dir+sep+sww_file, dir+sep+basename_out,
     490                               quantity,
     491                               reduction,
     492                               cellsize,
     493                               number_of_decimal_places,
     494                               NODATA_value,
     495                               easting_min,
     496                               easting_max,
     497                               northing_min,
     498                               northing_max,
     499                               verbose,
     500                               origin,
     501                               datum,
     502                               format)
     503            files_out.append(file_out)
     504    return files_out
     505
Note: See TracChangeset for help on using the changeset viewer.