Commit 866b41a0 authored by Florian Ziemen's avatar Florian Ziemen
Browse files

work on 2d ocean paraview example.

parent 9b4c69dd
Pipeline #4469 passed with stages
in 10 seconds
Loading 2D ICON data
===============================
An example using Ocean speeds
.. image:: 00-empty-main.png
For loading ICON data, we need to activate the CDI reader plugin (on Mistral it's active by default)
Chose Tools-> Manage Plugins
.. image:: 00a-load-plugin.png
Select the CDIReader plugin, open the detailed view, activate Auto Load, and Chose "Load selected" at the bottom.
.. image:: 00b-activate-cdi-plugin.png
Use File-> Open.., or use the top-left icon to open the file choser.
.. image:: 01-load-file.png
Chose uv.nc (get it from ....)
.. image:: 02-chose-file.png
Chose the CDI reader for ICON files -- Model with a regular (lat/lon, or stretched) grid usually go via "NetCDF Reader".
.. image:: 02a-chose-reader.png
uv.nc now appears in the top of the pipeline (top left).
You can now chose which variables to load (we want u and v). They are considered as cell arrays, as we have all grid corners for them.
Below that, you can chose the projection. We'll use Lat/Lon for now.
Some ICON Ocean data comes with zeros on land points. Then a wet_c variable can be used to get rid of land points.
With "Vertical levels" you can chose which vertical level you want to see if there's more than one in the source file (not in uv.nc).
.. image:: 03-viever-properties.png
Now we want to apply a "Calculator" filter to compute the absolute speed from the velocity.
Choose Filters->Common->Calculator, or use the calculator symbol just above the pipeline.
.. image:: 04-pipeline.png
In the calculator, you can chose the data type to operate on ("cell data" is correct here), give your result variable a sensible name (color maps are associated with these names, so "Result" can lead to conflicts and hassle once you have a second calculator). In the next field, you can define the equation that is computed. We want to use::
sqrt (u*u+v*v)
You can also use the drop-down menus at the bottom to get access to the variables available (sorted by scalars and vector quantities).
.. image:: 05-calculator.png
.. image:: 06-chose-colormap.png
.. image:: 07-colormap-overview.png
.. image:: 08-colormap-choser.png
.. image:: 09-rescale-to-custom.png
.. image:: 10-ocean-speeds.png
.. _chose-BuGn:
Chose a different colormap
----------------------------------------
.. note::
This document is part of a series teaching how to :ref:`create_image_sea_surface_speeds`
In the top left part of the paraview window, there is a color ar with a small green circle. This allows you to chose a color map.
In the Color Map Editor window (View-> Color Map Editor Window) it's on the right hand side of the color map preview
.. image:: chose-BuGn/06-chose-colormap.png
..
image:: chose-BuGn/07-colormap-overview.png
In the color map chooser window, you can select a color map from a wide range of options. By default, only a few of them are displayed. With the dropdown menu on the right [Default] you can chose from a couple groups or display all of them.
In the text field in the top, you can start typing letters that should appear in the name of the color bar. For anything with Blue, best chose ``b``, Python-Style names usually exist, so we just type ``Bu``.
You can chose to import a color map with its ``preset range`` (top right) - this can be useful if you e.g. customize a color map for display of annual mean temperatures and save it with that preset range for later use.
.. image:: chose-BuGn/08-colormap-choser.png
This should get you something like this:
.. image:: chose-BuGn/09-BuGn-currents.png
You can now :ref:`rescale-colormap-to-custom`.
To brighten the colors you can :ref:`deactivate-light-kit`.
.. _rescale-colormap-to-custom:
Rescale the colormap to a custom range
========================================
.. note::
This document is part of a series teaching how to :ref:`create_image_sea_surface_speeds`
Use this button to rescale your color map to a custom range or chose a custom color for monochromatic displays
.. image:: rescale-to-custom/09-rescale-to-custom.png
Chose 0 to 1 to get this image:
.. image:: rescale-to-custom/10-rescaled-to-custom.png
you can now :ref:`deactivate-light-kit` to make the colors stand out even better.
.. _create_image_sea_surface_speeds:
Create an image of sea surface speeds
===========================================
These steps will get you from
.. image:: 00-empty-main.png
to
.. image:: 10-ocean-speeds.png
.. note::
Whatever you do with paraview. Keep saving state files (``File -> Save State``) at regular intervals. You can additionally :ref:`make-paraview-save-on-quit-or-crash`.
You might need to :ref:`activate_the_cdi_reader_plugin`
With the cdi reader loaded, you can :ref:`load-2d-icon`
You can now :ref:`calculator-uv-speed`
With the data loaded, you can :ref:`chose-BuGn`
For tuning your resulting image, you can
* :ref:`rescale-colormap-to-custom`
* :ref:`deactivate-light-kit`
* :ref:`texture-map-to-plane` to fill the holes in the ocean.
.. Vis documentation master file, created by
sphinx-quickstart on Tue Sep 8 11:52:42 2020.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Paraview examples
===================================================
.. toctree::
:maxdepth: 2
:caption: Contents:
:glob:
*
*/index
.. meta::
:description: Basic calculator usage
:keywords: calculator, magnitude, square root
.. _calculator-uv-speed:
Apply a calculator to convert u and v into speed
-------------------------------------------------
.. note::
This document is part of a series teaching how to :ref:`create_image_sea_surface_speeds`
Here we assume you alred :ref:`loaded 2D ocean data<load-2d-icon>`
Now we want to apply a "Calculator" filter to compute the absolute speed from the velocity.
Choose Filters->Common->Calculator, or use the calculator symbol just above the pipeline.
.. image:: calculator-uv-speed/04-pipeline.png
In the calculator, you can chose the data type to operate on ("cell data" is correct here), give your result variable a sensible name -- we chose ``vel`` here -- ``speed`` would have been correct...
Naming your output immediately is useful, as color maps are associated with these names, so "Result" can lead to conflicts and hassle once you have a second calculator.
In the next field, you can define the equation that is computed. We want to use::
sqrt (u*u+v*v)
You can also use the drop-down menus at the bottom to get access to the variables available (sorted by scalars and vector quantities).
.. image:: calculator-uv-speed/05-calculator.png
The result should look similar to this:
.. image:: calculator-uv-speed/05a-speed-image.png
With the speed computed, you can :ref:`chose-BuGn`
Alternatively, you can :ref:`rescale-colormap-to-custom`
.. _texture-map-to-plane:
Add an image as texture (plane) in the background
================================================================================
.. note::
This document is part of a series teaching how to :ref:`create_image_sea_surface_speeds`
As our ocean data set has *holes* on the land points, we have to first create a plane *behind* it, before we can attach an image of Earth.
.. image:: texture-map-to-plane/000-ocean-with-holes.png
As a first step, we figure out the size of *Earth* in paraview. For this we need the ``Information View`` (View-> Information). There we look for the section ``Bounds`` and note the extreme values. The x-range is from roughly -300 to 300, the y-range is from roughly -131 to 150. The lower bound of the y-range is a bit weird, because Antarctica is cut off, because the oceans don't reach 90 deg S. Now we know our plane needs to be -300 to 300 by -150 to 150, and just below z=0.
.. image:: texture-map-to-plane/00a-find-data-size.png
We can get a plane from the ``Sources`` menu, e.g. from ``Geometric Shapes``.
.. image:: texture-map-to-plane/00b-get-plane.png
Here we adjust the x coordinates to +/- 300 and the y coordinates to +/- 150, keeping the signs as they were. As z-coordinate we use -0.1 to put this plane just below the ocean.
.. image:: texture-map-to-plane/00c-new-coordinates.png
After clicking ``Apply``, we should have all land areas filled with white.
Now we can add the texture itself. Chose ``Filters->Search...`` and type ``texture``. You will be presented with the three different texture filters. Chose ``Texture Map to Plane`` and hit ``Enter``
.. image:: texture-map-to-plane/01-find-filter.png
Now you first have to click apply before you can set the texture (for whatever reason)
.. image:: texture-map-to-plane/02-apply.png
Now use the text box and search for texture. Click the ``Texture`` dropdown menu, and chose load.
.. image:: texture-map-to-plane/03-find-texture-field.png
Pick the small blue marble from the directory with the sample data (or use any one of NASA's Blue Marble images (Thanks, NASA for that great service!).
.. image:: texture-map-to-plane/04-texture-file.png
You should have Earth peeking out of the holes in the ocean.
.. image:: texture-map-to-plane/05-texture-on-earth.png
.. _deactivate-light-kit:
Deactivate the light kit
========================
.. note::
This document is part of a series teaching how to :ref:`create_image_sea_surface_speeds`
By default, Paraview creates a couple of light sources in positions that are fixed relative to the viewer. This light sources allow for shadows and depth perception. However this comes at the cost of brilliance of colors.
.. image:: deactivate-light-kit/01-get-light-inspector.png
Use the checkbox in the top left corner to deactivate the light kit.
.. image:: deactivate-light-kit/02-light-inspector.png
If you followed the whole series of :ref:`create_image_sea_surface_speeds`, your result should look like this:
.. _activate_the_cdi_reader_plugin:
Activate the CDI reader plugin
--------------------------------
.. note::
This document is part of a series teaching how to :ref:`create_image_sea_surface_speeds`
For loading ICON data, we need to activate the CDI reader plugin (on Mistral it's active by default)
Chose Tools-> Manage Plugins
.. image:: cdi-reader-plugin/00a-load-plugin.png
Select the CDIReader plugin, open the detailed view, activate ``Auto Load``, and Chose ``Load selected`` at the bottom. The ``Status`` should now be ``Loaded``, and ``Load Selected`` should be greyed out.
.. image:: cdi-reader-plugin/00b-activate-cdi-plugin.png
With the cdi reader loaded, you can :ref:`load-2d-icon`
.. _load-2d-icon:
Load 2D ICON data with the CDI reader
-------------------------------------
.. note::
This document is part of a series teaching how to :ref:`create_image_sea_surface_speeds`
You might need to :ref:`activate_the_cdi_reader_plugin`
Use File-> Open.., or use the top-left icon to open the file choser.
.. image:: load-2d-icon/01-load-file.png
Chose uv.nc (get it from ....)
.. image:: load-2d-icon/02-chose-file.png
Chose the CDI reader for ICON files -- Models with a regular (lat/lon, or stretched) grid usually go via "NetCDF Reader". If CDIReader does not appear in the menu, you need to :ref:`activate_the_cdi_reader_plugin`.
.. image:: load-2d-icon/02a-chose-reader.png
uv.nc now appears in the top of the pipeline (top left).
You can now chose which variables to load (we want u and v). They are considered as cell arrays, as we have all grid corners for them.
Below that, you can chose the projection. We'll use Lat/Lon for now.
Some ICON Ocean data comes with zeros on land points. Then a wet_c variable can be used to get rid of land points.
With "Vertical levels" you can chose which vertical level you want to see if there's more than one in the source file (not in uv.nc).
.. image:: load-2d-icon/03-viever-properties.png
The result should look like this:
.. image:: load-2d-icon/02b-ocean-loaded.png
From the dropdown menu in the top you can chose to color by any variable, e.g. ``v``
.. image:: load-2d-icon/04-chose-variable-for-display.png
Which should give a basic idea of eddies and friends
.. image:: load-2d-icon/05-color-by-v.png
You can now :ref:`calculator-uv-speed`
......@@ -4,7 +4,7 @@
contain the root `toctree` directive.
Documentation for visualization with Paraview
===============================
===================================================
.. toctree::
:maxdepth: 2
......@@ -12,4 +12,4 @@ Documentation for visualization with Paraview
:glob:
*
*/*
*/index
.. _make-paraview-save-on-quit-or-crash:
Make Paraview save a state on quitting or crashing
================================================================================
Get the paraview preferences (this works on mac):
.. image:: get-preferences.png
use the text box in the ``General`` tab to seach for ``save``, activate both options, and ``Apply``.
.. image:: make-paraview-save-on-quit-or-crash/activate-options.png
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