@@ -783,18 +783,13 @@ def ds(self):
783
783
return self .zarr_group
784
784
785
785
def open_store_variable (self , name ):
786
- print (f"DEBUG OPEN: Reading variable '{ name } '" )
787
786
zarr_array = self .members [name ]
788
- print (
789
- f"DEBUG OPEN: zarr_array.dtype={ zarr_array .dtype } , fill_value={ zarr_array .fill_value } "
790
- )
791
787
data = indexing .LazilyIndexedArray (ZarrArrayWrapper (zarr_array ))
792
788
try_nczarr = self ._mode == "r"
793
789
dimensions , attributes = _get_zarr_dims_and_attrs (
794
790
zarr_array , DIMENSION_KEY , try_nczarr
795
791
)
796
792
attributes = dict (attributes )
797
- print (f"DEBUG OPEN: Original attributes: { attributes } " )
798
793
799
794
encoding = {
800
795
"chunks" : zarr_array .chunks ,
@@ -819,37 +814,18 @@ def open_store_variable(self, name):
819
814
}
820
815
)
821
816
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
-
827
817
if self ._use_zarr_fill_value_as_mask :
828
818
# Setting this attribute triggers CF decoding for missing values
829
819
# 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 } " )
833
820
if zarr_array .fill_value is not None :
834
821
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 ("===========" )
839
822
elif "_FillValue" in attributes :
840
823
# TODO update version check for the released version with dtypes
841
824
# probably be 3.1
842
825
import zarr
843
826
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
-
850
827
if Version (zarr .__version__ ) >= Version ("3.0.6" ):
851
828
native_dtype = zarr_array .metadata .data_type .to_native_dtype ()
852
- print (f"DEBUG: native_dtype: { native_dtype } " )
853
829
attributes ["_FillValue" ] = (
854
830
# Use the new dtype infrastructure instead of doing xarray
855
831
# specific fill value decoding
@@ -860,17 +836,11 @@ def open_store_variable(self, name):
860
836
)
861
837
else :
862
838
dtype_value = zarr_array .metadata .data_type .value
863
- print (f"DEBUG: dtype_value: { dtype_value } " )
864
839
attributes ["_FillValue" ] = FillValueCoder .decode (
865
840
attributes ["_FillValue" ], dtype_value
866
841
)
867
842
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 } " )
872
843
variable = Variable (dimensions , data , attributes , encoding )
873
- print (f"DEBUG OPEN: Created variable '{ name } ' with dtype: { variable .dtype } " )
874
844
875
845
return variable
876
846
@@ -987,36 +957,23 @@ def store(
987
957
variables_encoded , attributes = self .encode (
988
958
{vn : variables [vn ] for vn in new_variable_names }, attributes
989
959
)
990
- print ("HERE" )
991
960
992
961
if existing_variable_names :
993
962
# We make sure that values to be appended are encoded *exactly*
994
963
# as the current values in the store.
995
964
# To do so, we decode variables directly to access the proper encoding,
996
965
# without going via xarray.Dataset to avoid needing to load
997
966
# index variables into memory.
998
- print (
999
- f"DEBUG APPEND: Processing existing variables: { existing_variable_names } "
1000
- )
1001
967
store_vars = {
1002
968
k : self .open_store_variable (name = k ) for k in existing_variable_names
1003
969
}
1004
- print (
1005
- f"DEBUG APPEND: Store vars dtypes: { [(name , var .dtype ) for name , var in store_vars .items ()]} "
1006
- )
1007
970
1008
971
existing_vars , _ , _ = conventions .decode_cf_variables (
1009
972
variables = store_vars ,
1010
973
# attributes = {} since we don't care about parsing the global
1011
974
# "coordinates" attribute
1012
975
attributes = {},
1013
976
)
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
- )
1020
977
# Modified variables must use the same encoding as the store.
1021
978
vars_with_encoding = {}
1022
979
for vn in existing_variable_names :
0 commit comments