Skip to content

Commit 52c562d

Browse files
TRT-635 Removing netcdf4 input handling (#34)
1 parent a72d187 commit 52c562d

17 files changed

Lines changed: 760 additions & 999 deletions

.gitattributes

Lines changed: 0 additions & 1 deletion
This file was deleted.

.pre-commit-config.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,21 @@ repos:
99
- id: check-json
1010
- id: check-yaml
1111
- id: check-added-large-files
12+
- repo: http://github.com/astral-sh/ruff-pre-commit
13+
rev: v0.12.12
14+
hooks:
15+
- id: ruff
16+
args: [ "--fix", "--show-fixes" ]
17+
types_or: [ python, jupyter ]
18+
exclude: |
19+
(?x)^(
20+
gdal_adapter/transform.py|
21+
gdal_adapter/reformat.py
22+
)$
23+
- id: ruff-format
24+
types_or: [ python, jupyter ]
25+
exclude: |
26+
(?x)^(
27+
gdal_adapter/transform.py|
28+
gdal_adapter/reformat.py
29+
)$

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,27 @@ documented in this file. The format is based on [Keep a
55
Changelog](http://keepachangelog.com/en/1.0.0/).
66

77

8+
## [v3.0.0] - 2025-09-18
9+
10+
### Added:
11+
12+
* `ruff` hooks have been added to the `pre-commit` settings for this repository.
13+
They exclude large legacy files, but will otherwise scan smaller files as
14+
they are iterated.
15+
16+
### Changed:
17+
18+
* Functionality to generate netCDF4 output files from GeoTIFFs has been migrated
19+
into a new separate module. This may be a step towards a separate microservice
20+
for this operation.
21+
22+
### Removed:
23+
24+
* Input files that are netCDF4 or zip files containing netCDF4 files will no
25+
longer be processed in this service. Instead, the [net2cog](https://github.com/podaac/net2cog)
26+
service should be used as a preceding step to ensure a GeoTIFF input to this
27+
service.
28+
829
## [v2.0.0] - 2025-09-05
930

1031
### Changed:
@@ -319,5 +340,6 @@ This is the final version. We will stop the development for a while.
319340

320341
## [v1.0.0]
321342

343+
[v3.0.0]: https://github.com/nasa/harmony-gdal-adapter/releases/tag/3.0.0
322344
[v2.0.0]: https://github.com/nasa/harmony-gdal-adapter/releases/tag/2.0.0
323345
[v1.1.0]: https://github.com/nasa/harmony-gdal-adapter/releases/tag/1.1.0

gdal_subsetter/exceptions.py

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
"""This module contains custom exceptions specific to the Harmony GDAL Adapter
2-
service. These exceptions are intended to allow for clearer messages to the
3-
end-user and easier debugging of expected errors that arise during an
4-
invocation of the service.
1+
"""Contains custom exceptions specific to the Harmony GDAL Adapter service.
2+
3+
These exceptions are intended to allow for clearer messages to the
4+
end-user and easier debugging of expected errors that arise during an
5+
invocation of the service.
56
67
"""
78
# noqa: D107
@@ -13,42 +14,29 @@ class HGAException(HarmonyException):
1314
"""Base class for exceptions in the Harmony GDAL Adapter."""
1415

1516
def __init__(self, message):
16-
super().__init__(message, 'nasa/harmony-gdal-adapter')
17+
super().__init__(message)
1718

1819

1920
class DownloadError(HGAException):
20-
""" This exception is raised when the Harmony GDAL Adapter cannot retrieve
21-
input data.
21+
"""Raised when the Harmony GDAL Adapter cannot retrieve input data."""
2222

23-
"""
2423
def __init__(self, url, message):
25-
super().__init__(f'Could not download resource: {url}, {message}')
24+
super().__init__(f"Could not download resource: {url}, {message}")
2625

2726

28-
class UnknownFileFormatError(HGAException):
29-
""" This is raised when the input file format is one that cannot by
30-
processed by the Harmony GDAL Adapter.
27+
class UnsupportedFileFormatError(HGAException):
28+
"""Raised when the input file format is cannot processed by the HGA."""
3129

32-
"""
3330
def __init__(self, file_format):
34-
super().__init__('Cannot process unrecognised file format: '
35-
f'"{file_format}"')
31+
super().__init__(f'Cannot process unsupported file format: "{file_format}"')
3632

3733

3834
class IncompatibleVariablesError(HGAException):
39-
""" This exception is raised when the dataset variables requested are not
40-
compatible, i.e. they have different projections, geotransforms, sizes or
41-
data types.
35+
"""Raised when the dataset variables requested are not compatible.
4236
43-
"""
44-
def __init__(self, message):
45-
super().__init__(f'Incompatible variables: {message}')
46-
47-
48-
class MultipleZippedNetCDF4FilesError(HGAException):
49-
""" This exception is raised when the input file supplied to HGA is a zip
50-
file containing multiple NetCDF-4 files, as these cannot be aggregated.
37+
i.e. they have different projections, geotransforms, sizes or data types.
5138
5239
"""
53-
def __init__(self, zip_file):
54-
super().__init__(f'Multiple NetCDF-4 files within input: {zip_file}.')
40+
41+
def __init__(self, message):
42+
super().__init__(f"Incompatible variables: {message}")

0 commit comments

Comments
 (0)