---
# System prepended metadata

title: State of Plotting MPAS (unstructured data) in Python
tags: [pangeo, ncar]

---

# State of Plotting MPAS (unstructured data) in Python
[TOC]

## Goals

*    Demonstrate MPAS capability over oceans through a Volvo Ocean Race Leg 7 simulation case study. 

*    The MPAS model was run on Cheyenne for the Mar/Apr 2018 period at 60-15km resolution. Daily output files of 24hr forecasts can be found at:
    `/glade/work/agbeli/MPAS-Model`
    
*    Determine the best visualization toolkit or process so that we can evaluate MPAS (as compared to GFS grid and analysis grid) and overlay lat/lon track points from Volvo Position Reports.

*    More generally, MPAS output grids are unstructured so many of the standard tools are not able to visualize it and information is lost when interpolating the MPAS grids to lat/lon. The ultimate goal is to have a tool to read in unstructured grids, allow for some data minipulation/visualization in its native form, and other dynamic functions before saving the results.

*    We would like to treat the unstructured (MPAS) data structure as a "general case", which can then be transfered to other cases like WRF grid or standard lat/lon cases.

* Port the MPAS NCL script into a working python tool which uses unstructured grids as the general case 
   
## Tools Evaluated

### NCL
The main NCL script converts MPAS grid to lat/lon and creates a plot of wind speed on a polar projection with a more southern ocean view to cover the Leg 7 route from Auckland to Itajai. 

* This NCL scripts can be found at:
`/glade/work/agbeli/MPAS-Model/grid_rotate/sc_scripts/mpas_script_polar.ncl` 

* This script finds max value to plug into the mpas script. 
`/glade/work/agbeli/MPAS-Model/grid_rotate/sc_scripts/run_script_and_find_max.sh`

* A seperate script used to zoom in on southern ocean region:
`/glade/work/agbeli/MPAS-Model/grid_rotate/sc_scripts/Zoomed_and_VectorPlots/mpas_script_zoomed.ncl`

* I experienced trouble attempting to overlay vectors or countours to this same zoomed NCL script found in the /Zommed_and_vectorPlot directory

`mpas_script_vectors.ncl`


#### Pros

- NCAR's NCL does a good job of visualizing MPAS/unstructured data
- Good suport internally at NCAR, but less so for others.
- 
#### Cons
* NCL is being phased out
* Not interactive
* Not a python implementation/lack compatibility.


### NCAR VAPOR

With current run configurations, I can import .history.nc files and produce 2D images. VAPOR is unable to deal with diag.*.nc files from MPAS. This was tested on local computer so only one nc file or timestep was viewed versus running VAPOR on Cheyenne remotely.

#### Pros

#### Cons


### Python/PYNGL

#### Pros

#### Cons


### Paraview


### AWIIPS/CAVE/AWIPS-Python

Unidata's AWIPS system also provides tools in python that can be used to visualize MPAS datasets. AWIPS has front end visualization system (CAVE) that is used by forecast offices specifically designed for decision analysis with forecast data output. https://www.unidata.ucar.edu/software/awips2/

The python scripts for AWIPS do not account for unstructured datasets but integrate well with the standard NWS and ECMWF data formats.

https://github.com/Unidata/python-awips

### Adrena


###### tags: `ncar` `pangeo`