|
5 | 5 | "id": "31b1fab7-2441-4746-925f-69d51c4d98a8", |
6 | 6 | "metadata": {}, |
7 | 7 | "source": [ |
8 | | - "# Generate annual/yearly zarr stores from hourly ERA5 data files on NCAR's Research Data Archive" |
| 8 | + "# Generate annual/yearly zarr stores from hourly ERA5 NetCDF files on NCAR's Research Data Archive" |
| 9 | + ] |
| 10 | + }, |
| 11 | + { |
| 12 | + "cell_type": "markdown", |
| 13 | + "id": "ef28c0f9-b371-44be-a0f4-654681115eb6", |
| 14 | + "metadata": {}, |
| 15 | + "source": [ |
| 16 | + "## Warning: Please Read\n", |
| 17 | + "- ERA5 data on NCAR is stored in hourly NetCDF files. Therefore, it is necessary to create intermediate ARCO datasets for fast processing.\n", |
| 18 | + "- In this notebook, we read hourly data from NCAR's publicly accessible ERA5 collection using an intake catalog, compute the annual means and store the result using zarr stores.\n", |
| 19 | + "- If you don't have write permision to save to the Research Data Archive (RDA), please save the result to your local folder.\n", |
| 20 | + "- If you need annual means for the following variables, please don't run this notebook. The data has already been calculated and can be accessed via https from https://data.rda.ucar.edu/pythia_era5_24/annual_means/\n", |
| 21 | + "\n", |
| 22 | + " - Air temperature at 2 m/ VAR_2T\n", |
| 23 | + " \n", |
| 24 | + "- Otherwise, please run this script once to generate the annual means.\n" |
| 25 | + ] |
| 26 | + }, |
| 27 | + { |
| 28 | + "cell_type": "markdown", |
| 29 | + "id": "741a7ddb-1343-4807-9ed2-0150c350d73d", |
| 30 | + "metadata": {}, |
| 31 | + "source": [ |
| 32 | + "## Imports" |
9 | 33 | ] |
10 | 34 | }, |
11 | 35 | { |
|
40 | 64 | }, |
41 | 65 | { |
42 | 66 | "cell_type": "code", |
43 | | - "execution_count": 30, |
| 67 | + "execution_count": 4, |
44 | 68 | "id": "4bee4557-d1f1-4720-bf61-a09f106f41ba", |
45 | 69 | "metadata": {}, |
46 | 70 | "outputs": [ |
47 | 71 | { |
48 | 72 | "name": "stdout", |
49 | 73 | "output_type": "stream", |
50 | 74 | "text": [ |
51 | | - "https://data.rda.ucar.edu/pythia_era5_24/pythia_intake_catalogs/era5_catalog.json\n" |
| 75 | + "https://data.rda.ucar.edu/pythia_era5_24/annual_means/\n" |
52 | 76 | ] |
53 | 77 | } |
54 | 78 | ], |
|
64 | 88 | "######## \n", |
65 | 89 | "zarr_path = rda_scratch + \"/tas_zarr/\"\n", |
66 | 90 | "##########\n", |
67 | | - "print(era5_catalog)" |
| 91 | + "print(annual_means)" |
| 92 | + ] |
| 93 | + }, |
| 94 | + { |
| 95 | + "cell_type": "markdown", |
| 96 | + "id": "20a20dff-a028-4e38-a7b7-8bfb670bdf01", |
| 97 | + "metadata": {}, |
| 98 | + "source": [ |
| 99 | + "### Create a Dask cluster" |
| 100 | + ] |
| 101 | + }, |
| 102 | + { |
| 103 | + "cell_type": "markdown", |
| 104 | + "id": "c6eb54a1-a044-4402-8e5a-a53cefb11256", |
| 105 | + "metadata": {}, |
| 106 | + "source": [ |
| 107 | + "#### Dask Introduction\n", |
| 108 | + "\n", |
| 109 | + "[Dask](https://www.dask.org/) is a solution that enables the scaling of Python libraries. It mimics popular scientific libraries such as numpy, pandas, and xarray that enables an easier path to parallel processing without having to refactor code. \n", |
| 110 | + "\n", |
| 111 | + "There are 3 components to parallel processing with Dask: the client, the scheduler, and the workers. \n", |
| 112 | + "\n", |
| 113 | + "The Client is best envisioned as the application that sends information to the Dask cluster. In Python applications this is handled when the client is defined with `client = Client(CLUSTER_TYPE)`. A Dask cluster comprises of a single scheduler that manages the execution of tasks on workers. The `CLUSTER_TYPE` can be defined in a number of different ways.\n", |
| 114 | + "\n", |
| 115 | + "- There is LocalCluster, a cluster running on the same hardware as the application and sharing the available resources, directly in Python with `dask.distributed`. \n", |
| 116 | + "\n", |
| 117 | + "- In certain JupyterHubs Dask Gateway may be available and a dedicated dask cluster with its own resources can be created dynamically with `dask.gateway`. \n", |
| 118 | + "\n", |
| 119 | + "- On HPC systems `dask_jobqueue` is used to connect to the HPC Slurm and PBS job schedulers to provision resources.\n", |
| 120 | + "\n", |
| 121 | + "The `dask.distributed` client python module can also be used to connect to existing clusters. A Dask Scheduler and Workers can be deployed in containers, or on Kubernetes, without using a Python function to create a dask cluster. The `dask.distributed` Client is configured to connect to the scheduler either by container name, or by the Kubernetes service name. " |
| 122 | + ] |
| 123 | + }, |
| 124 | + { |
| 125 | + "cell_type": "markdown", |
| 126 | + "id": "09542b2f-aac2-4596-aeaf-89dee2f67cee", |
| 127 | + "metadata": {}, |
| 128 | + "source": [ |
| 129 | + "#### Select the Dask cluster type" |
| 130 | + ] |
| 131 | + }, |
| 132 | + { |
| 133 | + "cell_type": "markdown", |
| 134 | + "id": "59253ed5-2e1d-4415-bb60-78606d78d36a", |
| 135 | + "metadata": {}, |
| 136 | + "source": [ |
| 137 | + "The default will be `LocalCluster` as that can run on any system.\n", |
| 138 | + "\n", |
| 139 | + "If running on a HPC computer with a PBS Scheduler, set to True. Otherwise, set to False." |
| 140 | + ] |
| 141 | + }, |
| 142 | + { |
| 143 | + "cell_type": "markdown", |
| 144 | + "id": "1a995e3d-2be7-414e-a7bf-7c53178d44d2", |
| 145 | + "metadata": {}, |
| 146 | + "source": [ |
| 147 | + "USE_PBS_SCHEDULER = False" |
| 148 | + ] |
| 149 | + }, |
| 150 | + { |
| 151 | + "cell_type": "markdown", |
| 152 | + "id": "8bf1065d-7e67-4259-8f9d-876743106a41", |
| 153 | + "metadata": {}, |
| 154 | + "source": [ |
| 155 | + "If running on Jupyter server with Dask Gateway configured, set to True. Otherwise, set to False." |
| 156 | + ] |
| 157 | + }, |
| 158 | + { |
| 159 | + "cell_type": "markdown", |
| 160 | + "id": "8df9739b-5005-4c0d-bf5e-4dc4cc432f50", |
| 161 | + "metadata": {}, |
| 162 | + "source": [ |
| 163 | + "USE_DASK_GATEWAY = False" |
68 | 164 | ] |
69 | 165 | }, |
70 | 166 | { |
|
0 commit comments