diff --git a/docs/examples/data/emodnet-esp-2020-01.7z b/docs/examples/data/emodnet-esp-2020-01.7z new file mode 100644 index 0000000..eba2c6b Binary files /dev/null and b/docs/examples/data/emodnet-esp-2020-01.7z differ diff --git a/docs/examples/img_examples/spanish-observatories.png b/docs/examples/img_examples/spanish-observatories.png new file mode 100644 index 0000000..e9ba05d Binary files /dev/null and b/docs/examples/img_examples/spanish-observatories.png differ diff --git a/docs/examples/img_examples/spanish-temp.png b/docs/examples/img_examples/spanish-temp.png new file mode 100644 index 0000000..0245fe3 Binary files /dev/null and b/docs/examples/img_examples/spanish-temp.png differ diff --git a/docs/examples/index_examples.md b/docs/examples/index_examples.md new file mode 100644 index 0000000..729616c --- /dev/null +++ b/docs/examples/index_examples.md @@ -0,0 +1,7 @@ +# Examples + +## Using EMODnet data + +* [Comparison of seawater temperature of several observatories using EMODnet data](temp_spain_january_2019.md). + +Return to [index](../index_docs.md). diff --git a/docs/examples/temp_spain_january_2019.md b/docs/examples/temp_spain_january_2019.md new file mode 100644 index 0000000..32de78c --- /dev/null +++ b/docs/examples/temp_spain_january_2019.md @@ -0,0 +1,41 @@ +# Comparison of seawater temperature of several observatories using EMODnet data + +In this example, we have used data from [EMODnet Physics](https://www.emodnet-physics.eu/Portal/). We have downloaded all the data from January 2020 from the observatories of the Spanish coast that measure the temperature of the water in the first 5 meters of depth. We have discarded datasets that contain errors (for example, misspelt geolocation). We have also dropped datasets with water temperatures at various depths or with large amounts of data so that the script could be run on less powerful computers. Finally, the files that we are going to use in this example are [here](./data/emodnet-esp-2020-01.7z). + +```python +import mooda as md +import plotly.graph_objects as go +import os + +# Make a list of file locations +root = '/path/to/directory/' +nc_files = [os.path.join(root, filename) + for root, _, filenames in os.walk(root) + for filename in filenames + if '.nc' in filename] + +# Open the files and make a list of WaterFrames +wf_list = [md.read_nc_emodnet(path) for path in nc_files] + +# Make an interactive map with the observatory locations +fig1 = md.iplot_location(wf_list) +go.Figure(fig1).show() + +# Make an interactive plot with the seawater temperatures of all the WaterFrames +fig2 = md.iplot_timeseries(wf_list, 'TEMP') +go.Figure(fig2).show() +``` + +Output: + +![Observatories of the Spanish coast][spanish-observatories] + +![Spanish coast seawater temperatures][spanish-temp] + +*Note: The script makes two interactive charts. The images shown in this document have been generated by saving the interactive images in a PNG file.* + +Return to the [Index of examples](index_examples.md). + +[spanish-observatories]: ./img_examples/spanish-observatories.png + +[spanish-temp]: ./img_examples/spanish-temp.png \ No newline at end of file diff --git a/docs/index_docs.md b/docs/index_docs.md index 0d88931..86f7545 100644 --- a/docs/index_docs.md +++ b/docs/index_docs.md @@ -4,3 +4,4 @@ Index: * [API reference](api_reference/index_api_reference.md) * [Installation](installation/installation.md) +* [Examples](examples/index_examples.md)