diff --git a/.gitignore b/.gitignore index 0c88bde..cb35353 100644 --- a/.gitignore +++ b/.gitignore @@ -158,3 +158,40 @@ dmypy.json .ionide # End of https://www.toptal.com/developers/gitignore/api/visualstudiocode + +# Created by https://www.toptal.com/developers/gitignore/api/macos +# Edit at https://www.toptal.com/developers/gitignore?templates=macos + +### macOS ### +# General +.DS_Store +.AppleDouble +.LSOverride + +# Icon must end with two \r +Icon + +# Thumbnails +._* + +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent + +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + +### macOS Patch ### +# iCloud generated files +*.icloud + +# End of https://www.toptal.com/developers/gitignore/api/macos diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fefa5f..46e4e50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,14 +7,26 @@ The format is based on [Keep a Changelog], and this project adheres to ## [Unreleased] +### Fixed + +- Columns in the output file are now guaranteed to be in the same order as given + by the `columns` input value. + ([#100](https://github.com/MAAP-Project/gedi-subsetter/issues/100)) + ### Changed -- Valid values for the `output` option have changed such that a file extension - is required, whereas previously this was optional since `.gpkg` was the only - supported output format. However, in addition to `.gpkg`, it is now possible - to specify the extensions `.parquet` for (Geo)Parquet format, and `.fgb` for - FlatGeobuf format. - (([#97](https://github.com/MAAP-Project/gedi-subsetter/issues/97)) +- Valid values for the `output` option have changed such that **a file extension + is required**, whereas previously this was optional since `.gpkg` was the only + supported output format. + ([#97](https://github.com/MAAP-Project/gedi-subsetter/issues/97)) + +### Added + +- It is now possible to specify alternative file formats for the `output` value: + in addition to the file extension `.gpkg` for GeoPackage format, it is now + possible to specify the extensions `.parquet` for (Geo)Parquet format, or + `.fgb` for FlatGeobuf format. + ([#97](https://github.com/MAAP-Project/gedi-subsetter/issues/97)) ## [0.9.0] (2024-10-09) diff --git a/pyproject.toml b/pyproject.toml index 76931e6..25c257b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,6 +37,7 @@ module = [ ignore_missing_imports = true [tool.pytest.ini_options] +addopts = ["--doctest-modules"] filterwarnings = ["ignore::DeprecationWarning", "ignore::UserWarning"] # Uncomment next line to enable live logging during tests # log_cli = true diff --git a/src/gedi_subset/gedi_utils.py b/src/gedi_subset/gedi_utils.py index 64da338..a7cb50c 100644 --- a/src/gedi_subset/gedi_utils.py +++ b/src/gedi_subset/gedi_utils.py @@ -392,8 +392,8 @@ def subset_hdf5( ... # `filename` column (which refers to the memory location of the ... # ``io.BytesIO``, not a filename). ... gdf.drop(columns=["filename"]) - BEAM agbd sensitivity geometry - 0 0000 1.116093 0.99 POINT (12.06707 -1.82471) + agbd sensitivity geometry + 0 1.116093 0.99 POINT (12.06707 -1.82471) Note that the resulting ``geopandas.GeoDataFrame`` contains only the specified coverage `BEAM`s, specified columns (`agbd` and `sensitivity`), and only the @@ -414,7 +414,7 @@ def subset_beam(beam: h5py.Group) -> gpd.GeoDataFrame: # Grab the coordinates for the geometry, before dropping columns geometry = gpd.points_from_xy(df[lon_col], df[lat_col]) # Select only the user-specified columns - gdf = gpd.GeoDataFrame(df[[*set(columns)]], geometry=geometry, crs=aoi.crs) + gdf = gpd.GeoDataFrame(df[columns], geometry=geometry, crs=aoi.crs) return cast(gpd.GeoDataFrame, gdf.clip(aoi))