You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am reviewing the package and giving it a try on a hydrologic unit region in Wisconsin. It appears as though the issue is with the "COLLATING RESULTS" step, and the bm_raster command fails.
Reproducibility
The bug is reproducible.
The bug is intermittent.
The bug occurs only under specific conditions.
Steps to Reproduce
List the steps to reproduce the bug.
import os
import datetime
import colorcet as cc
import contextily as cx
import geopandas
import matplotlib.pyplot as plt
import pandas as pd
from bokeh.plotting import figure, output_notebook, show
from bokeh.models import HoverTool, Title
from pynhd import WaterData
from blackmarble.extract import bm_extract
from blackmarble.raster import bm_raster
%load_ext autoreload
%autoreload 2
plt.rcParams["figure.figsize"] = (18, 10)
# An environment variable can obfuscate to secure a secret
import os
bearer = os.getenv("BLACKMARBLE_TOKEN")
gdf = WaterData('huc08').byid('huc8',['07090001'])
VNP46A2_20210205 = bm_raster(
gdf, product_id="VNP46A2", date_range="2024-02-05", bearer=bearer
)
VNP46A2_20210205
Be as detailed as possible to help with replication.
Additional Environment Details: [e.g., hardware specifications, network conditions] I am using a homebrew installed version of miniforge with python 3.12.0.
Bug Report
Description
I am reviewing the package and giving it a try on a hydrologic unit region in Wisconsin. It appears as though the issue is with the "COLLATING RESULTS" step, and the
bm_raster
command fails.Reproducibility
Steps to Reproduce
Screenshots / Error Messages (if applicable)
OSError Traceback (most recent call last)
Cell In[14], line 2
1 # Daily data: raster for February 5, 2021
----> 2 VNP46A2_20210205 = bm_raster(
3 gdf, product_id="VNP46A2", date_range="2024-02-05", bearer=bearer
4 )
5 VNP46A2_20210205
File /opt/homebrew/Caskroom/miniforge/base/envs/blackmarblepy-env/lib/python3.12/site-packages/pydantic/validate_call_decorator.py:60, in validate_call..validate..wrapper_function(*args, **kwargs)
58 @functools.wraps(function)
59 def wrapper_function(*args, **kwargs):
---> 60 return validate_call_wrapper(*args, **kwargs)
File /opt/homebrew/Caskroom/miniforge/base/envs/blackmarblepy-env/lib/python3.12/site-packages/pydantic/_internal/_validate_call.py:96, in ValidateCallWrapper.call(self, *args, **kwargs)
95 def call(self, *args: Any, **kwargs: Any) -> Any:
---> 96 res = self.pydantic_validator.validate_python(pydantic_core.ArgsKwargs(args, kwargs))
97 if self.return_pydantic_validator:
98 return self.return_pydantic_validator(res)
File /opt/homebrew/Caskroom/miniforge/base/envs/blackmarblepy-env/lib/python3.12/site-packages/blackmarble/raster.py:357, in bm_raster(gdf, product_id, date_range, bearer, variable, drop_values_by_quality_flag, check_all_tiles_exist, output_directory, output_skip_if_exists)
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/homebrew/Caskroom/miniforge/base/envs/blackmarblepy-env/lib/python3.12/site-packages/blackmarble/raster.py:177, in h5_to_geotiff(f, variable, drop_values_by_quality_flag, output_directory)
174 if variable is None:
175 variable = VARIABLE_DEFAULT.get(product_id)
--> 177 with h5py.File(f, "r") as h5_data:
178 attrs = h5_data.attrs
179 data_field_key = "HDFEOS/GRIDS/VNP_Grid_DNB/Data Fields"
File /opt/homebrew/Caskroom/miniforge/base/envs/blackmarblepy-env/lib/python3.12/site-packages/h5py/_hl/files.py:561, in File.init(self, name, mode, driver, libver, userblock_size, swmr, rdcc_nslots, rdcc_nbytes, rdcc_w0, track_order, fs_strategy, fs_persist, fs_threshold, fs_page_size, page_buf_size, min_meta_keep, min_raw_keep, locking, alignment_threshold, alignment_interval, meta_block_size, **kwds)
552 fapl = make_fapl(driver, libver, rdcc_nslots, rdcc_nbytes, rdcc_w0,
553 locking, page_buf_size, min_meta_keep, min_raw_keep,
554 alignment_threshold=alignment_threshold,
555 alignment_interval=alignment_interval,
556 meta_block_size=meta_block_size,
557 **kwds)
558 fcpl = make_fcpl(track_order=track_order, fs_strategy=fs_strategy,
559 fs_persist=fs_persist, fs_threshold=fs_threshold,
560 fs_page_size=fs_page_size)
--> 561 fid = make_fid(name, mode, userblock_size, fapl, fcpl, swmr=swmr)
563 if isinstance(libver, tuple):
564 self._libver = libver
File /opt/homebrew/Caskroom/miniforge/base/envs/blackmarblepy-env/lib/python3.12/site-packages/h5py/_hl/files.py:235, in make_fid(name, mode, userblock_size, fapl, fcpl, swmr)
233 if swmr and swmr_support:
234 flags |= h5f.ACC_SWMR_READ
--> 235 fid = h5f.open(name, flags, fapl=fapl)
236 elif mode == 'r+':
237 fid = h5f.open(name, h5f.ACC_RDWR, fapl=fapl)
File h5py/_objects.pyx:54, in h5py._objects.with_phil.wrapper()
File h5py/_objects.pyx:55, in h5py._objects.with_phil.wrapper()
File h5py/h5f.pyx:102, in h5py.h5f.open()
OSError: Unable to open file (file signature not found)
Environment
Additional Context
My mamba environment contains the following:
Possible Fix
If you have suggestions for a fix, please describe them here.
The text was updated successfully, but these errors were encountered: