Skip to content

Commit

Permalink
Add function to extract coordinates (points) from era5 netCDF-file
Browse files Browse the repository at this point in the history
  • Loading branch information
uvchik committed Jun 18, 2021
1 parent de067d2 commit 5aa50ea
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/feedinlib/era5.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,21 @@ def select_area(ds, lon, lat, g_step=0.25):
return answer


def extract_coordinates_from_era5(era5_netcdf_filename):
"""
Extract all coordinates from a er5 netCDf-file and return them as a
geopandas.Series
"""
ds = xr.open_dataset(era5_netcdf_filename)

# Extract all points from the netCDF-file:
points = []
for x in ds.longitude:
for y in ds.latitude:
points.append(Point(x, y))
return gpd.GeoSeries(points)


def select_geometry(ds, area):
"""
Select data for given geometry from dataset.
Expand Down

0 comments on commit 5aa50ea

Please sign in to comment.