-
Notifications
You must be signed in to change notification settings - Fork 44
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
Copy spatial_partitions
when copying GeoDataFrame
#55
Comments
Yes, I agree that would certainly be expected to be propagated to the copy.
I suspect there will be other methods as well where we need to fix this.
On the short term, I think your proposed fix of overriding the method like
that is fine (maybe just copy the actual spatial_partitions as well). PR
certainly welcome!
Long term it would be good to have a nicer way to have the spatial
paritions copied over, but probably something to discuss with the dask team
what this could look like.
Op za 12 jun. 2021 12:10 schreef Dahn ***@***.***>:
… I would expect the spatial_partitions to be copied when using df.copy().
import geopandasimport daskimport dask_geopandasdask.config.set(scheduler='single-threaded')
df = geopandas.read_file(geopandas.datasets.get_path("naturalearth_lowres"))ddf = dask_geopandas.from_geopandas(df, npartitions=4)ddf.calculate_spatial_partitions()ddfc = ddf.copy()ddfc.spatial_partitions # is None
Is there a reason to not copy spatial partitions that I didn't think of?
I thought about how this could work and didn't think of anything better
than overriding dask's copy method. Something like
def copy(self):
self_copy = super().copy()
self_copy.spatial_partitions = self.spatial_partitions
return self_copy
It would be great if spatial_partitions could get copied automatically,
as crs for example does. However, crs is actually a property of _meta,
which does get automatically copied by dask. Not sure how spatial
partitions could be attached to the _meta, or if there's another
mechanism that could act similarly.
If I'm headed in the right direction, then I'm happy to unit test & PR.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#55>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAHZEUFSTGBLCCWHJWKMHYTTSMXCZANCNFSM46STCMDA>
.
|
DahnJ
added a commit
to DahnJ/dask-geopandas
that referenced
this issue
Jun 15, 2021
This is possibly only a short-term solution, see discussion at geopandas#55
Closed by #56 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I would expect the
spatial_partitions
to be copied when usingdf.copy()
.Is there a reason to not copy spatial partitions that I didn't think of?
I thought about how this could work and didn't think of anything better than overriding dask's
copy
method. Something likeIt would be great if
spatial_partitions
could get copied automatically, ascrs
for example does. However,crs
is actually a property of_meta
, which does get automatically copied by dask. Not sure how spatial partitions could be attached to the_meta
, or if there's another mechanism that could act similarly.If I'm headed in the right direction, then I'm happy to unit test & PR.
The text was updated successfully, but these errors were encountered: