3636
3737
3838class PydapArrayWrapper (BackendArray ):
39- def __init__ (self , array , batch = False , cache = None ):
39+ def __init__ (self , array , batch = False , cache = None , checksums = True ):
4040 self .array = array
4141 self ._batch = batch
4242 self ._cache = cache
43+ self ._checksums = checksums
4344
4445 @property
4546 def shape (self ) -> tuple [int , ...]:
@@ -63,7 +64,7 @@ def _getitem(self, key):
6364 from pydap .lib import resolve_batch_for_all_variables
6465
6566 dataset = self .array .dataset
66- resolve_batch_for_all_variables (self .array , key )
67+ resolve_batch_for_all_variables (self .array , key , checksums = self . _checksums )
6768 result = np .asarray (
6869 dataset ._current_batch_promise .wait_for_result (self .array .id )
6970 )
@@ -98,7 +99,15 @@ class PydapDataStore(AbstractDataStore):
9899 be useful if the netCDF4 library is not available.
99100 """
100101
101- def __init__ (self , dataset , group = None , session = None , batch = False , protocol = None ):
102+ def __init__ (
103+ self ,
104+ dataset ,
105+ group = None ,
106+ session = None ,
107+ batch = False ,
108+ protocol = None ,
109+ checksums = True ,
110+ ):
102111 """
103112 Parameters
104113 ----------
@@ -113,6 +122,7 @@ def __init__(self, dataset, group=None, session=None, batch=False, protocol=None
113122 self ._batch_done = False
114123 self ._array_cache = {} # holds 1D dimension data
115124 self ._protocol = protocol
125+ self ._checksums = checksums # true by default
116126
117127 @classmethod
118128 def open (
@@ -126,6 +136,7 @@ def open(
126136 verify = None ,
127137 user_charset = None ,
128138 batch = False ,
139+ checksums = True ,
129140 ):
130141 from pydap .client import open_url
131142 from pydap .net import DEFAULT_TIMEOUT
@@ -157,6 +168,7 @@ def open(
157168 # pydap dataset
158169 dataset = url .ds
159170 args = {"dataset" : dataset }
171+ args ["checksums" ] = checksums
160172 if group :
161173 args ["group" ] = group
162174 if url .startswith (("http" , "dap2" )):
@@ -202,7 +214,7 @@ def open_store_variable(self, var):
202214 else :
203215 # all non-dimension variables
204216 data = indexing .LazilyIndexedArray (
205- PydapArrayWrapper (var , self ._batch , self ._array_cache )
217+ PydapArrayWrapper (var , self ._batch , self ._array_cache , self . _checksums )
206218 )
207219
208220 return Variable (dimensions , data , var .attributes )
@@ -256,7 +268,9 @@ def _get_data_array(self, var):
256268
257269 if not self ._batch_done or var .id not in self ._array_cache :
258270 # store all dim data into a dict for reuse
259- self ._array_cache = get_batch_data (var .parent , self ._array_cache )
271+ self ._array_cache = get_batch_data (
272+ var .parent , self ._array_cache , self ._checksums
273+ )
260274 self ._batch_done = True
261275
262276 return self ._array_cache [var .id ]
@@ -305,6 +319,7 @@ def open_dataset(
305319 verify = None ,
306320 user_charset = None ,
307321 batch = False ,
322+ checksums = True ,
308323 ) -> Dataset :
309324 store = PydapDataStore .open (
310325 url = filename_or_obj ,
@@ -316,6 +331,7 @@ def open_dataset(
316331 verify = verify ,
317332 user_charset = user_charset ,
318333 batch = batch ,
334+ checksums = checksums ,
319335 )
320336 store_entrypoint = StoreBackendEntrypoint ()
321337 with close_on_error (store ):
@@ -349,6 +365,7 @@ def open_datatree(
349365 verify = None ,
350366 user_charset = None ,
351367 batch = False ,
368+ checksums = True ,
352369 ) -> DataTree :
353370 groups_dict = self .open_groups_as_dict (
354371 filename_or_obj ,
@@ -366,6 +383,7 @@ def open_datatree(
366383 verify = application ,
367384 user_charset = user_charset ,
368385 batch = batch ,
386+ checksums = checksums ,
369387 )
370388
371389 return datatree_from_dict_with_io_cleanup (groups_dict )
@@ -388,6 +406,7 @@ def open_groups_as_dict(
388406 verify = None ,
389407 user_charset = None ,
390408 batch = False ,
409+ checksums = True ,
391410 ) -> dict [str , Dataset ]:
392411 from xarray .core .treenode import NodePath
393412
@@ -400,6 +419,7 @@ def open_groups_as_dict(
400419 verify = verify ,
401420 user_charset = user_charset ,
402421 batch = batch ,
422+ checksums = checksums ,
403423 )
404424
405425 # Check for a group and make it a parent if it exists
0 commit comments