Commit 1d8f3259 authored by Willi Rath's avatar Willi Rath

Merge branch 'use-more-than-1000-sltac-files' into 'master'

Use all available SLTAC data and stick to ipynb

See merge request !4
parents 2428ece9 34aabde1
# Using to calculate SSH variance
This example uses version v1.0.0 of <> and calculates sea-surface-height variance for the year 1993.
## Preamble
Import a few modules:
- `pyplot` is loaded by `xarray`, but we need to explicitly modify a dictionary to increase figure size
- `pathlib.Path` is good for handling paths
- `seaborn` makes plots nice
- `xarray` will do the calculations and call the plotting
# suppress warnings
import warnings
%matplotlib inline
import matplotlib.pyplot as plt
from pathlib import Path
import seaborn as sns
import xarray as xr
plt.rcParams['figure.figsize'] = [15, 9]
sns.set_context("notebook", font_scale=1.5, rc={"lines.linewidth": 2.5})
## Using a local checkout
In `taurus:/data/c2/TMdata/git_geomar_de_data/`, there's a checkout of `SLTAC_GLO_PHY_L4_REP`, `v1.0.0`. Generate a list of all files for the year 1993 and open all files as one data set and calculate temporal variance of absolute dynamic topography, `adt`.
data_path = Path("/data/c2/TMdata/git_geomar_de_data/")
data_set = "SLTAC_GLO_PHY_L4_REP"
ref = "v1.0.0"
full_path = data_path / data_set / ref / "data"
file_list = [str(fp) for fp in full_path.glob("1993/*.nc")]
<matplotlib.collections.QuadMesh at 0x7feb95eacf28>
There is <>. Clicking will bring a list of data-file urls (which, lacking a decent crawler, we'll have to improvise here). Open all urls in one dataset and again create the variance plot with `xarray`.
# wave hands and pull a list of urls from somewhere (the local file listing for now...)
base_url = "{file_name}"
url_list = [base_url.format(file_name=fn) for fn in [ for p in full_path.glob("1993/*.nc")]]
<matplotlib.collections.QuadMesh at 0x7feb8e6582b0>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment