Skip to content

Commit 3364f35

Browse files
Merge pull request #198 from nsidc/seaice_ecdrv1_g02202v5_g10016v3
Seaice ecdrv1 g02202v5 g10016v3
2 parents de4f59d + 9b92bee commit 3364f35

File tree

5 files changed

+36
-12
lines changed

5 files changed

+36
-12
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# v1.1.0
2+
3+
* Update NRT daily processing code to fetch NSIDC-0080 (F17) via
4+
`earthaccess`. This will allow G10016 v3 to continue processing F17 data after
5+
the NSIDC on-prem ECS system is shut down.
6+
17
# v1.0.2
28

39
* Fix for subprocess calls for `git` operations (e.g., to get the current

environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ dependencies:
2626
- rioxarray
2727
- hvplot
2828
- jupyter_bokeh
29+
- h5netcdf
2930

3031
#############################
3132
# Non-imported dependencies #

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[project]
22
name = "seaice_ecdr"
3-
version = "1.0.2"
3+
version = "1.1.0"
44

55
[tool.bumpversion]
6-
current_version = "1.0.2"
6+
current_version = "1.1.0"
77
commit = false
88
tag = false
99

@@ -89,5 +89,6 @@ module = [
8989
"cv2.*",
9090
"ruamel.*",
9191
"datatree.*",
92+
"earthaccess.*",
9293
]
9394
ignore_missing_imports = true

seaice_ecdr/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from seaice_ecdr.constants import LOGS_DIR
88

9-
__version__ = "v1.0.2"
9+
__version__ = "v1.1.0"
1010

1111
# The standard loguru log levels, in increasing order of severity, are:
1212
# TRACE, DEBUG, INFO, SUCCESS, WARNING, ERROR, CRITICAL

seaice_ecdr/nrt.py

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,11 @@
1616

1717
import click
1818
import datatree
19+
import earthaccess
1920
import xarray as xr
2021
from loguru import logger
2122
from pm_tb_data._types import Hemisphere
22-
from pm_tb_data.fetch.nsidc_0080 import (
23-
NSIDC_0080_PLATFORM_ID,
24-
get_nsidc_0080_tbs_from_disk,
25-
)
23+
from pm_tb_data.fetch import nsidc_0080
2624

2725
from seaice_ecdr._types import ECDR_SUPPORTED_RESOLUTIONS
2826
from seaice_ecdr.ancillary import ANCILLARY_SOURCES
@@ -91,18 +89,36 @@ def _get_nsidc_0080_tbs(
9189
*,
9290
date: dt.date,
9391
hemisphere: Hemisphere,
94-
platform_id: NSIDC_0080_PLATFORM_ID,
92+
platform_id: nsidc_0080.NSIDC_0080_PLATFORM_ID,
9593
) -> EcdrTbData:
9694
# TODO: consider extracting the fetch-related code here to `tb_data` module.
9795
data_source: Final = "NSIDC-0080"
9896
try:
99-
xr_tbs = get_nsidc_0080_tbs_from_disk(
100-
date=date,
97+
expected_fn = (
98+
"NSIDC0080_TB_PS" f"_{hemisphere[0].upper()}25km" f"_{date:%Y%m%d}_v2.0.nc"
99+
)
100+
101+
results = earthaccess.search_data(
102+
short_name="NSIDC-0080",
103+
version="2",
104+
cloud_hosted=True,
105+
granule_name=expected_fn,
106+
)
107+
if len(results) != 1:
108+
raise FileNotFoundError(f"Could not find {expected_fn} via `earthaccess`.")
109+
granule_result = results[0]
110+
_earthaccess_granule = earthaccess.open([granule_result])
111+
112+
# TODO: ideally, we would use datatree here. xarray >2024.9 should have
113+
# datatree integrated directly.
114+
ds = xr.open_dataset(_earthaccess_granule[0], group=platform_id)
115+
116+
xr_tbs = nsidc_0080._normalize_nsidc_0080_tbs(
117+
ds=ds,
101118
hemisphere=hemisphere,
102-
resolution=NRT_RESOLUTION,
103119
platform_id=platform_id,
104120
)
105-
except Exception:
121+
except (FileNotFoundError, OSError):
106122
# This would be a `FileNotFoundError` if a data files is completely
107123
# missing. Currently, an OSError may also be raised if the data file exists
108124
# but is missing the data variable we expect. Other errors may also be

0 commit comments

Comments
 (0)