Skip to content

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

@nmizukami

Description

@nmizukami

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions