Skip to content

Commit

Permalink
⭐ Hurdat2 adapter (#378)
Browse files Browse the repository at this point in the history
* hurdat2 data adapter

* use CF conventions

* improve warning when it cannot be determined whether the remote file is new or not

* increment revision

---------

Co-authored-by: Shane Elipot <selipot@miami.edu>
  • Loading branch information
kevinsantana11 and selipot committed Apr 1, 2024
1 parent 5da9695 commit 63a0d95
Show file tree
Hide file tree
Showing 12 changed files with 728 additions and 99 deletions.
2 changes: 2 additions & 0 deletions clouddrift/adapters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import clouddrift.adapters.gdp1h as gdp1h
import clouddrift.adapters.gdp6h as gdp6h
import clouddrift.adapters.glad as glad
import clouddrift.adapters.hurdat2 as hurdat2
import clouddrift.adapters.mosaic as mosaic
import clouddrift.adapters.subsurface_floats as subsurface_floats
import clouddrift.adapters.utils as utils
Expand All @@ -20,6 +21,7 @@
__all__ = [
"andro",
"gdp1h",
"hurdat2",
"gdp6h",
"glad",
"mosaic",
Expand Down
12 changes: 6 additions & 6 deletions clouddrift/adapters/gdp1h.py
Original file line number Diff line number Diff line change
Expand Up @@ -610,11 +610,11 @@ def to_raggedarray(

# set dynamic global attributes
if ra.attrs_global:
ra.attrs_global["time_coverage_start"] = (
f"{datetime(1970,1,1) + timedelta(seconds=int(np.min(ra.coords['time']))):%Y-%m-%d:%H:%M:%SZ}"
)
ra.attrs_global["time_coverage_end"] = (
f"{datetime(1970,1,1) + timedelta(seconds=int(np.max(ra.coords['time']))):%Y-%m-%d:%H:%M:%SZ}"
)
ra.attrs_global[
"time_coverage_start"
] = f"{datetime(1970,1,1) + timedelta(seconds=int(np.min(ra.coords['time']))):%Y-%m-%d:%H:%M:%SZ}"
ra.attrs_global[
"time_coverage_end"
] = f"{datetime(1970,1,1) + timedelta(seconds=int(np.max(ra.coords['time']))):%Y-%m-%d:%H:%M:%SZ}"

return ra
12 changes: 6 additions & 6 deletions clouddrift/adapters/gdp6h.py
Original file line number Diff line number Diff line change
Expand Up @@ -518,11 +518,11 @@ def to_raggedarray(
)

# update dynamic global attributes
ra.attrs_global["time_coverage_start"] = (
f"{datetime.datetime(1970,1,1) + datetime.timedelta(seconds=int(np.min(ra.coords['time']))):%Y-%m-%d:%H:%M:%SZ}"
)
ra.attrs_global["time_coverage_end"] = (
f"{datetime.datetime(1970,1,1) + datetime.timedelta(seconds=int(np.max(ra.coords['time']))):%Y-%m-%d:%H:%M:%SZ}"
)
ra.attrs_global[
"time_coverage_start"
] = f"{datetime.datetime(1970,1,1) + datetime.timedelta(seconds=int(np.min(ra.coords['time']))):%Y-%m-%d:%H:%M:%SZ}"
ra.attrs_global[
"time_coverage_end"
] = f"{datetime.datetime(1970,1,1) + datetime.timedelta(seconds=int(np.max(ra.coords['time']))):%Y-%m-%d:%H:%M:%SZ}"

return ra
Loading

0 comments on commit 63a0d95

Please sign in to comment.