Closed mbauer288 closed 7 months ago
ok. There seem to be multiple issues going on. You project the points to LambertAziumthalEqual area. Therefore, all the subsequent geometries are in this projection. When you bootstrap the gdf, you'll need to tell it and set the CRS to polar_crs
, rather than geod_crs
.
geopandas.GeoDataFrame(df_dict, crs=polar_crs, geometry=vert_polys)
Next, you cannot hand those projected coordinates to STARE. STARE knows nothing about projections and assumes all x/y coordinates are wgs84 lat/lons. Since STARE doesn't know about projections, neither does pystare. Unfortunately, STAREPandas also does not give a damn about projections as well, even though it could/should.
So before you could do a starepandas.sids_from_geoseries, you have to reproject them to WGS84 coordinates. IMO, the easiest way would be to do
usi_geo_df = usi_geo_df.set_geometry('vert_poly_geo').to_crs(4326)['geometry']
usi_geo_df.make_sids()
Or:
usi_geo_df = usi_geo_df.set_geometry('vert_poly_geo').to_crs(4326)
sids = starepandas.sids_from_geoseries(polys_pds, level=opts.mcms_q_level, convex=False, force_ccw=False, n_partitions=opts.n_parts, num_workers=opts.n_cores)
Word of caution: While multiple geometry columns are supported in geopandas, the CRS is a setting of the dataframe, not the individual column. I.e. be very very careful of having multiple geom columns with differing CRS
Uff. Ok. Your final error is actually even more curious.
Try running usi_geo_df.info()
, You will see that the columns that should hold geometries are actually type object
.
I wonder if this is a result of some I/O action where geopandas looses track.
Note the difference in the datatypes:
usi_geo_df['vert_poly_geo']
usi_geo_df.set_geometry('vert_poly_geo')['vert_poly_geo']
Since you (rightfully) did the first option, starepandas is receiving a series of strings rather than a series of geoms and barfs.
quick question: Is this issue also about inside-out polygons or just about this mixed geom problem?
Answering my own question: It would seem like all polygons are CCW; surprisingly both in LEAE projection and in plate carree space. I.e. all SIDs should be generated correctly. The Trixels should be derivable by doing the split_antimeridian trick.
I saved of a single ETC track geopandas dataframe
mcms_merra2_npac_2017_usi_tagrp_niklas.pkl
for you here is some relevant code to it's creation.After this, I try to make SIDs etc.
The first curious thing is the column
vert_poly_geo
are not shown to be in projection units when I print the mcms_tagrp_gdf.head(), so I am curious why they are projected like thegeometry
column.Here I try to find the SIDs
opts.mcms_q_level = 10
opts.n_parts = 60
opts.n_cores = 6
and here is the error.
If I set convex=True I get the same error.