Commit 770b874d authored by Beatriz Recinos's avatar Beatriz Recinos
Browse files

added other plot functions and notebook

parent 88cc733e
......@@ -7,6 +7,7 @@ The code reads, organises and plot daily SST data from The ESA-CCI Sea Surface T
Repository structure:
- `config.ini`: paths to the data
- `notebooks`: jupyter-notebooks to show results
- `sst_tools`: tools to read, process and plot the data
- `scripts`: python scripts to run the workflow
- `src`: SLURM scripts to send the jobs in JASMIN
......
This diff is collapsed.
import logging
import salem
import pyproj
import matplotlib.pyplot as plt
from matplotlib import colorbar
import cartopy.crs as crs
......@@ -54,3 +56,56 @@ def plot_sst_map(sst_data, ax, vmin=None, vmax=None, cbar=True):
ax.add_feature(cartopy.feature.LAND, color='black')
return {}
def plot_sst_on_salem_map(ds, t, lon_xinterval=0.5, lat_yinterval=0.5):
""" plots re-gridded sst data with Salem
Parameters
----------
ds : xarray of sst data
t: time slice
lon_xinterval: longitude interval for x-axis
lat_yinterval: latitude interval for y-axis
Returns
-------
sm : Salem.Map
"""
sm = ds.isel(time=t).salem.get_map(countries=True)
sm.set_data(ds.analysed_sst.isel(time=t))
sm.set_data(ds.analysed_sst.isel(time=t))
sm.set_lonlat_contours(xinterval=lon_xinterval, yinterval=lat_yinterval)
sm.set_cmap('RdBu_r')
return sm
def plot_stats_on_salem_map(ds, var, t, lon_xinterval=0.5, lat_yinterval=0.5):
""" plots re-gridded data with Salem
Parameters
----------
ds : xarray of re-gridded data
var: string with the variable name to plot
t: time slice
lon_xinterval: longitude interval for x-axis
lat_yinterval: latitude interval for y-axis
Returns
-------
sm : Salem.Map
"""
if var == 'buoy_count':
cmap = 'Purples'
elif var == 'analysed_sst_std':
cmap = 'Greens'
else:
cmap = 'RdBu_r'
sm = ds.isel(time=t).salem.get_map(countries=True)
sm.set_data(ds[var].isel(time=t))
sm.set_data(ds[var].isel(time=t))
sm.set_lonlat_contours(xinterval=lon_xinterval, yinterval=lat_yinterval)
sm.set_cmap(cmap)
return sm
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