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

BUG: Ignore categorical columns not in measurements #161

Merged
merged 1 commit into from
Jan 24, 2024
Merged

Conversation

snowman2
Copy link
Member

@snowman2 snowman2 commented Jan 23, 2024

@snowman2 snowman2 added the bug Something isn't working label Jan 23, 2024
@@ -63,17 +69,31 @@ def load_vector_data(
logger = get_logger()

if isinstance(vector_data, (str, os.PathLike)):
vector_data = geopandas.read_file(vector_data)
try:
vector_data = geopandas.read_file(vector_data, include_fields=measurements)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Read subset of measurements for efficiency.

if "geometry" not in vector_data.columns:

if measurements is not None:
vector_data = vector_data[measurements + [vector_data.geometry.name]]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ensure only measurements requested in dataframe.

@snowman2 snowman2 force-pushed the categorical branch 3 times, most recently from 5e21d3e to 1495ab7 Compare January 23, 2024 21:06
@snowman2 snowman2 added this to the 0.4.4 milestone Jan 23, 2024
@snowman2 snowman2 requested a review from justingruca January 23, 2024 21:17
Copy link

codecov bot commented Jan 23, 2024

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (bf265e4) 97.03% compared to head (1e5b4d4) 96.23%.

Files Patch % Lines
geocube/vector_to_cube.py 91.42% 3 Missing ⚠️
geocube/geo_utils/geobox.py 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #161      +/-   ##
==========================================
- Coverage   97.03%   96.23%   -0.80%     
==========================================
  Files          14       14              
  Lines         439      452      +13     
==========================================
+ Hits          426      435       +9     
- Misses         13       17       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@snowman2 snowman2 merged commit 94bb9d9 into master Jan 24, 2024
16 of 17 checks passed
@snowman2 snowman2 deleted the categorical branch January 24, 2024 15:31
@snowman2
Copy link
Member Author

Thanks @justingruca 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Subsequent call to make_geocube for a second categorical variable fails with KeyError
2 participants