Comments (3)
Turns out shapely polygons have an orient
method (thanks to @asteiker for sharing that!)
from icepyx.
Points reordering should be simple to implement with some math like this: https://stackoverflow.com/questions/51074984/sorting-according-to-clockwise-point-coordinates/51075469. I can try tonight and see if it works..
from icepyx.
I did a quick hack today,
from shapely.geometry import Point,Polygon
import numpy as np
def sort_cord_clockwise(reg_a_poly):
# this assumes that the first and last coordinate tuples are the same..
poly = Polygon(reg_a_poly)
cx,cy = [poly.centroid.xy[0][0],poly.centroid.xy[1][0]]
xy_sort = (sorted(reg_a_poly[:-1], key = lambda x: np.arctan2((x[1]-cy),(x[0]-cx))))
#this returns counterclockwise
xy_sorted = list(reversed(xy_sort[1:]))
xy_sorted.append(reg_a_poly[-1])
out_xy = [reg_a_poly[-1]]+xy_sorted
return list(out_xy)
Input: sort_cord_clockwise([(-64, 66),(-55, 72),(-55, 66),(-64, 72),(-64, 66)])
Out: [(-64, 66), (-64, 72), (-55, 72), (-55, 66), (-64, 66)]
Input: sort_cord_clockwise([(-64, 66),(-55, 66),(-64, 72),(-55, 72),(-64, 66)])
Out: (-64, 66), (-64, 72), (-55, 72), (-55, 66), (-64, 66)]
@JessicaS11, Can you check with other problematic inputs, specifically for which you got this error. You can also pass those inputs to me and I can check and refine..
from icepyx.
Related Issues (20)
- improve Zenodo releases
- EarthData authentication HOT 1
- improve temporal module
- No display when trying to visualize ATL06 elevations
- ATL06 r_eff read error HOT 1
- Modularizing authentication HOT 1
- add some projection handling and checks
- debug tests behind EDL - failing builds for PRs to main HOT 1
- do not run uml updates on PRs into main
- Make Variables an independent class HOT 1
- Unable to call Argo scripts with Quest query object HOT 2
- calls to OpenAltimetry API time out HOT 1
- Intermittent Error on order_granules
- ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it HOT 2
- ValueError: cannot reindex or align along dimension 'delta_time' because of conflicting dimension sizes: {1112, 1098} HOT 2
- icepyx required variables
- only add requested beams for required variables
- improve QUEST documentation HOT 2
- figure out where the codecov reports went HOT 2
- become PEP8 compliant HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from icepyx.