metadata
license: mit
all_in_one.zarr.zip
<xarray.Dataset> Size: 25GB Dimensions: (Timestamp: 245376, station: 537) Coordinates:
- Timestamp (Timestamp) datetime64[ns] 2MB 2017-01-01 ... 2023-12-31T23:... address (station) <U187 402kB ... city (station) <U18 39kB ... latitude (station) float64 4kB ... longitude (station) float64 4kB ... state (station) <U17 37kB 'Chhattisgarh' ... 'West Bengal'
- station (station) <U64 137kB '32Bungalows, Bhilai - CECB' ... 'Ward-... Data variables: (12/24) AT (Timestamp, station) float64 1GB ... BP (Timestamp, station) float64 1GB ... Benzene (Timestamp, station) float64 1GB ... CO (Timestamp, station) float64 1GB ... Eth-Benzene (Timestamp, station) float64 1GB ... MP-Xylene (Timestamp, station) float64 1GB ... ... ... TOT-RF (Timestamp, station) float64 1GB ... Toluene (Timestamp, station) float64 1GB ... VWS (Timestamp, station) float64 1GB ... WD (Timestamp, station) float64 1GB ... WS (Timestamp, station) float64 1GB ... Xylene (Timestamp, station) float64 1GB ...
Reading data
First install zarr and xarray libraries
pip install zarr xarray
Lazy load the dataset
import xarray as xr
ds = xr.open_zarr("zip:///::https://huggingface.co/datasets/Zeel/P1/resolve/main/all_in_one.zarr.zip")
Full dataset size is ~8 GB. ds
variable contains the lazily loaded dataset, which means, it will only download a part of the data when a computation is needed on it.
For example, If we need to calculate mean of PM2.5 in Delhi for 2022, it will only download PM2.5 data of all stations in Delhi for 2022.
delhi_2022_ds = ds.sel(station=ds.station.state=="Delhi", Timestamp="2022")["PM2.5"]
mean_val = delhi_2022_ds.mean().item()
print(mean_val)
# 99.5650831365871