rather than assume that 'hru' is a part of the dataset that can be matched in order & dimension with the shapefile features (eg polygons), request a join index (ie 'hruId') argument that has to be matchable in both datasets, and trim/reorder both inputs (data, shape) to match. this would allow for either data or shapefile to be missing elements. note that the index might be of a different type in the data versus the shapefile (ie int versus string), and that might have be handled by converting them to a common type.