Skip to content

Commit

Permalink
chore: deleting the setting of valid_min and valid_max for the dimension
Browse files Browse the repository at this point in the history
  • Loading branch information
uriii3 committed Jul 30, 2024
1 parent 1059e44 commit 60f2558
Showing 1 changed file with 1 addition and 25 deletions.
26 changes: 1 addition & 25 deletions copernicusmarine/download_functions/subset_xarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@
VariableDoesNotExistInTheDataset,
)
from copernicusmarine.core_functions.models import SubsetMethod
from copernicusmarine.core_functions.utils import (
ServiceNotSupported,
convert_datetime64_to_netcdf_timestamp,
)
from copernicusmarine.core_functions.utils import ServiceNotSupported
from copernicusmarine.download_functions.subset_parameters import (
DepthParameters,
GeographicalParameters,
Expand All @@ -47,8 +44,6 @@
"long_name",
"units",
"unit_long",
"valid_min",
"valid_max",
]
NETCDF_CONVENTION_COORDINATE_ATTRIBUTES = [
"standard_name",
Expand Down Expand Up @@ -359,34 +354,15 @@ def _update_dataset_coordinate_attributes(
NETCDF_CONVENTION_COORDINATE_ATTRIBUTES.copy()
)
if "time" in coordinate_label:
min_time_dimension = coord.values.min()
max_time_dimension = coord.values.max()
netcdf_unit = coord.encoding["units"]
valid_min = convert_datetime64_to_netcdf_timestamp(
min_time_dimension, netcdf_unit
)
valid_max = convert_datetime64_to_netcdf_timestamp(
max_time_dimension, netcdf_unit
)
attrs["standard_name"] = "time"
attrs["long_name"] = "Time"
attrs["valid_min"] = valid_min
attrs["valid_max"] = valid_max
attrs["axis"] = "T"
attrs["unit_long"] = (
coord.encoding["units"].replace("_", " ").title()
)
coordinate_attributes.remove("units")
elif coordinate_label in ["depth", "elevation"]:
attrs["valid_min"] = coord.values.min()
attrs["valid_max"] = coord.values.max()
coordinate_attributes.append("positive")
elif coordinate_label == "latitude":
attrs["valid_min"] = coord.values.min()
attrs["valid_max"] = coord.values.max()
elif coordinate_label == "longitude":
coordinate_attributes.remove("valid_min")
coordinate_attributes.remove("valid_max")
coord.attrs = _filter_attributes(attrs, coordinate_attributes)

dataset.attrs = _filter_attributes(
Expand Down

0 comments on commit 60f2558

Please sign in to comment.