Skip to content

Commit 3df4253

Browse files
committed
remove debug statements
1 parent a862253 commit 3df4253

File tree

2 files changed

+1
-43
lines changed

2 files changed

+1
-43
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ io = [
4545
"cftime",
4646
"pooch",
4747
]
48+
# "zarr @ git+https://github.com/zarr-developers/zarr-python.git",
4849
etc = ["sparse>=0.15"]
4950
parallel = ["dask[complete]"]
5051
viz = ["cartopy>=0.23", "matplotlib", "nc-time-axis", "seaborn"]

xarray/backends/zarr.py

Lines changed: 0 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -783,18 +783,13 @@ def ds(self):
783783
return self.zarr_group
784784

785785
def open_store_variable(self, name):
786-
print(f"DEBUG OPEN: Reading variable '{name}'")
787786
zarr_array = self.members[name]
788-
print(
789-
f"DEBUG OPEN: zarr_array.dtype={zarr_array.dtype}, fill_value={zarr_array.fill_value}"
790-
)
791787
data = indexing.LazilyIndexedArray(ZarrArrayWrapper(zarr_array))
792788
try_nczarr = self._mode == "r"
793789
dimensions, attributes = _get_zarr_dims_and_attrs(
794790
zarr_array, DIMENSION_KEY, try_nczarr
795791
)
796792
attributes = dict(attributes)
797-
print(f"DEBUG OPEN: Original attributes: {attributes}")
798793

799794
encoding = {
800795
"chunks": zarr_array.chunks,
@@ -819,37 +814,18 @@ def open_store_variable(self, name):
819814
}
820815
)
821816

822-
print(
823-
f"DEBUG OPEN: _use_zarr_fill_value_as_mask={self._use_zarr_fill_value_as_mask}"
824-
)
825-
print(f"DEBUG OPEN: '_FillValue' in attributes: {'_FillValue' in attributes}")
826-
827817
if self._use_zarr_fill_value_as_mask:
828818
# Setting this attribute triggers CF decoding for missing values
829819
# by interpreting Zarr's fill_value to mean the same as netCDF's _FillValue
830-
print(f"DEBUG OPEN: Using zarr fill_value as mask for '{name}'")
831-
print("===========")
832-
print(f"DEBUG DTYPE: zarr array fill value: {zarr_array.fill_value.dtype}")
833820
if zarr_array.fill_value is not None:
834821
attributes["_FillValue"] = zarr_array.fill_value
835-
print(
836-
f"\t DEBUG OPEN: Set _FillValue to {zarr_array.fill_value} for '{name}'"
837-
)
838-
print("===========")
839822
elif "_FillValue" in attributes:
840823
# TODO update version check for the released version with dtypes
841824
# probably be 3.1
842825
import zarr
843826

844-
print(f"DEBUG: Processing _FillValue for {name}")
845-
print(f"DEBUG: Original _FillValue: {attributes['_FillValue']}")
846-
print(
847-
f"DEBUG: zarr_array.metadata.data_type: {zarr_array.metadata.data_type}"
848-
)
849-
850827
if Version(zarr.__version__) >= Version("3.0.6"):
851828
native_dtype = zarr_array.metadata.data_type.to_native_dtype()
852-
print(f"DEBUG: native_dtype: {native_dtype}")
853829
attributes["_FillValue"] = (
854830
# Use the new dtype infrastructure instead of doing xarray
855831
# specific fill value decoding
@@ -860,17 +836,11 @@ def open_store_variable(self, name):
860836
)
861837
else:
862838
dtype_value = zarr_array.metadata.data_type.value
863-
print(f"DEBUG: dtype_value: {dtype_value}")
864839
attributes["_FillValue"] = FillValueCoder.decode(
865840
attributes["_FillValue"], dtype_value
866841
)
867842

868-
print(f"DEBUG: Decoded _FillValue: {attributes['_FillValue']}")
869-
print(f"DEBUG: Decoded _FillValue type: {type(attributes['_FillValue'])}")
870-
871-
print(f"DEBUG OPEN: Final attributes for '{name}': {attributes}")
872843
variable = Variable(dimensions, data, attributes, encoding)
873-
print(f"DEBUG OPEN: Created variable '{name}' with dtype: {variable.dtype}")
874844

875845
return variable
876846

@@ -987,36 +957,23 @@ def store(
987957
variables_encoded, attributes = self.encode(
988958
{vn: variables[vn] for vn in new_variable_names}, attributes
989959
)
990-
print("HERE")
991960

992961
if existing_variable_names:
993962
# We make sure that values to be appended are encoded *exactly*
994963
# as the current values in the store.
995964
# To do so, we decode variables directly to access the proper encoding,
996965
# without going via xarray.Dataset to avoid needing to load
997966
# index variables into memory.
998-
print(
999-
f"DEBUG APPEND: Processing existing variables: {existing_variable_names}"
1000-
)
1001967
store_vars = {
1002968
k: self.open_store_variable(name=k) for k in existing_variable_names
1003969
}
1004-
print(
1005-
f"DEBUG APPEND: Store vars dtypes: {[(name, var.dtype) for name, var in store_vars.items()]}"
1006-
)
1007970

1008971
existing_vars, _, _ = conventions.decode_cf_variables(
1009972
variables=store_vars,
1010973
# attributes = {} since we don't care about parsing the global
1011974
# "coordinates" attribute
1012975
attributes={},
1013976
)
1014-
print(
1015-
f"DEBUG APPEND: After CF decode dtypes: {[(name, var.dtype) for name, var in existing_vars.items()]}"
1016-
)
1017-
print(
1018-
f"DEBUG APPEND: Variables to append dtypes: {[(name, var.dtype) for name, var in variables_encoded.items() if name in existing_variable_names]}"
1019-
)
1020977
# Modified variables must use the same encoding as the store.
1021978
vars_with_encoding = {}
1022979
for vn in existing_variable_names:

0 commit comments

Comments
 (0)