Skip to content
Snippets Groups Projects
user avatar
Clayton, Brandon Scott authored
Utils

See merge request ghsc/nshmp/nshmp-netcdf!60
e2bb91aa
History

nshmp-lib

NetCDF Database

Prerequisites

Poetry Install

See Poetry installation instructions for more.

Install Dependencies

poetry install

Download and Convert NSHM Databases to NetCDF

The default location for the NSHM database are located in the NETCDF_DATA directory in the libs project directory.

To specify the output directory use the --output flag.

Download Specific NSHM Database

To install files to a specific NSHM, use one of the following flags:

  • --2018B
  • --2018A
  • --2018
  • --2014A
  • --2014
  • --2008

The following example would download the database for the 2018A NSHM:

poetry run netcdf --2018A

To download only with no NetCDF conversion use:

poetry run netcdf --2018A --download-only

Download All NSHM Databases

The following will download all NSHM databases defined in the catalog.yml file:

poetry run netcdf --all

The following will download all NSHM database in the /DATA directory:

poetry run netcdf --all --output=/DATA

You can also set an environment variable to set the output path:

export NSHMP_NETCDF_DATABASE_PATH="/path/to/database";
poetry run netcdf --all

Help

To show program information and possible arguments run:

poetry run help

Cleaning the NSHM Files

The following command will remove all database files:

poetry run netcdf --clean

Database Development

The ScienceBase catalog item ids and files that are required for each NSHM are defined in the catalog.yml file.

Code Format and Linting

The NetCDF Python database project uses the Black code formater, isort dependency sorter, and Flake8 for linting.

Format

Checking the Format

To check the format of the code against Black and isort run:

poetry run format_check
Formatting the Code

To automatically format the code using Black and isort run:

poetry run format

Linting

To lint the Python code run:

poetry run lint