Skip to content

Commit

Permalink
use today as max_time in fast glider (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
ocefpaf authored Jan 29, 2025
1 parent 6d44cbf commit a6aa9a3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ioos_metrics/ioos_metrics.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""Code extracted from IOOS_BTN.ipynb."""

import datetime
import functools
import io
import logging
Expand Down Expand Up @@ -95,7 +96,7 @@ def federal_partners():


@functools.lru_cache(maxsize=128)
def ngdac_gliders_fast(min_time="2000-01-01T00:00:00Z", max_time="2023-12-31T23:59:59Z") -> int:
def ngdac_gliders_fast(min_time="2000-01-01T00:00:00Z", max_time=None) -> int:
"""NGDAC Glider Days.
This version uses the AllDatasets entry to compute the glider days.
Expand All @@ -122,6 +123,9 @@ def ngdac_gliders_fast(min_time="2000-01-01T00:00:00Z", max_time="2023-12-31T23:
Note that data with NaN can be real glider day with lost data. Which is OK for this metric.
"""
if max_time is None:
max_time = datetime.datetime.now(datetime.UTC).strftime("%Y-%m-%dT%H:%M:%SZ")

df = pd.read_csv(
"https://gliders.ioos.us/erddap/tabledap/allDatasets.csvp?minTime,maxTime,datasetID",
)
Expand Down

0 comments on commit a6aa9a3

Please sign in to comment.