Skip to content

Commit

Permalink
feat: Add telemac support
Browse files Browse the repository at this point in the history
fixes #27
  • Loading branch information
pmav99 committed Jun 14, 2024
1 parent 999de49 commit 2c9a821
Show file tree
Hide file tree
Showing 21 changed files with 7,067 additions and 6,485 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ on:
- main
- master
paths:
- '**.py'
- '.github/workflows/test*.yml'
- 'pyproject.toml'
- 'poetry.lock'
- 'conda-lock.yml'
- 'requirements/*'
- "**.py"
- ".github/workflows/test*.yml"
- "pyproject.toml"
- "poetry.lock"
- "conda-lock.yml"
- "requirements/*"
pull_request:
paths:
- '**.py'
- '.github/workflows/test*.yml'
- 'pyproject.toml'
- 'poetry.lock'
- 'conda-lock.yml'
- 'requirements/*'
- "**.py"
- ".github/workflows/test*.yml"
- "pyproject.toml"
- "poetry.lock"
- "conda-lock.yml"
- "requirements/*"

jobs:
run_tests:
Expand Down
43 changes: 34 additions & 9 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

---
ci:
skip: ["mypy"]
Expand Down Expand Up @@ -54,7 +53,7 @@ repos:

- repo: "https://github.com/charliermarsh/ruff-pre-commit"
# Ruff version.
rev: 'v0.4.7'
rev: "v0.4.7"
hooks:
- id: "ruff"

Expand All @@ -70,18 +69,44 @@ repos:
- id: "poetry-lock"
args: ["--check"]
- id: "poetry-export"
name: 'poetry export main'
args: ["--without-hashes", "-f", "requirements.txt", "-o", "requirements/requirements.txt"]
name: "poetry export main"
args:
[
"--without-hashes",
"-f",
"requirements.txt",
"-o",
"requirements/requirements.txt",
]
- id: "poetry-export"
name: 'poetry export main + grib'
args: ["--without-hashes", "-E", "grib", "-f", "requirements.txt", "-o", "requirements/requirements-extras.txt"]
name: "poetry export main + grib"
args:
[
"--without-hashes",
"-E",
"all",
"-f",
"requirements.txt",
"-o",
"requirements/requirements-extras.txt",
]
- id: "poetry-export"
name: 'poetry export dev'
args: ["--without-hashes", "--with", "dev", "-E", "grib", "-f", "requirements.txt", "-o", "requirements/requirements-dev.txt"]
name: "poetry export dev"
args:
[
"--without-hashes",
"--with",
"dev",
"-E",
"all",
"-f",
"requirements.txt",
"-o",
"requirements/requirements-dev.txt",
]

- repo: "local"
hooks:

- id: "mypy"
name: "mypy"
entry: "make mypy"
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ list:
@LC_ALL=C $(MAKE) -pRrq -f $(lastword $(MAKEFILE_LIST)) : 2>/dev/null | awk -v RS= -F: '/^# File/,/^# Finished Make data base/ {if ($$1 !~ "^[#.]") {print $$1}}' | sort | grep -E -v -e '^[^[:alnum:]]' -e '^$@$$'

init:
poetry install --with=dev -E grib
poetry install --with=dev -E all
pre-commit install

style:
Expand Down
48 changes: 43 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,35 +5,41 @@

A CLI utility to print metadata of datasets in various formats (e.g. NetCDF, zarr, GRIB etc)

*powered by [xarray](https://github.com/pydata/xarray)*
_powered by [xarray](https://github.com/pydata/xarray)_

## Prerequisites

You need the following binary dependencies:

- Python >= 3.9
- Optionally, [eccodes](https://github.com/ecmwf/eccodes), which is necessary for GRIB support.
- Optionally, [eccodes](https://github.com/ecmwf/eccodes), which is necessary for GRIB support.

## Installation

The recommended way of installation is [pipx](https://github.com/pypa/pipx):

```
pipx install inspectds
```

# or if you want support for GRIB
or if you want support for GRIB, SELAFIN or both:

```
pipx install 'inspectds[grib]'
pipx install 'inspectds[selafin]'
pipx install 'inspectds[all]'
```

If you want to install the latest development version from git, then use:

```
pipx install 'git+https://github.com/pmav99/inspectds.git#egg=inspectds[grib]'
pipx install 'git+https://github.com/pmav99/inspectds.git#egg=inspectds[all]'
```

## Usage

### Netcdf

```
$ inspectds tests/data/example_1.nc
Expand Down Expand Up @@ -63,6 +69,7 @@ Data variables:
```

### GRIB

```
$ inspectds tests/data/example.grib
Expand All @@ -80,10 +87,41 @@ Data variables:
t (number, time, isobaricInhPa, latitude, longitude) float32 ...
```

### SELAFIN

```
$ inspectds tests/data/iceland.slf
Dimensions: (time: 13, node: 3526)
Coordinates:
x (node) float32 14kB -13.99 -14.97 -15.89 ... -13.52 -16.31 -12.28
y (node) float32 14kB 57.38 60.19 69.79 63.11 ... 66.37 69.34 63.52
* time (time) datetime64[ns] 104B 2017-10-01 ... 2017-10-01T12:00:00
Data variables:
S (time, node) float32 183kB ...
```

### More info:

```
inspectds --help
$ inspectds --help
Usage: inspectds [OPTIONS] PATH
╭─ Arguments ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ * path PATH The path to the dataset [default: None] [required] │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ --dataset-type [auto|netcdf|zarr|grib|selafin] The dataset type. If 'auto', then it gets inferred from PATH [default: auto] │
│ --mask-and-scale --no-mask-and-scale Whether to mask and scale the dataset [default: no-mask-and-scale] │
│ --dimensions --no-dimensions Whether to include 'Dimensions' in the output [default: dimensions] │
│ --coordinates --no-coordinates Whether to include 'Coordinates' in the output [default: coordinates] │
│ --variables --no-variables Whether to include 'Variables' in the output [default: variables] │
│ --variable-attributes --no-variable-attributes Whether to include the variable attributes in the output [default: no-variable-attributes] │
│ --global-attributes --no-global-attributes Whether to include the global attributes in the output [default: no-global-attributes] │
│ --full --no-full Display full output. Overrides any other option [default: no-full] │
│ --version Display the version │
│ --help Show this message and exit. │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
```

## Development
Expand Down
Loading

0 comments on commit 2c9a821

Please sign in to comment.