A useful tool for post-processing Earth System Model output 'history files' into the time series format.
Project description
Generate Time Series (GenTS)
The GenTS (Generate Time Series) is an open-source Python Package designed to simplify the post-processing of history files into time series files. This package includes streamlined functions that require minimal input to operate and a documented API for custom workflows.
Installation
GenTS can be installed in a Python environment using pip. This requires either a Conda or Python virtual environment for installing GenTS depedencies (namely numpy, netCDF4, and cftime).
For maximum portability and to avoid environment issues, use the containerized version of GenTS.
PyPI
pip install gents
To install from source, please view the ReadTheDocs Documentation.
Container
Apptainer and Singularity container platforms are typically employed over Docker in HPC environments. Luckily, these platforms (and most others) support running directly from Docker images. The form thus varies across institutions and systems:
For Derecho and Casper (NCAR):
module load apptainer
apptainer run --bind /glade/derecho --cleanenv docker://agentoxygen/gents:latest run_gents --help
For TACC Systems:
module load apptainer
apptainer run docker://agentoxygen/gents:latest run_gents --help
For Perlmutter (NERSC):
shifterimg -v pull docker:agentoxygen/gents:latest
shifter --image=docker:agentoxygen/gents:latest run_gents --help
Running GenTS
GenTS comes with a pre-configured CLI that can be run on most CESM model output and E3SM (atm-only) model output by calling run_gents. The CLI is built on a robust API which can also be configured in a Python script or Jupyter Notebook for custom cases/workflows.
CLI
To view options for running in the command line:
run_gents --help
API Example
Example run.py:
from gents.hfcollection import HFCollection
from gents.timeseries import TSCollection
if __name__ == "__main__":
input_head_dir = "... case directory with model output ..."
output_head_dir = "... scratch directory to output time series to ..."
hf_collection = HFCollection(input_head_dir, num_processes=64)
hf_collection = hf_collection.include(["*/atm/*", "*/ocn/*", "*.h4.*"])
ts_collection = TSCollection(hf_collection.include_years(0, 5), output_head_dir, num_processes=32)
ts_collection = ts_collection.apply_overwrite("*")
ts_collection.execute()
Then execute the script in a Conda or Python virtual environment with gents installed:
python run.py
Or run from the container:
apptainer run docker://agentoxygen/gents:latest run.py
Contributor/Bug Reporting Guidelines
Please report all issues to the GitHub issue tracker. When submitting a bug, run gents.utils.enable_logging(verbose=True) at the top of your script to include all log output. This will aid in reproducing the bug and quickly developing a solution.
For development, it is recommended to use the Docker method for testing. These tests are automatically run in the GitHub workflow, but should be run before committing changes.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gents-0.9.8.tar.gz.
File metadata
- Download URL: gents-0.9.8.tar.gz
- Upload date:
- Size: 154.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
14dba63fe79460ec95c4f6c57042877296674a91f32e9ed3153b2584bc3d7a43
|
|
| MD5 |
88bbb6bfa231c3c2508ec86279b2095d
|
|
| BLAKE2b-256 |
c09714bdc5c9802ef7c5558141ff0394f663f2e3349657e44aedcc0c113cc6ab
|
File details
Details for the file gents-0.9.8-py3-none-any.whl.
File metadata
- Download URL: gents-0.9.8-py3-none-any.whl
- Upload date:
- Size: 50.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
49bf9edaea92b05852c9c5b197d52f0cc431f10a5f27d7be03a931a8c44da4c0
|
|
| MD5 |
689a20439775d93f0d477d27670cb776
|
|
| BLAKE2b-256 |
901e0c10ce06857178753b4ee49ff346924220b29f3c0687da2ebe03a2a56c9e
|