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

Corrected contour generation #597

Merged
merged 2 commits into from
Sep 8, 2023
Merged

Corrected contour generation #597

merged 2 commits into from
Sep 8, 2023

Conversation

Havrevoll
Copy link
Collaborator

The for loop did only read one contour at each level, but often, (also in the example shown), there are several contours on each level, so the program must iterate over all contours and create a dictionary of polygons for each wind speed.

@ecomodeller
Copy link
Member

@Havrevoll when changes are complete, (maybe already) just ask for a review
image

Copy link
Member

@ecomodeller ecomodeller left a comment

Choose a reason for hiding this comment

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

Great.
With this change we combine two arrays and looping over two arrays at the same time can be done with the zip() function.

E.g.:

for collection, level in zip(cn.collections, contour_levels):
    for p in collection.get_paths():
        v = p.vertices
        x = v[:,0]
        y = v[:,1]
        poly = LineString([(i[0], i[1]) for i in zip(x,y)])
        if(poly.is_empty):
            print(f"{i} is empty")
        poly_list.append(dict(wind_speed = level, poly=poly))

I also realized that the GeoDataframe is missing the coordinate reference system.
image

@ecomodeller ecomodeller merged commit 6271d20 into main Sep 8, 2023
4 checks passed
@ecomodeller ecomodeller deleted the dfsu_contour_correction branch September 8, 2023 13:38
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

Successfully merging this pull request may close these issues.

2 participants