Skip to main content

Tsdat Tools

This repository contains helpful scripts and notes for several tsdat-related tools.

Some tools are available as jupyter notebooks, and others are available as a command-line utility.

To get access to the command-line utilities, just run:

pip install tsdat-tools

To use all the other tools, we recommend cloning this repository.

Data to Yaml

The goal of this tool is to reduce the tediousness of writing tsdat configuration files for data that you can already read and convert into an xr.Dataset object in tsdat. It generates two output files: dataset.yaml and retriever.yaml, which are used by tsdat to define metadata and how the input variables should be mapped to output variables.

If your file is in one of the following formats, this tool can already do this for you. Formats supported out-of-box:

  • netCDF: Files ending with .nc or .cdf will use the tsdat.NetCDFReader class
  • csv: Files ending with .csv will use the tsdat.CSVReader class
  • parquet: Files ending with .parquet or .pq or .pqt will use the tsdat.ParquetReader class
  • zarr: Files/folders ending with .zarr will use the tsdat.ZarrReader class

Usage

Then you can run the tool with:

tsdat-tools data2yaml path/to/data/file --input-config path/to/current/dataset.yaml

Full usage instructions can be obtained using the --help flag:

>>> tsdat-tools data2yaml --help

Usage: tsdat-tools data2yaml [OPTIONS] DATAPATH

╭─ Arguments ─────────────────────────────────────────────────────────────────────────────────────────────╮
│ *    datapath   PATH  Path to the input data file that should be used to generate tsdat configurations. │
│                       [default: None]                                                                   │
│                       [required]                                                                        │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ───────────────────────────────────────────────────────────────────────────────────────────────╮
│ --outdir                               DIRECTORY                      The path to the directory where   │
│                                                                       the 'dataset.yaml' and            │
│                                                                       'retriever.yaml' files should be  │
│                                                                       written.                          │
│                                                                       [default: .]                      │
│ --input-config                         PATH                           Path to a dataset.yaml file to be │
│                                                                       used in addition to               │
│                                                                       configurations derived from the   │
│                                                                       input data file. Configurations   │
│                                                                       defined here take priority over   │
│                                                                       auto-detected properties in the   │
│                                                                       input file.                       │
│                                                                       [default: None]                   │
│ --help                                                                Show this message and exit.       │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯

This tool is designed to be run in the following workflow:

  1. Generate new ingest/pipeline from cookiecutter template (e.g., make cookies command)
  2. Put an example data file for your pipeline in the test/data/input folder
  3. Clean up the autogenerated dataset.yaml file.
    • Add metadata and remove any unused variables
    • Don't add additional variables yet; just make sure that the info in the current file is accurate
  4. Commit your changes in git or back up your changes so you can compare before & after the script runs.
  5. Run this script, passing it the path to your input data file and using the --input-config option to tell it where your cleaned dataset.yaml file is. By default this will generate a new dataset.yaml file in the current working directory (location of pwd on the command line), but you can also use the --outdir option to specify the path where it should write to.
  6. Review the changes the script made to each file. Note that it is not capable of standardizing units or other metadata, so you will still need to clean those up manually.
  7. Continue with the rest of the ingest/pipeline development steps

Excel to Yaml

Please consult the documentation in the excel2yaml/README.md file for more information about this tool.

NetCDF to CSV

Please consult the documentation in the netcdf2csv/README.md file for more information about this tool.

Metadata

Release files for tsdat-tools 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tsdat-tools 0.3.1
File Size Uploaded Provenance Actions
tsdat_tools-0.3.1.tar.gz 50.6 kB Without provenance Details for tsdat_tools-0.3.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tsdat-tools 0.3.1
File Interpreter ABI Platform Actions
tsdat_tools-0.3.1-py3-none-any.whl Python 3 none any Details for tsdat_tools-0.3.1-py3-none-any.whl

Total release size: 82.3 kB

Release files / tsdat_tools-0.3.1.tar.gz

Download URL tsdat_tools-0.3.1.tar.gz
Size 50.6 kB
Tags Source
SHA-256 checksum
How to use checksums
80a28d9f565024cdce2d6f676a06ee305cf11ccf71793e8179dff5b3b96657fd
BLAKE2b-256 checksum
How to use checksums
efea185256702507896aed715dcd29f8171a1534532fc6060e9f714a8e0ec951
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / tsdat_tools-0.3.1-py3-none-any.whl

Download URL tsdat_tools-0.3.1-py3-none-any.whl
Size 31.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f5a01575982a9b713e9693c0ae8018063c344e7b1e77f0483c66032fe0712197
BLAKE2b-256 checksum
How to use checksums
cc9c8b2e9b576981fcfe9b457e8a7bd37d000e20dd8b88ddb564c49d5e62b135
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Security for tsdat-tools 0.3.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page