From 649a61111d42972ca663e1e203eecf70a80289e3 Mon Sep 17 00:00:00 2001 From: zmoon Date: Thu, 11 Apr 2024 16:53:14 -0600 Subject: [PATCH] 'siteid' in `add_data` output --- monetio/profile/gml_ozonesonde.py | 5 ++++- tests/test_gml_ozonesonde.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/monetio/profile/gml_ozonesonde.py b/monetio/profile/gml_ozonesonde.py index c993b3d8..d0754126 100644 --- a/monetio/profile/gml_ozonesonde.py +++ b/monetio/profile/gml_ozonesonde.py @@ -136,7 +136,7 @@ def add_data(dates, *, location=None, n_procs=1, errors="raise"): For example 'Boulder, Colorado'. If not provided, all locations will be used. Valid options correspond to the directories in https://gml.noaa.gov/aftp/data/ozwv/Ozonesonde/ - and may include data from more than one unique site (output column 'station'). + and may include data from more than one unique site (output column 'siteid'). n_procs : int For Dask. errors : {'raise', 'warn', 'skip'} @@ -213,6 +213,9 @@ def func(fp_or_url): assert set(repl.values()) <= set(LOCATIONS) df["station"] = df["station"].replace(repl) + # Normalized station name as site ID + df = df.rename(columns={"station": "siteid"}) + # Add metadata if hasattr(df, "attrs"): df.attrs["ds_attrs"] = {"urls": urls} diff --git a/tests/test_gml_ozonesonde.py b/tests/test_gml_ozonesonde.py index b12fd39b..306d28b6 100644 --- a/tests/test_gml_ozonesonde.py +++ b/tests/test_gml_ozonesonde.py @@ -71,7 +71,7 @@ def test_add_data(): assert 1 < latlon.nunique() <= 10, "multiple sites; lat/lon doesn't change in profile" # NOTE: Similar to the place folder names, but not all the same - assert df["station"].nunique() == latlon.nunique() + assert df["siteid"].nunique() == latlon.nunique() def test_add_data_location_sel():