@@ -143,7 +143,8 @@ def hfix(x):
143143 missing_value = ds .attrs .get ('missing_value' )
144144 # see https://github.com/NCAS-CMS/PyActiveStorage/pull/303
145145 if isinstance (missing_value , np .ndarray ):
146- missing_value = missing_value [0 ]
146+ if missing_value .size == 1 :
147+ missing_value = missing_value [0 ]
147148 valid_min = hfix (ds .attrs .get ('valid_min' ))
148149 valid_max = hfix (ds .attrs .get ('valid_max' ))
149150 valid_range = hfix (ds .attrs .get ('valid_range' ))
@@ -519,21 +520,22 @@ def _from_storage(self, ds, indexer, chunks, out_shape, out_dtype,
519520 # Create a shared session object.
520521 if self .interface_type == "s3" and self ._version == 2 :
521522 if self .storage_options is not None :
522- key , secret = None , None
523523 if self .storage_options .get ("anon" , None ) is True :
524524 print ("Reductionist session for Anon S3 bucket." )
525525 session = reductionist .get_session (
526526 None , None , S3_ACTIVE_STORAGE_CACERT )
527- if "key" in self .storage_options :
528- key = self .storage_options ["key" ]
529- if "secret" in self .storage_options :
530- secret = self .storage_options ["secret" ]
531- if key and secret :
532- session = reductionist .get_session (
533- key , secret , S3_ACTIVE_STORAGE_CACERT )
534527 else :
535- session = reductionist .get_session (
536- S3_ACCESS_KEY , S3_SECRET_KEY , S3_ACTIVE_STORAGE_CACERT )
528+ key , secret = None , None
529+ if "key" in self .storage_options :
530+ key = self .storage_options ["key" ]
531+ if "secret" in self .storage_options :
532+ secret = self .storage_options ["secret" ]
533+ if key and secret :
534+ session = reductionist .get_session (
535+ key , secret , S3_ACTIVE_STORAGE_CACERT )
536+ else :
537+ session = reductionist .get_session (
538+ S3_ACCESS_KEY , S3_SECRET_KEY , S3_ACTIVE_STORAGE_CACERT )
537539 else :
538540 session = reductionist .get_session (S3_ACCESS_KEY ,
539541 S3_SECRET_KEY ,
0 commit comments