pfmc-assessments / indexwc

Estimate indices of abundance for west coast fish species
2 stars 1 forks source link

[BUG]: boundaries being incorrectly removed for boundaries that do not include a portion of all states #33

Open chantelwetzel-noaa opened 5 months ago

chantelwetzel-noaa commented 5 months ago

Is there an existing issue for this?

Current Behavior

I was trying to run an index for only the area south of 40.10 N. latitude and kept getting an error from the filter_boundaries function. When I investigated the filter_boundaries function looked for boundaries in Washington and then Oregon which were not included in the data I was passing resulting in the default coastwide boundary being cleared out.

Expected Behavior

I added a check that kept the boundaries data frame from being cleared out if an area was not present here 7d195207509ff02f482e75abc3fa1ad21a82b245. I suspect this check can be done more elegantly but wanted to offer a basic suggestion to start from.

Steps To Reproduce

No response

Environment

- OS:
- Node:
- npm:

Anything else?

No response

kellijohnson-NOAA commented 5 months ago

Thanks @chantelwetzel-noaa for this and the code to fix it. I am going to wait a tiny bit to merge this in to think about if my original logic is the best way to do this or if there is a more simple way to go about this such as just looking to the list of boundaries that are passed and determine if they are valid rather than looking to each boundary. Also, sorry that I introduced this bug in the first place. If you have any other ideas beyond your current fix that would be ideal please feel free to let me know.