Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when using mizutil.to_bmorph function without met data #98

Open
nmizukami opened this issue Mar 27, 2023 · 0 comments
Open

Error when using mizutil.to_bmorph function without met data #98

nmizukami opened this issue Mar 27, 2023 · 0 comments

Comments

@nmizukami
Copy link

I would like to execute to_bmorph function without met_hru data. met_hru in mizutil.to_bmorph is optional. When I execute this without met_hru:

yakima_met_seg = mizutil.to_bmorph(yakima_topo, routed=yakima_raw, reference=yakima_ref, fill_method='r2')

it complains here:

File ~/model/bmorph/bmorph/util/mizuroute_utils.py:997, in to_bmorph(topo, routed, reference, met_hru, route_var, fill_method, min_kge)
    994 met_vars = set(met_hru.variables.keys()) - set(met_hru.coords)
    996 # Remap any meteorological data from hru to stream segment
--> 997 met_seg = map_met_hru_to_seg(met_hru, topo)
    998 # flag whether each seg has an
    999 # hru or not as a requirement for bias correction
   1000 hru_2_seg = topo['seg_hru_id'].values

File ~/model/bmorph/bmorph/util/mizuroute_utils.py:910, in map_met_hru_to_seg(met_hru, topo)
    906 # Map from hru -> segment for met data
    907 # In case a segment is not assigned an hru,
    908 # nan fills the place of any conditioning data
    909 segs_without_hrus = []
--> 910 for seg in met_seg['seg'].values:
    911     subset = np.argwhere(hru_2_seg == seg).flatten()
    912     if not len(subset):

met_seg does not 'seg' key value. line 994 set operation gives empty set if you do not provide met_hru. I am not sure if I am missing or misunderstand something, but any thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant