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

Geopandas v1.0.0. #162

Merged
merged 8 commits into from
Jul 2, 2024
Merged

Geopandas v1.0.0. #162

merged 8 commits into from
Jul 2, 2024

Conversation

felicio93
Copy link
Collaborator

Updating our scripts use geopandas 1.0.0

@felicio93
Copy link
Collaborator Author

felicio93 commented Jul 1, 2024

I fixed all the unary_union calls, but we still have this:

This is the function that is failing:
image

and this is the error message:
image

I could be wrong, but it seems that the problem is coming from the deprecated io.to_file, used by pyogrio:
image

If that is the case, we might want to wait pyogrio to be updated.
@SorooshMani-NOAA, is this correct?

@SorooshMani-NOAA
Copy link
Collaborator

@felicio93 it doesn't seem like an issue with the deprecated functions. Note that the functions that are deprecated are module functions, but you're using the class methods to write.

This looks like an issue related to writing a file vs folder. Maybe in the latest implementation you cannot specify a directory for the output of a geopandas dataframe and instead need to specify a file, or something along those lines. Or maybe we cannot specify an existing as a target for writing geopandas dataframe. Please check different combinations with the latest geopandas locally and see which one fails which one doesn't. I hope this helps

@felicio93
Copy link
Collaborator Author

Yes! you are right. I tested .to_file using the old and new geopandas versions.

If the folder already exists and you try to use to_file with just the path to the folder:
The old one allows for saving the file. It saves all files as nameless.
The new one does not allow that, only if you use "append" mode, instead of overwrite (default).

If the directory does not exist:
Both, old and new versions, create the new directory and save the files as nameless.

if you give the the path to the file, both versions will overwrite (or append) as expected.

For the test, I will just change it to append mode. That should keep the validity of the test while passing it.

tests ctor args 4 and 6

mode='a' added to gpd.to_file
added  /  to Path(tdir)
@felicio93
Copy link
Collaborator Author

felicio93 commented Jul 2, 2024

I tried multiple things here. And the functions do work as expected for the new versions.
The one thing that does not seem to work, is to write a folder to memory (files work, folder don't).

in the test we have:

with tempfile.TemporaryDirectory() as tdir:
shape_path = tdir

If I hard code the folder path, it works just fine. But for the tempdir it does not.

I found this recent issue on pyogrio that seems to be related to this.

@SorooshMani-NOAA
Copy link
Collaborator

Would it work if you do the following?

with tempfile.TemporaryDirectory() as tdir:
    shape_path = tdir + "/mysubdir"

@felicio93
Copy link
Collaborator Author

It does on my local!

tdir + "/mysubdir"
@SorooshMani-NOAA
Copy link
Collaborator

@felicio93 it seems the latest change works ... the issue of one test is that it's using the latest scipy which is not supported on Python 3.9: https://docs.scipy.org/doc/scipy-1.14.0/release/1.14.0-notes.html

@felicio93
Copy link
Collaborator Author

Yes, it is all working now, thanks again Soroosh.

I see, what is your recommendation for this one test then?

@SorooshMani-NOAA
Copy link
Collaborator

I don't know why it tries to install the latest scipy ... I don't have any suggestions, maybe we can drop Py3.9 as well?! But ideally not ... maybe you can try to run the setup locally on py3.9 and see why it fails. You can also ignore that specific test for now and later address it (just create the ticket now)

@felicio93 felicio93 marked this pull request as ready for review July 2, 2024 20:29
@felicio93
Copy link
Collaborator Author

Merging this version.

Ticket for Run geom build test, python 3.9 FAIL here: #163

@felicio93 felicio93 merged commit 38f3ac4 into noaa-ocs-modeling:main Jul 2, 2024
9 of 10 checks passed
@felicio93 felicio93 deleted the gpd_v100 branch August 14, 2024 19:26
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