Skip to content

Commit

Permalink
Merge pull request #164 from nsidc/use-f17-nrt
Browse files Browse the repository at this point in the history
Use f17 nrt
  • Loading branch information
trey-stafford authored Sep 26, 2024
2 parents 3b6bd6a + 194f743 commit 3c6aa6e
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 35 deletions.
2 changes: 1 addition & 1 deletion seaice_ecdr/config/default_platform_start_dates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@ cdr_platform_start_dates:
- platform_id: "F13"
start_date: "1995-10-01"
- platform_id: "F17"
start_date: "2011-10-04"
start_date: "2008-01-01"
7 changes: 3 additions & 4 deletions seaice_ecdr/config/nrt_platform_start_dates.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
cdr_platform_start_dates:
# We only use F18 for NRT.
- platform_id: "F18"
# This appears to be the first date of data in NSIDC0080.
start_date: "2021-11-01"
# We only use F17 for NRT.
- platform_id: "F17"
start_date: "2008-01-01"
4 changes: 2 additions & 2 deletions seaice_ecdr/initial_daily_ecdr.py
Original file line number Diff line number Diff line change
Expand Up @@ -585,8 +585,8 @@ def compute_initial_daily_ecdr_dataset(
satellite="amsre",
gridid=ecdr_ide_ds.grid_id,
)
# NOTE/TODO: we get F18 data from NSIDC-0080 for NRT processing, but we are
# using the NSIDC-0001 specific BT params for F18.
# NOTE/TODO: we get F17 data from NSIDC-0080 for NRT processing, but we are
# using the NSIDC-0001 specific BT params for F17 regardless of the source.
elif platform.id in get_args(NSIDC_0001_SATS):
bt_coefs_init = pmi_bt_params_0001.get_nsidc0001_bootstrap_params(
date=date,
Expand Down
35 changes: 18 additions & 17 deletions seaice_ecdr/nrt.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
from seaice_ecdr.intermediate_daily import (
complete_daily_ecdr_ds,
)
from seaice_ecdr.platforms import (
PLATFORM_CONFIG,
)
from seaice_ecdr.publish_daily import (
get_complete_daily_filepath,
make_publication_ready_ds,
Expand All @@ -50,7 +47,7 @@
# future we can refactor the code to support configuring the platform start
# dates at any point rather than needing an at-import-time setup as we currently
# do.
NRT_PLATFORM_ID: Final = "F18"
NRT_PLATFORM_ID: Final = "F17"
# Number of days to look previously for temporal interpolation (forward
# gap-filling)
NRT_DAYS_TO_LOOK_PREVIOUSLY: Final = 5
Expand All @@ -73,7 +70,20 @@ def compute_nrt_initial_daily_ecdr_dataset(
resolution=NRT_RESOLUTION,
platform_id=NRT_PLATFORM_ID,
)

except Exception:
# This would be a `FileNotFoundError` if a data files is completely
# missing. Currently, an OSError may also be raised if the data file exists
# but is missing the data variable we expect. Other errors may also be
# possible. In any of these cases, we want to proceed by using null Tbs that
# can be temporally interpolated.
ecdr_tbs = get_null_ecdr_tbs(hemisphere=hemisphere, resolution=NRT_RESOLUTION)
logger.warning(
"Encountered a problem fetching NSIDC-0080 TBs from disk."
f" Using all-null TBS for date={date},"
f" hemisphere={hemisphere},"
f" resolution={NRT_RESOLUTION}"
)
else:
ecdr_tbs = map_tbs_to_ecdr_channels(
mapping=dict(
v19="v19",
Expand All @@ -88,13 +98,6 @@ def compute_nrt_initial_daily_ecdr_dataset(
date=date,
data_source=data_source,
)
except FileNotFoundError:
ecdr_tbs = get_null_ecdr_tbs(hemisphere=hemisphere, resolution=NRT_RESOLUTION)
logger.warning(
f"Using all-null TBS for date={date},"
f" hemisphere={hemisphere},"
f" resolution={NRT_RESOLUTION}"
)

tb_data = EcdrTbData(
tbs=ecdr_tbs,
Expand All @@ -121,12 +124,10 @@ def read_or_create_and_read_nrt_idecdr_ds(
intermediate_output_dir: Path,
overwrite: bool,
):
# TODO: this isn't correct. We always use F18
platform = PLATFORM_CONFIG.get_platform_by_date(date)
idecdr_filepath = get_idecdr_filepath(
hemisphere=hemisphere,
date=date,
platform_id=platform.id,
platform_id=NRT_PLATFORM_ID,
intermediate_output_dir=intermediate_output_dir,
resolution=NRT_RESOLUTION,
)
Expand Down Expand Up @@ -259,7 +260,7 @@ def nrt_ecdr_for_day(
overwrite: bool,
ancillary_source: ANCILLARY_SOURCES = "CDRv5",
):
"""Create an initial daily ECDR NetCDF using NRT NSIDC-0080 F18 data."""
"""Create an initial daily ECDR NetCDF using NRT NSIDC-0080 F17 data."""
nrt_output_filepath = get_nrt_complete_daily_filepath(
base_output_dir=base_output_dir,
hemisphere=hemisphere,
Expand Down Expand Up @@ -308,7 +309,7 @@ def nrt_ecdr_for_day(
)
daily_ds.attrs["product_version"] = ECDR_NRT_PRODUCT_VERSION.version_str
daily_ds.attrs["summary"] = (
f"This data set provides a near-real-time (NRT) passive microwave sea ice concentration climate data record (CDR) based on gridded brightness temperatures (TBs) from the Defense Meteorological Satellite Program (DMSP) passive microwave radiometer: the Special Sensor Microwave Imager/Sounder (SSMIS) F18. The sea ice concentration CDR is an estimate of sea ice concentration that is produced by combining concentration estimates from two algorithms developed at the NASA Goddard Space Flight Center (GSFC): the NASA Team algorithm and the Bootstrap algorithm. The individual algorithms are used to process and combine brightness temperature data at NSIDC. This product is designed to provide an NRT time series of sea ice concentrations (the fraction, or percentage, of ocean area covered by sea ice). The data are gridded on the NSIDC polar stereographic grid with {NRT_RESOLUTION} x {NRT_RESOLUTION} km grid cells and are available in NetCDF file format. Each file contains a variable with the CDR concentration values as well as variables that hold the NASA Team and Bootstrap processed concentrations for reference. Variables containing standard deviation, quality flags, and projection information are also included."
f"This data set provides a near-real-time (NRT) passive microwave sea ice concentration climate data record (CDR) based on gridded brightness temperatures (TBs) from the Defense Meteorological Satellite Program (DMSP) passive microwave radiometer: the Special Sensor Microwave Imager/Sounder (SSMIS) F17. The sea ice concentration CDR is an estimate of sea ice concentration that is produced by combining concentration estimates from two algorithms developed at the NASA Goddard Space Flight Center (GSFC): the NASA Team algorithm and the Bootstrap algorithm. The individual algorithms are used to process and combine brightness temperature data at NSIDC. This product is designed to provide an NRT time series of sea ice concentrations (the fraction, or percentage, of ocean area covered by sea ice). The data are gridded on the NSIDC polar stereographic grid with {NRT_RESOLUTION} x {NRT_RESOLUTION} km grid cells and are available in NetCDF file format. Each file contains a variable with the CDR concentration values as well as variables that hold the NASA Team and Bootstrap processed concentrations for reference. Variables containing standard deviation, quality flags, and projection information are also included."
)

daily_ds.to_netcdf(nrt_output_filepath)
Expand Down
28 changes: 17 additions & 11 deletions seaice_ecdr/tb_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,23 @@ def _get_nsidc_0001_tbs(
resolution=nsidc0001_resolution,
sat=platform_id,
)

except Exception:
# This would be a `FileNotFoundError` if a data files is completely
# missing. Currently, an OSError may also be raised if the data file exists
# but is missing the data variable we expect. Other errors may also be
# possible. In any of these cases, we want to proceed by using null Tbs that
# can be temporally interpolated.
ecdr_tbs = get_null_ecdr_tbs(
hemisphere=hemisphere, resolution=nsidc0001_resolution
)
logger.warning(
"Encountered a problem fetching NSIDC-0001 TBs from disk."
f" Used all-null TBS for date={date},"
f" hemisphere={hemisphere},"
f" resolution={tb_resolution}"
f" platform_id={platform_id}"
)
else:
ecdr_tbs = map_tbs_to_ecdr_channels(
mapping=dict(
v19="v19",
Expand All @@ -237,16 +253,6 @@ def _get_nsidc_0001_tbs(
date=date,
data_source=data_source,
)
except FileNotFoundError:
ecdr_tbs = get_null_ecdr_tbs(
hemisphere=hemisphere, resolution=nsidc0001_resolution
)
logger.warning(
f"Used all-null TBS for date={date},"
f" hemisphere={hemisphere},"
f" resolution={tb_resolution}"
f" platform_id={platform_id}"
)

# TODO: For debugging TBs, consider a print/log statement such as this:
# print(f'platform: {platform} with tbs: {xr_tbs.data_vars.keys()}')
Expand Down

0 comments on commit 3c6aa6e

Please sign in to comment.