hydroframe / subsettools

Subsetting tools and utilities for ParFlow hydrological modeling
https://hydroframesubsettools.readthedocs.io/en/latest/
MIT License
2 stars 2 forks source link

unpredictable behavior for coastal HUC subsets #68

Closed reedmaxwell closed 5 months ago

reedmaxwell commented 8 months ago

Hi Awesome SubsetTools team-

I'm getting inconsistent behavior when subsetting coastal HUC8 domains. I ran some tests along California and some HUCs (e.g. 18060006) work fine and others (e.g. 18060009) throw the following error ValueError: The area defined by the provided HUCs is not part of the conus2 grid.

complete error info below, the scripts are from the examples and are identical except for the HUC selection. Perhaps there's a way to conduct a test where all the HUC8's over the CONUS are pulled or something?

thanks!


ValueError Traceback (most recent call last) Cell In[15], line 1 ----> 1 ij_bounds = st.huc_to_ij(huc_list=huc_list, grid=grid) 2 print("ij_bound returns [imin, jmin, imax, jmax]") 3 print(f"bounding box: {ij_bounds}")

File [.../subsettools/subsettools.py:57), in huc_to_ij(huc_list, grid) 55 conushucs, , indices_j, indices_i = _get_conus_hucs_indices(huc_list, grid.lower()) 56 if indices_i.size == 0 or indices_j.size == 0: ---> 57 raise ValueError(f"The area defined by the provided HUCs is not part of the {grid} grid.")
58 return _indices_to_ij(conus_hucs, indices_j, indices_i)

gartavanis commented 5 months ago

This turned out to be a hf_hydrodata issue and has been fixed now. Data returned are masked with the HUC mask file, ensuring no ocean is returned.