Hydrologic Projects
ESPAM2 Recharge Tools 1.5 Documentation
espam.precipitation
Conversion routines for ESPAM Tools
Contains conversion tools used for the ESPAM Tools. Currently only contains methods for converting PRISM files into a format usable by the ESPAM Tools.
- class espam.precipitation.PreBuilder(settings)
Builder for PRE file format.
Creates a PRE file for input into MKMOD given processed PRISM precipitation data.
This class is a subclass of Builder
>>> buildPRE = PreBuilder(settings) >>> buildPRE.generate_file("D:\out.pre")
- generate_file(output_file)
Builds a PRE file from the input settings
- Generates a PRE file, using the datasources from the settings.ini file:
See the PRE File Format document for more details on the PRE file format.
generate_file is a common method shared by all *Builder classes. The generate_file method always takes an output_file parameter, which is the location the file will be saved to. The settings used by generate_file are passed to the *Builder object in the constructor.
Parameters: output_file (str) – Location to store output PRE file
- espam.precipitation.batch_import_downloaded_prism(prism_download_dir, espa_grid_feature_class, out_dir)
Process a directory of PRISM files downloaded from the PRISM FTP Site.
Finds all GZipped files in the prism_download_dir and determines their Stress Period using the date embedded in the file name. Uses the prism_gzip_converter method to perform the imports. The file names should not be altered an any way from the names PRISM assigned to the files.
Parameters: - prism_download_dir (string) – Directory containing PRISM gz files downloaded from FTP site.
- espa_grid_feature_class (string) – Path to ESPA Model Grid GIS Dataset
- output_grid (string) – Directory to write the output processed grids to
- espam.precipitation.prism_converter(prism_ascii_file, espa_grid_feature_class, output_grid)>
Converts Raw PRISM File Into A Format Usable For The ESPAM.Tools
- The conversion process is as follows:
- Imports PRISM ASCII File into an Esri Grid
- Defines Projection Onto New Grid as NAD 83/Decimal Degrees
- Projects PRISM Grid to IDTM 83
- Clips PRISM Grid To ESPA Model Boundary
- Resamples Grid Size To 500m x 500m
- Converts Cell Values from 100’s of mm of rainfall to feet of rainfall
This tool requires a Spatial Analyst license to run.
Parameters: - prism_ascii_file (string) – Path to PRISM ASCII file
- espa_grid_feature_class (string) – Path to ESPA Model Grid GIS Dataset
- output_grid (string) – Path to output grid created by this function
- espam.precipitation.prism_gzip_converter(prism_gzip_file, espa_grid_feature_class, output_grid)
Uncompresses a downloaded PRISM file and runs prism_converter
Uses Gunzip to uncompress a PRISM File, then runs the conversion process in the function prism_converter.
Parameters: - prism_gzip_file (string) – Path to GZipped PRISM file
- espa_grid_feature_class (string) – Path to ESPA Model Grid GIS Dataset
- output_grid (string) – Path to output grid created by this function