From eaa7cac720a503776fa54d64fa5916f3b2a899a9 Mon Sep 17 00:00:00 2001 From: Trey Stafford Date: Thu, 19 Sep 2024 09:23:05 -0600 Subject: [PATCH] Rename `cdr_seaice_conc_stdev_monthly` -> `cdr_seaice_conc_monthly_stdev` --- seaice_ecdr/intermediate_monthly.py | 22 +++++++++++----------- seaice_ecdr/publish_monthly.py | 2 +- seaice_ecdr/tests/unit/test_monthly.py | 8 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/seaice_ecdr/intermediate_monthly.py b/seaice_ecdr/intermediate_monthly.py index 7ae04c19..16d32a4d 100644 --- a/seaice_ecdr/intermediate_monthly.py +++ b/seaice_ecdr/intermediate_monthly.py @@ -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) @@ -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( @@ -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, ) @@ -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, ) diff --git a/seaice_ecdr/publish_monthly.py b/seaice_ecdr/publish_monthly.py index 95962010..71512a19 100644 --- a/seaice_ecdr/publish_monthly.py +++ b/seaice_ecdr/publish_monthly.py @@ -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( diff --git a/seaice_ecdr/tests/unit/test_monthly.py b/seaice_ecdr/tests/unit/test_monthly.py index 4385cfa0..418b5ba1 100644 --- a/seaice_ecdr/tests/unit/test_monthly.py +++ b/seaice_ecdr/tests/unit/test_monthly.py @@ -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, @@ -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]) @@ -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, ) @@ -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",