pymake.utils.usgsprograms module¶
Utility functions to extract information for a target from the USGS application database. Available functionality includes:
Get a list of available targets
Get data for a specific target
Get a dictionary with the data for all targets
Get the current version of a target
Get a list indicating if single and double precsion versions of the target application should be built
Functions to load, update, and export a USGS-style “code.json” json file containing information in the USGS application database
A table listing the available pymake targets is included below:
- class usgs_program_data[source]¶
Bases:
object
USGS program database class.
- static export_json(fpth='code.json', prog_data=None, current=False, update=True, write_markdown=False, verbose=False)[source]¶
Export USGS program data as a json file.
- Parameters
fpth (str) – Path for the json file to be created. Default is “code.json”
prog_data (dict) – User-specified program database. If prog_data is None, it will be created from the USGS program database
current (bool) – If False, all USGS program targets are listed. If True, only USGS program targets that are defined as current are listed. Default is False.
update (bool) – If True, existing targets in the user-specified program database with values in the USGS program database. If False, existing targets in the user-specified program database will not be updated. Default is True.
write_markdown (bool) – If True, write markdown file that includes the target name, version, and the last-modified date of the download asset (url). Default is False.
verbose (bool) – boolean for verbose output to terminal
- static get_keys(current=False)[source]¶
Get target keys from the USGS program database.
- Parameters
current (bool) – If False, all USGS program targets are listed. If True, only USGS program targets that are defined as current are listed. Default is False.
- Returns
keys – list of USGS program targets
- Return type
list
- static get_precision(key)[source]¶
Get the dictionary for a specified target.
- Parameters
key (str) – Target USGS program
- Returns
precision – List
- Return type
list
- static get_program_dict()[source]¶
Get the complete USGS program database.
- Returns
program_dict – Dictionary with USGS program attributes for all targets
- Return type
dict
- static get_target(key)[source]¶
Get the dictionary for a specified target.
- Parameters
key (str) – Target USGS program that may have a path and an extension
- Returns
program_dict – Dictionary with USGS program attributes for the specified key
- Return type
dict
- static get_version(key)[source]¶
Get the current version of the specified target.
- Parameters
key (str) – Target USGS program
- Returns
version – current version of the specified target
- Return type
str
- static list_json(fpth='code.json')[source]¶
List an existing code json file.
- Parameters
fpth (str) – Path for the json file to be listed. Default is “code.json”
- static list_targets(current=False)[source]¶
Print a list of the available USGS program targets.
- Parameters
current (bool) – If False, all USGS program targets are listed. If True, only USGS program targets that are defined as current are listed. Default is False.
- static load_json(fpth='code.json')[source]¶
Load an existing code json file. Basic error checking is done to make sure the file contains the correct keys.
- Parameters
fpth (str) – Path for the json file to be created. Default is “code.json”
- Returns
json_dict – Valid USGS program database
- Return type
dict