Skip to content

Commit

Permalink
Fixed legend issue in quicklook for collocated time series + added al…
Browse files Browse the repository at this point in the history
…l figures for the Oslo workshop
  • Loading branch information
fcollas committed Feb 5, 2024
1 parent 90f40c7 commit ba63e14
Show file tree
Hide file tree
Showing 14 changed files with 69 additions and 6 deletions.
Binary file added docs/oslo_ws24_collocated_ts.png
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/oslo_ws24_filters_1.png
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/oslo_ws24_filters_2.png
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/oslo_ws24_filters_3.png
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/oslo_ws24_filters_4.png
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/oslo_ws24_gridding_map.png
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/oslo_ws24_gridding_nb_collocated.png
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/oslo_ws24_gridding_rmsd.png
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/oslo_ws24_insitu.png
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/oslo_ws24_model_map.png
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/oslo_ws24_sat_map.png
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/oslo_ws24_sat_ts.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 64 additions & 5 deletions docs/workshop_latest.rst
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,16 @@ Using the quicklook function you can quickly visualize the data you have retriev
>>> sco.quicklook(m=True) # for a map
>>> sco.quicklook(a=True) # for all

.. |ex1| image:: ./oslo_ws24_sat_ts.png
:scale: 50
.. |ex2| image:: ./oslo_ws24_sat_map.png
:scale: 50

+-------------------+------------------+
| |ex1| | |ex2| |
| | |
+-------------------+------------------+


Exercise:
*********
Expand All @@ -329,12 +339,20 @@ In-situ observations can also be imported using the insitu_module module. You ca
>>> ico = ic(nID=nID, sd=sd, ed=ed, varalias=varalias, name=sensor)
>>> ico = ico.populate()
You can have a look at the obtained time series:

.. code-block:: python3
>>> sco.quicklook(ts=True)
.. image:: ./oslo_ws24_insitu.png
:scale: 80


5. access/read model data
#########################
Model output can be accessed and read using the model_module module. The model_module config file model_cfg.yaml needs adjustments if you want to include a model that is not present as default. Given that the model output file you would like to read follows the cf-conventions and standard_names are unique, the minimum information you have to provide are usually:

TO COMPLETE
Model output can be accessed and read using the model_module module. The model_module config file model_cfg.yaml needs adjustments if you want to include a model that is not present as default.

You can then import model data as follows:

Expand All @@ -348,6 +366,14 @@ You can then import model data as follows:
>>> mco = mc(nID=nID, sd=sd).populate() # one time slice
>>> mco_p = mc(nID=nID, sd=sd, ed=ed).populate() # time period
And again it is possible to visualize the data:

.. code-block:: python3
>>> sco.quicklook(m=True)
.. image:: ./oslo_ws24_model_map.png
:scale: 80

6. Collocating model and observations
#####################################
Expand Down Expand Up @@ -385,6 +411,13 @@ Collocation of satellite and wave model

Using the quicklook function again (*cco.quicklook(a=True)*) will enable three plots this time, a time series plot (*ts=True*), a map plot (*m=True*), and a scatter plot (*sc=True*).

.. code-block:: python3
>>> cco.quicklook(ts=True)
.. image:: ./oslo_ws24_collocated_ts.png
:scale: 80


7. Validate the collocated time series
#######################################
Expand Down Expand Up @@ -464,6 +497,9 @@ Now the gridder can be applied as follows:
>>> mask_metric_llim=1,
>>> title='')
.. image:: ./oslo_ws24_gridding_map.png
:scale: 80

Information of the grid and the values from observations and model can also be obtained directly from the gridder_class object:

.. code-block:: python3
Expand Down Expand Up @@ -491,7 +527,17 @@ It is also possible to grid the collocated data.
>>> # plot all validation metrics on grid
>>> gco.quicklook(val_grid=var_gridded_dict, lon_grid=lon_grid, lat_grid=lat_grid, metric='all')
.. |ex3| image:: ./oslo_ws24_gridding_nb_collocated.png
:scale: 50
.. |ex4| image:: ./oslo_ws24_gridding_rmsd.png
:scale: 50

+-------------------+------------------+
| |ex3| | |ex4| |
| | |
+-------------------+------------------+


9. Applying filters
###################
Finally, it is possible to apply some filters to the data. Let us try it on some
Expand All @@ -515,6 +561,9 @@ You can have a first look at the data:
>>> sco.quicklook(a=True)
.. image:: ./oslo_ws24_filters_1.png
:scale: 80

There could be some land interactions with the satellite track. It is possible to
filter it using *sco.filter_landMask()* function. Additionnally points closer than
a certain distance to the coast can be defined using *sco.filter_distance_to_coast()*
Expand All @@ -529,19 +578,29 @@ The corresponding code is the following:
... .filter_distance_to_coast(llim=650)\
... .apply_limits(llim=0.5)
.. image:: ./oslo_ws24_filters_2.png
:scale: 80

Some additional despiking method can be applied with *sco.despike_blockStd()*.

.. code-block:: python3
>>> sco = sco.despike_blockStd(slider=20, sigma=2, chunk_min=5)
.. image:: ./oslo_ws24_filters_3.png
:scale: 80

Another operation you can perform is smoothing the time serie, using a running mean
with the *sco.filter_runmean* method:

.. code-block:: python3
>>> sco = sco.filter_runmean(window=11, chunk_min=5, sampling_rate_Hz=20)
.. image:: ./oslo_ws24_filters_4.png
:scale: 80

10. Saving data to netcdf
#########################
It is possible to save the data from the different wavy objects to .nc files. If
Expand Down
6 changes: 5 additions & 1 deletion wavy/quicklookmod.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,15 @@ def quicklook(self, a=False, projection=None, **kwargs):
label=self.nID,
marker='o',alpha=.5,ms=2)
try:
if 'model' in vars(self):
label_scdplot = self.model
else:
label_scdplot = self.nID
ax.plot(self.vars['time'],
plot_var_model,
color=colors[1],
linestyle=kwargs.get('linestyle',''),
label=self.nID,
label=label_scdplot,
marker='o',alpha=.5,ms=2)
except Exception as e:
pass
Expand Down

0 comments on commit ba63e14

Please sign in to comment.