Skip to content

Commit

Permalink
emdonet example documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
rbardaji committed Mar 22, 2020
1 parent af42f9b commit 3597c33
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 0 deletions.
Binary file added docs/examples/data/emodnet-esp-2020-01.7z
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/examples/img_examples/spanish-temp.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions docs/examples/index_examples.md
Original file line number Diff line number Diff line change
@@ -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).
41 changes: 41 additions & 0 deletions docs/examples/temp_spain_january_2019.md
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions docs/index_docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ Index:

* [API reference](api_reference/index_api_reference.md)
* [Installation](installation/installation.md)
* [Examples](examples/index_examples.md)

0 comments on commit 3597c33

Please sign in to comment.