diff --git a/LICENSE b/LICENSE index c737446..9ea32be 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 Open Climate Fix +Copyright (c) 2024 Open Climate Fix Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 1d31d59..e569d59 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,42 @@ -# OCF Template Repository -Template Repository for OCF Projects +# A starting library for future satellite prediction -## Usage -Do the following to customize the repo to the project: +### Getting started -- Replace `src` with name of the library/project -- Update `setup.py` with the proper info -- Change `commit` to `True` in `.bumpversion.cfg` if you want the minor version - to increment on every commit. -- Add PyPi access token to release to PyPi -- Update name of folder in the test workflow +Create and activate a new python environment, e.g. + +``` +conda create -n sat_pred python=3.10 +conda activate sat_pred +``` + +Install the dependencies + +``` +pip install -r requirements.txt +``` + +Create a empty directory to save the satellite data to + +``` +mkdir path/to/new/satellite/directory +``` + +Run the command line utility to download download satellite data + +``` +python scripts/download_uk_satellite.py \ + "2020-06-01 00:00" \ + "2020-06-30 23:55" \ + "path/to/new/satellite/directory" +``` + +The above script downloads all the satellite imagery from June 2020. The input arguments are: + - start_date: First datetime (inclusive) to download + - end_date: Last datetime (inclusive) to download + - output_directory: Directory to which the satellite data should be saved + +Note that the above script creates a satellite dataset which is 21GB. On my machine it used about +12GB of RAM at its peak and took around 30 minutes to run. + +See the notebook `plot_satellite_image_example.ipynb` for loading and plotting example \ No newline at end of file diff --git a/environment.yml b/environment.yml deleted file mode 100644 index 96986b8..0000000 --- a/environment.yml +++ /dev/null @@ -1,7 +0,0 @@ -name: ocf_template -channels: - - pytorch - - conda-forge - - defaults -dependencies: - - pip diff --git a/notebooks/plot_satellite_image_example.ipynb b/notebooks/plot_satellite_image_example.ipynb new file mode 100644 index 0000000..5b9414a --- /dev/null +++ b/notebooks/plot_satellite_image_example.ipynb @@ -0,0 +1,1292 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "id": "54656c49-9790-4936-899a-f9ad81e42b2c", + "metadata": {}, + "outputs": [], + "source": [ + "import xarray as xr\n", + "import matplotlib.pyplot as plt \n", + "import ocf_blosc2" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "id": "25b077af-cd5b-462e-8d55-4b84a2032059", + "metadata": {}, + "outputs": [], + "source": [ + "ds_sat = xr.open_zarr(\"path/to/new/satellite/directory/2020_nonhrv.zarr\")" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "id": "8b95b1a1-d0f7-4c94-a2b8-06072d547ac9", + "metadata": {}, + "outputs": [ + { + "data": { + "text/html": [ + "
<xarray.Dataset> Size: 43GB\n", + "Dimensions: (time: 8621, y_geostationary: 372, x_geostationary: 614,\n", + " variable: 11)\n", + "Coordinates:\n", + " * time (time) datetime64[ns] 69kB 2020-06-01 ... 2020-06-30T23:...\n", + " * variable (variable) <U6 264B 'IR_016' 'IR_039' ... 'WV_062' 'WV_073'\n", + " * x_geostationary (x_geostationary) float64 5kB 1.5e+04 ... -1.824e+06\n", + " * y_geostationary (y_geostationary) float64 3kB 4.192e+06 ... 5.305e+06\n", + "Data variables:\n", + " data (time, y_geostationary, x_geostationary, variable) float16 43GB dask.array<chunksize=(1, 100, 100, 11), meta=np.ndarray>