File /opt/anaconda3/lib/python3.11/site-packages/blackmarble/raster.py:357, in (.0)
351 filenames = _pivot_paths_by_date(pathnames).get(date)
353 try:
354 # Open each GeoTIFF file as a DataArray and store in a list
355 da = [
356 rioxarray.open_rasterio(
--> 357 h5_to_geotiff(
358 f,
359 variable=variable,
360 drop_values_by_quality_flag=drop_values_by_quality_flag,
361 output_directory=d,
362 ),
363 )
364 for f in filenames
365 ]
366 ds = merge_arrays(da)
367 clipped_dataset = ds.rio.clip(
368 gdf.geometry.apply(mapping), gdf.crs, drop=True
369 )
KeyError: "Unable to open object (object 'Mandatory_Quality_Flag' doesn't exist)”
Here is the function I am using (a similar format to the one available on the BlackMarblePy tutorial page):
lights_data= bm_extract( gdf, product_id ="VNP46A1", date_range = "2024-10-07", bearer=bearer, aggfunc=["mean"] )
Below is the full error message:
File /opt/anaconda3/lib/python3.11/site-packages/blackmarble/raster.py:357, in(.0)
351 filenames = _pivot_paths_by_date(pathnames).get(date)
353 try:
354 # Open each GeoTIFF file as a DataArray and store in a list
355 da = [
356 rioxarray.open_rasterio(
--> 357 h5_to_geotiff(
358 f,
359 variable=variable,
360 drop_values_by_quality_flag=drop_values_by_quality_flag,
361 output_directory=d,
362 ),
363 )
364 for f in filenames
365 ]
366 ds = merge_arrays(da)
367 clipped_dataset = ds.rio.clip(
368 gdf.geometry.apply(mapping), gdf.crs, drop=True
369 )
File /opt/anaconda3/lib/python3.11/site-packages/blackmarble/raster.py:189, in h5_to_geotiff(f, variable, drop_values_by_quality_flag, output_directory) 182 dataset = h5_data[data_field_key][variable] 183 left, bottom, right, top = ( 184 attrs.get("WestBoundingCoord"), 185 attrs.get("SouthBoundingCoord"), 186 attrs.get("EastBoundingCoord"), 187 attrs.get("NorthBoundingCoord"), 188 ) --> 189 qf = h5_data[data_field_key]["Mandatory_Quality_Flag"] 190 else: 191 data_field_key = "HDFEOS/GRIDS/VIIRS_Grid_DNB_2d/Data Fields"
File h5py/_objects.pyx:54, in h5py._objects.with_phil.wrapper()
File h5py/_objects.pyx:55, in h5py._objects.with_phil.wrapper()
File /opt/anaconda3/lib/python3.11/site-packages/h5py/_hl/group.py:357, in Group.getitem(self, name) 355 raise ValueError("Invalid HDF5 object reference") 356 elif isinstance(name, (bytes, str)): --> 357 oid = h5o.open(self.id, self._e(name), lapl=self._lapl) 358 else: 359 raise TypeError("Accessing a group is done with bytes or str, " 360 "not {}".format(type(name)))
File h5py/_objects.pyx:54, in h5py._objects.with_phil.wrapper()
File h5py/_objects.pyx:55, in h5py._objects.with_phil.wrapper()
File h5py/h5o.pyx:257, in h5py.h5o.open()
KeyError: "Unable to open object (object 'Mandatory_Quality_Flag' doesn't exist)”