Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat tio zarr reader #179

Merged
merged 6 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 88 additions & 0 deletions django_project/gap/fixtures/8.dataset_attribute.json
Original file line number Diff line number Diff line change
Expand Up @@ -955,5 +955,93 @@
"source_unit": 5,
"ensembles": false
}
},
{
"model": "gap.datasetattribute",
"pk": 88,
"fields": {
"dataset": 4,
"attribute": 15,
"source": "total_rainfall",
"source_unit": 1,
"ensembles": false
}
},
{
"model": "gap.datasetattribute",
"pk": 89,
"fields": {
"dataset": 4,
"attribute": 8,
"source": "total_evapotranspiration_flux",
"source_unit": 1,
"ensembles": false
}
},
{
"model": "gap.datasetattribute",
"pk": 90,
"fields": {
"dataset": 4,
"attribute": 9,
"source": "max_temperature",
"source_unit": 5,
"ensembles": false
}
},
{
"model": "gap.datasetattribute",
"pk": 91,
"fields": {
"dataset": 4,
"attribute": 17,
"source": "min_temperature",
"source_unit": 5,
"ensembles": false
}
},
{
"model": "gap.datasetattribute",
"pk": 92,
"fields": {
"dataset": 4,
"attribute": 36,
"source": "precipitation_probability",
"source_unit": 6,
"ensembles": false
}
},
{
"model": "gap.datasetattribute",
"pk": 93,
"fields": {
"dataset": 4,
"attribute": 54,
"source": "humidity_maximum",
"source_unit": 6,
"ensembles": false
}
},
{
"model": "gap.datasetattribute",
"pk": 94,
"fields": {
"dataset": 4,
"attribute": 55,
"source": "humidity_minimum",
"source_unit": 6,
"ensembles": false
}
},
{
"model": "gap.datasetattribute",
"pk": 95,
"fields": {
"dataset": 4,
"attribute": 56,
"source": "wind_speed_avg",
"source_unit": 8,
"ensembles": false
}
}
]
15 changes: 12 additions & 3 deletions django_project/gap/providers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@
.. note:: Helper for reading NetCDF File
"""

from gap.models import Dataset
from gap.models import Dataset, DatasetStore
from gap.utils.netcdf import NetCDFProvider
from gap.providers.cbam import CBAMZarrReader, CBAMNetCDFReader # noqa
from gap.providers.salient import SalientNetCDFReader, SalientZarrReader # noqa
from gap.providers.tahmo import TahmoDatasetReader
from gap.providers.tio import (
TomorrowIODatasetReader,
PROVIDER_NAME as TIO_PROVIDER
PROVIDER_NAME as TIO_PROVIDER,
TioZarrReader
)


Expand All @@ -31,8 +32,16 @@
return SalientZarrReader
elif dataset.provider.name == 'Tahmo':
return TahmoDatasetReader
elif dataset.provider.name == TIO_PROVIDER:
elif (
dataset.provider.name == TIO_PROVIDER and
dataset.store_type == DatasetStore.EXT_API
):
return TomorrowIODatasetReader
elif (
dataset.provider.name == TIO_PROVIDER and
dataset.store_type == DatasetStore.ZARR
):
return TioZarrReader

Check warning on line 44 in django_project/gap/providers/__init__.py

View check run for this annotation

Codecov / codecov/patch

django_project/gap/providers/__init__.py#L44

Added line #L44 was not covered by tests
else:
raise TypeError(
f'Unsupported provider name: {dataset.provider.name}'
Expand Down
Loading
Loading