diff --git a/README.md b/README.md index bb1ec370..c005a1b4 100644 --- a/README.md +++ b/README.md @@ -78,6 +78,10 @@ Once you have a username and password, download using [`scripts/download_UK_Met_Office_NWPs_from_CEDA.sh`](https://github.com/openclimatefix/nowcasting_dataset/tree/main/scripts/download_UK_Met_Office_NWPs_from_CEDA.sh). Please see the comments at the top of the script for instructions. +Then convert the `grib` files to Zarr using `scripts/convert_NWP_grib_to_zarr.py`. Run that script +with `--help` to see how to operate it. See the comments at the top of the script to learn how +the script works. + Detailed docs of the Met Office data is available [here](http://cedadocs.ceda.ac.uk/1334/1/uk_model_data_sheet_lores1.pdf). diff --git a/notebooks/plot_NWP_zarr.ipynb b/notebooks/plot_NWP_zarr.ipynb new file mode 100644 index 00000000..dcf74244 --- /dev/null +++ b/notebooks/plot_NWP_zarr.ipynb @@ -0,0 +1,550 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "cf9b8624-4cc8-42fa-aaee-b17df33e7438", + "metadata": {}, + "outputs": [], + "source": [ + "import xarray as xr" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "d1873561-4059-4493-ab0c-77c9982b2b90", + "metadata": {}, + "outputs": [], + "source": [ + "ZARR_PATH = \"/mnt/storage_ssd/data/ocf/solar_pv_nowcasting/nowcasting_dataset_pipeline/NWP/UK_Met_Office/UKV/zarr/test.zarr\"" + ] + }, + { + "cell_type": "markdown", + "id": "b366603a-3421-4621-a6bb-33910956d893", + "metadata": {}, + "source": [ + "## Load from Zarr" + ] + }, + { + "cell_type": "code", + "execution_count": 5, + "id": "633fb9bd-da4b-4e06-acec-bc09bd41b214", + "metadata": {}, + "outputs": [], + "source": [ + "ds_from_zarr = xr.open_dataset(ZARR_PATH, mode=\"r\", engine=\"zarr\")" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "id": "82e01ee2-c24e-44ed-a085-67cc35fbc06f", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
<xarray.Dataset>\n", + "Dimensions: (variable: 17, init_time: 7810, step: 37, y: 704, x: 548)\n", + "Coordinates:\n", + " * init_time (init_time) datetime64[ns] 2016-03-22T15:00:00 ... 2018-12-09\n", + " * step (step) timedelta64[ns] 00:00:00 01:00:00 ... 1 days 12:00:00\n", + " * variable (variable) <U6 'cdcb' 'lcc' 'mcc' ... 'wdir10' 'prmsl' 'prate'\n", + " * x (x) int64 -239000 -237000 -235000 ... 851000 853000 855000\n", + " * y (y) int64 -183000 -181000 -179000 ... 1219000 1221000 1223000\n", + "Data variables:\n", + " UKV (variable, init_time, step, y, x) float32 ...
array(['2016-03-22T15:00:00.000000000', '2016-03-22T18:00:00.000000000',\n", + " '2016-03-22T21:00:00.000000000', ..., '2018-12-08T18:00:00.000000000',\n", + " '2018-12-08T21:00:00.000000000', '2018-12-09T00:00:00.000000000'],\n", + " dtype='datetime64[ns]')
array([ 0, 3600000000000, 7200000000000, 10800000000000,\n", + " 14400000000000, 18000000000000, 21600000000000, 25200000000000,\n", + " 28800000000000, 32400000000000, 36000000000000, 39600000000000,\n", + " 43200000000000, 46800000000000, 50400000000000, 54000000000000,\n", + " 57600000000000, 61200000000000, 64800000000000, 68400000000000,\n", + " 72000000000000, 75600000000000, 79200000000000, 82800000000000,\n", + " 86400000000000, 90000000000000, 93600000000000, 97200000000000,\n", + " 100800000000000, 104400000000000, 108000000000000, 111600000000000,\n", + " 115200000000000, 118800000000000, 122400000000000, 126000000000000,\n", + " 129600000000000], dtype='timedelta64[ns]')
array(['cdcb', 'lcc', 'mcc', 'hcc', 'sde', 'hcct', 'dswrf', 'dlwrf', 'h', 't',\n", + " 'r', 'dpt', 'vis', 'si10', 'wdir10', 'prmsl', 'prate'], dtype='<U6')
array([-239000, -237000, -235000, ..., 851000, 853000, 855000])
array([-183000, -181000, -179000, ..., 1219000, 1221000, 1223000])
[1895199342080 values with dtype=float32]