Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enter missing attrs in datastores as "", rather than None #123

Merged
merged 2 commits into from
Sep 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/access_nri_intake/source/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,15 +257,15 @@
if "standard_name" in attrs:
variable_standard_name_list.append(attrs["standard_name"])
else:
variable_standard_name_list.append(None)
variable_standard_name_list.append("")
if "cell_methods" in attrs:
variable_cell_methods_list.append(attrs["cell_methods"])
else:
variable_cell_methods_list.append(None)
variable_cell_methods_list.append("")
if "units" in attrs:
variable_units_list.append(attrs["units"])
else:
variable_units_list.append(None)
variable_units_list.append("")

Check warning on line 268 in src/access_nri_intake/source/utils.py

View check run for this annotation

Codecov / codecov/patch

src/access_nri_intake/source/utils.py#L268

Added line #L268 was not covered by tests

start_date, end_date, frequency = get_timeinfo(ds, filename_frequency, time_dim)

Expand Down
38 changes: 19 additions & 19 deletions tests/test_source_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def test_parse_access_filename(filename, expected):
"none",
["geolat_t", "geolon_t"],
["tracer latitude", "tracer longitude"],
[None, None],
["", ""],
["time: point", "time: point"],
["degrees_N", "degrees_E"],
),
Expand All @@ -111,8 +111,8 @@ def test_parse_access_filename(filename, expected):
"1910-01-01, 00:00:00",
["temp", "time_bounds"],
["Conservative temperature", "time axis boundaries"],
["sea_water_conservative_temperature", None],
["time: mean", None],
["sea_water_conservative_temperature", ""],
["time: mean", ""],
["K", "days"],
),
),
Expand All @@ -130,8 +130,8 @@ def test_parse_access_filename(filename, expected):
"mixed layer depth determined by density criteria",
"time axis boundaries",
],
["ocean_mixed_layer_thickness_defined_by_sigma_t", None],
["time: mean", None],
["ocean_mixed_layer_thickness_defined_by_sigma_t", ""],
["time: mean", ""],
["m", "days"],
),
),
Expand Down Expand Up @@ -168,8 +168,8 @@ def test_parse_access_filename(filename, expected):
"area of T grid cells",
"boundaries for time-averaging interval",
],
[None, None, None, None, None],
[None, None, "time: mean", None, None],
["", "", "", "", ""],
["", "", "time: mean", "", ""],
[
"degrees_north",
"degrees_east",
Expand Down Expand Up @@ -212,8 +212,8 @@ def test_parse_access_filename(filename, expected):
"area of T grid cells",
"boundaries for time-averaging interval",
],
[None, None, None, None, None],
[None, None, "time: mean", None, None],
["", "", "", "", ""],
["", "", "time: mean", "", ""],
[
"degrees_north",
"degrees_east",
Expand All @@ -234,8 +234,8 @@ def test_parse_access_filename(filename, expected):
"2015-07-01, 00:00:00",
["sst", "time_bounds"],
["Potential temperature", "time axis boundaries"],
["sea_surface_temperature", None],
["time: mean", None],
["sea_surface_temperature", ""],
["time: mean", ""],
["K", "days"],
),
),
Expand All @@ -250,8 +250,8 @@ def test_parse_access_filename(filename, expected):
"2015-07-01, 00:00:00",
["temp_global_ave", "time_bounds"],
["Global mean temp in liquid seawater", "time axis boundaries"],
["sea_water_potential_temperature", None],
["time: mean", None],
["sea_water_potential_temperature", ""],
["time: mean", ""],
["deg_C", "days"],
),
),
Expand Down Expand Up @@ -288,8 +288,8 @@ def test_parse_access_filename(filename, expected):
"area of T grid cells",
"boundaries for time-averaging interval",
],
[None, None, None, None, None],
[None, None, "time: mean", None, None],
["", "", "", "", ""],
["", "", "time: mean", "", ""],
[
"degrees_north",
"degrees_east",
Expand All @@ -310,8 +310,8 @@ def test_parse_access_filename(filename, expected):
"1850-12-30, 00:00:00",
["fgco2_raw", "time_bounds"],
["Flux into ocean - DIC, inc. anth.", "time axis boundaries"],
[None, None],
["time: mean", None],
["", ""],
["time: mean", ""],
["mmol/m^2/s", "days"],
),
),
Expand All @@ -326,8 +326,8 @@ def test_parse_access_filename(filename, expected):
"1850-12-30, 00:00:00",
["o2", "time_bounds"],
["o2", "time axis boundaries"],
[None, None],
["time: mean", None],
["", ""],
["time: mean", ""],
["mmol/m^3", "days"],
),
),
Expand Down
Loading