Skip to content

Commit

Permalink
Rename cdr_seaice_conc_stdev_monthly -> `cdr_seaice_conc_monthly_st…
Browse files Browse the repository at this point in the history
…dev`
  • Loading branch information
trey-stafford committed Sep 19, 2024
1 parent 740a5dc commit eaa7cac
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 16 deletions.
22 changes: 11 additions & 11 deletions seaice_ecdr/intermediate_monthly.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Variables:
* `cdr_seaice_conc_monthly`: Create combined monthly sea ice concentration
* `cdr_seaice_conc_stdev_monthly`: Calculate standard deviation of sea ice
* `cdr_seaice_conc_monthly_stdev`: Calculate standard deviation of sea ice
concentration
* `cdr_seaice_conc_monthly_qa`: QA Fields (Weather filters, land
spillover, valid ice mask, spatial and temporal interpolation, melt onset)
Expand Down Expand Up @@ -377,30 +377,30 @@ def calc_cdr_seaice_conc_monthly(
return conc_monthly


def calc_cdr_seaice_conc_stdev_monthly(
def calc_cdr_seaice_conc_monthly_stdev(
*,
daily_cdr_seaice_conc: xr.DataArray,
) -> xr.DataArray:
"""Create the `cdr_seaice_conc_stdev_monthly` variable."""
cdr_seaice_conc_stdev_monthly = daily_cdr_seaice_conc.std(
"""Create the `cdr_seaice_conc_monthly_stdev` variable."""
cdr_seaice_conc_monthly_stdev = daily_cdr_seaice_conc.std(
dim="time",
ddof=1,
)
cdr_seaice_conc_stdev_monthly.name = "cdr_seaice_conc_stdev_monthly"
cdr_seaice_conc_monthly_stdev.name = "cdr_seaice_conc_monthly_stdev"

cdr_seaice_conc_stdev_monthly = cdr_seaice_conc_stdev_monthly.assign_attrs(
cdr_seaice_conc_monthly_stdev = cdr_seaice_conc_monthly_stdev.assign_attrs(
long_name="Passive Microwave Monthly Northern Hemisphere Sea Ice Concentration Source Estimated Standard Deviation",
valid_range=(np.float32(0.0), np.float32(1.0)),
grid_mapping="crs",
units="1",
)

cdr_seaice_conc_stdev_monthly.encoding = dict(
cdr_seaice_conc_monthly_stdev.encoding = dict(
_FillValue=-1,
zlib=True,
)

return cdr_seaice_conc_stdev_monthly
return cdr_seaice_conc_monthly_stdev


def calc_cdr_melt_onset_day_monthly(
Expand Down Expand Up @@ -522,9 +522,9 @@ def make_intermediate_monthly_ds(
ancillary_source=ancillary_source,
)

# Create `cdr_seaice_conc_stdev_monthly`, the standard deviation of the
# Create `cdr_seaice_conc_monthly_stdev`, the standard deviation of the
# sea ice concentration.
cdr_seaice_conc_stdev_monthly = calc_cdr_seaice_conc_stdev_monthly(
cdr_seaice_conc_monthly_stdev = calc_cdr_seaice_conc_monthly_stdev(
daily_cdr_seaice_conc=daily_ds_for_month.cdr_seaice_conc,
)

Expand All @@ -540,7 +540,7 @@ def make_intermediate_monthly_ds(

monthly_ds_data_vars = dict(
cdr_seaice_conc_monthly=cdr_seaice_conc_monthly,
cdr_seaice_conc_stdev_monthly=cdr_seaice_conc_stdev_monthly,
cdr_seaice_conc_monthly_stdev=cdr_seaice_conc_monthly_stdev,
cdr_seaice_conc_monthly_qa=cdr_seaice_conc_monthly_qa,
surface_type_mask=surface_type_mask_monthly,
)
Expand Down
2 changes: 1 addition & 1 deletion seaice_ecdr/publish_monthly.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def prepare_monthly_nc_for_publication(
cdr_var_fieldnames = [
"cdr_seaice_conc_monthly",
"cdr_seaice_conc_monthly_qa",
"cdr_seaice_conc_stdev_monthly",
"cdr_seaice_conc_monthly_stdev",
]
remap_names = {
cdr_var_fieldname: cdr_var_fieldname.replace(
Expand Down
8 changes: 4 additions & 4 deletions seaice_ecdr/tests/unit/test_monthly.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
calc_cdr_melt_onset_day_monthly,
calc_cdr_seaice_conc_monthly,
calc_cdr_seaice_conc_monthly_qa,
calc_cdr_seaice_conc_stdev_monthly,
calc_cdr_seaice_conc_monthly_stdev,
calc_surface_type_mask_monthly,
check_min_days_for_valid_month,
make_intermediate_monthly_ds,
Expand Down Expand Up @@ -397,7 +397,7 @@ def test__calc_conc_monthly(monkeypatch):
)


def test_calc_cdr_seaice_conc_stdev_monthly():
def test_calc_cdr_seaice_conc_monthly_stdev():
# time ->
pixel_one = np.array([0.12, 0.15, 0.23])
pixel_two = np.array([0.46, 0.55, 0.54])
Expand All @@ -419,7 +419,7 @@ def test_calc_cdr_seaice_conc_stdev_monthly():
),
)

actual = calc_cdr_seaice_conc_stdev_monthly(
actual = calc_cdr_seaice_conc_monthly_stdev(
daily_cdr_seaice_conc=mock_daily_conc,
)

Expand Down Expand Up @@ -521,7 +521,7 @@ def test_monthly_ds(monkeypatch, tmpdir):
expected_vars = sorted(
[
"cdr_seaice_conc_monthly",
"cdr_seaice_conc_stdev_monthly",
"cdr_seaice_conc_monthly_stdev",
"cdr_melt_onset_day_monthly",
"cdr_seaice_conc_monthly_qa",
"crs",
Expand Down

0 comments on commit eaa7cac

Please sign in to comment.