Skip to content

Point extraction#29

Merged
frizwi merged 6 commits intomainfrom
point-extraction
Oct 5, 2022
Merged

Point extraction#29
frizwi merged 6 commits intomainfrom
point-extraction

Conversation

@mx-moth
Copy link
Contributor

@mx-moth mx-moth commented Oct 4, 2022

  • Adds a new Format.drop_geometry() method
  • Adds a new emsarray.operations.point_extraction module that can extract data at points given in a Pandas DataFrame.
  • Adds a new emsarray extract-points command line entry point

Closes #13

@mx-moth mx-moth self-assigned this Oct 4, 2022
@mx-moth
Copy link
Contributor Author

mx-moth commented Oct 4, 2022

Using the gbr4.nc file from emsarray-data, and gbr4-points.csv as the input points:

$ emsarray extract-points emsarray-data/gbr4.nc gbr4-points.csv gbr4-points.nc

Outputs gbr4-points.nc (zipped because github does not allow uploading .nc files)

@mx-moth mx-moth marked this pull request as ready for review October 4, 2022 05:59
@mx-moth mx-moth force-pushed the point-extraction branch 2 times, most recently from 74d5ca0 to a62f5ca Compare October 4, 2022 06:06
Copy link
Contributor

@frizwi frizwi left a comment

Choose a reason for hiding this comment

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

Will be very useful functionality! Is there an example for its use?

@frizwi frizwi merged commit a04db6f into main Oct 5, 2022
@mx-moth
Copy link
Contributor Author

mx-moth commented Oct 5, 2022

@frizwi You can view the in-progress documentation for this functionality including example usage from Python at: https://emsarray--29.org.readthedocs.build/en/29/api/operations/point_extraction.html

An example command line invocation is:

$ emsarray extract-points emsarray-data/gbr4.nc gbr4-points.csv gbr4-points.nc

The command line interface prints usage:

$ emsarray extract-points --help
usage: emsarray extract-points [-h] [-c LON LAT] [-d DIM]
                               input-dataset points output-dataset

positional arguments:
  input-dataset         Path to input netCDF4 file
  points                Path to a CSV file with the points to extract
  output-dataset        Path to output netCDF4 file

options:
  -h, --help            show this help message and exit
  -c LON LAT, --coordinate-columns LON LAT
                        Names of the longitude and latitude columns in the CSV
                        file. Defaults to 'lon' and 'lat'.
  -d DIM, --point-dimension DIM
                        Name of the new dimension to index the point data

@mx-moth mx-moth mentioned this pull request Oct 5, 2022
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.

Point extraction

2 participants