Era5-download #152
-
I am trying to use from datetime import datetime
from shapely import wkt
from vibe_core.client import get_default_vibe_client
WORKFLOW_NAME = "data_ingestion/weather/download_era5"
RUN_NAME = "era5 download"
input_geometry_path = "./input_region.wkt"
time_range = (datetime(2020,1,1), datetime(2023, 12, 31))
# Reading the geometry file
with open(input_geometry_path) as f:
geometry = wkt.load(f)
client = get_default_vibe_client()
client.document_workflow(WORKFLOW_NAME)
wf_run = client.run(WORKFLOW_NAME, RUN_NAME, geometry=geometry, time_range=time_range) and the file input_geometry_path.wkt has the following content:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
Hi, @ReisQuarteu. Thank you for raising the question. The output ERA5 product that FarmVibes provides matches the geometry of the product provided by Planetary Computer (in case of This is a design choice to enable caching and avoid having to redownload a product for each input geometry provided by the user. In cases, you submit a new workflow with a slightly different geometry than a previous run, we can leverage what was downloaded before. In your case, you can clip the raster to your input geometry when reading it: import xarray as xr
import geopandas as gpd
# Using only the first product in the time range
product = wf_run.output["downloaded_product"][0]
# Read with xarray
ds = xr.open_dataset(product.assets[0].path_or_url)
# Set CRS in case it is not defined
ds.rio.write_crs("EPSG:4326", inplace=True)
# Clip to your geometry
gdf = gpd.GeoDataFrame(geometry=[geometry])
clipped_ds = ds.rio.clip(gdf.geometry) Let me know if you have any more doubts. |
Beta Was this translation helpful? Give feedback.
-
Closing this discussion for now. Feel free to reopen it, @ReisQuarteu, if you have any more doubts. |
Beta Was this translation helpful? Give feedback.
Hi, @ReisQuarteu. Thank you for raising the question.
The output ERA5 product that FarmVibes provides matches the geometry of the product provided by Planetary Computer (in case of
data_ingestion/weather/download_era5
) or CDS (in case ofdata_ingestion/weather/download_era5_monthly
), which is for the whole world. This is also similar for other data ingestion workflows (for example, Sentinel-2 or Landsat, in which the output products might match the geometry of a tile).This is a design choice to enable caching and avoid having to redownload a product for each input geometry provided by the user. In cases, you submit a new workflow with a slightly different geometry than a previous run, we…