OceanVariableReconstruction / examples /subset_by_region_time.py
simon-donike's picture
Add files using upload-large-folder tool
619931a verified
raw
history blame contribute delete
534 Bytes
from pathlib import Path
import pandas as pd
import xarray as xr
ROOT = Path(__file__).resolve().parents[1]
profiles = pd.read_parquet(ROOT / "indices/profiles.parquet")
subset = profiles[
(profiles["profile_date"] >= 20100101)
& (profiles["profile_date"] <= 20101231)
& (profiles["latitude"].between(30.0, 46.0))
& (profiles["longitude"].between(-6.0, 37.0))
]
ds = xr.open_zarr(ROOT / "data/argo_glors_ostia_ssh.zarr", consolidated=None)
subset_ds = ds.sel(profile=subset["profile"].to_numpy())
print(subset_ds)