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

Update workflow to latest geopandas and fiona #1262

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

davide-f
Copy link
Member

Closes # (if applicable).

Changes proposed in this Pull Request

It add a minor fix to enable the update of geopandas and fiona versions

Checklist

  • I consent to the release of this PR's code under the AGPLv3 license and non-code contributions under CC0-1.0 and CC-BY-4.0.
  • I tested my contribution locally and it seems to work fine.
  • Code and workflow changes are sufficiently documented.
  • Newly introduced dependencies are added to envs/environment.yaml and doc/requirements.txt.
  • Changes in configuration options are added in all of config.default.yaml and config.tutorial.yaml.
  • Add a test config or line additions to test/ (note tests are changing the config.tutorial.yaml)
  • Changes in configuration options are also documented in doc/configtables/*.csv and line references are adjusted in doc/configuration.rst and doc/tutorial.rst.
  • A note for the release notes doc/release_notes.rst is amended in the format of previous release notes, including reference to the requested PR.

commit a220390
Author: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Date:   Mon Dec 23 19:39:49 2024 +0000

    [pre-commit.ci] auto fixes from pre-commit.com hooks

    for more information, see https://pre-commit.ci

commit 6bff954
Author: davide-f <67809479+davide-f@users.noreply.github.com>
Date:   Mon Dec 23 19:39:35 2024 +0000

    Update pinned environment files for all platforms
@davide-f
Copy link
Member Author

davide-f commented Dec 23, 2024

@ekatef , the update of the environment is possible but requires the minor changes added here.
They have effect to #845, but it is minimal and can be considered.

It is advisable to ensure no issues are created to linopy, otherwise we refert the geopandas & fiona versions

@davide-f davide-f changed the title Add env fix Update workflow to latest geopandas and fiona Dec 23, 2024
Copy link
Member

@ekatef ekatef left a comment

Choose a reason for hiding this comment

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

Looks good to me. As discussed, explicit specification of fiona engine is needed only if schema argument is applied (which basically correspond to a transformation of geopandas dataframe into geojson structure).

The only concern I have is save_to_geojson in helpers. It's used in clean_osm_data and doesn't have specification of driver and schema argument in contrast to save_to_geojson defined and used in build_shapes and cluster_network. Not sure about the implications, though.

def save_to_geojson(df, fn):
if os.path.exists(fn):
os.unlink(fn) # remove file if it exists
# save file if the (Geo)DataFrame is non-empty
if df.empty:
# create empty file to avoid issues with snakemake
with open(fn, "w") as fp:
pass
else:
# save file
df.to_file(fn, driver="GeoJSON")

Could you please check it just in case?

Otherwise, the PR looks great, and thanks a lot for tackling it! 😄

scripts/_helpers.py Outdated Show resolved Hide resolved
@davide-f
Copy link
Member Author

This PR has second priority with respect to #1172 .
The successful merge of the two implementation is available here: https://github.com/davide-f/pypsa-earth/tree/test_linopy_latest_gpd

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