Scheduled Downtime
On Friday 21 April 2023 @ 5pm MT, this website will be down for maintenance and expected to return online the morning of 24 April 2023 at the latest

convert from regular grid to unstructured grid

This post was from a previous version of the WRF&MPAS-A Support Forum. New replies have been disabled and if you have follow up questions related to this post, then please start a new thread from the forum home page.

mmaoyi

New member
Hi MPAS Community

I would like to know if there is a tool available to convert a structured grid nc file to unstructured grid that MPAS uses.
The reason is that I would like to convert the SST update file to a structured grid, perturb it and then convert it back into an unstructured grid
to be used by MPAS.

Kind Regards
Linda
 
Besides the code in the init_atmosphere core for interpolating from intermediate files to the MPAS mesh, I don't think we have any tools for interpolation of general gridded data to the MPAS mesh. Would it be possible to adapt the method you're using to perturb the SST field to work directly on the MPAS unstructured mesh? This may be more challenging if, e.g., you are applying spatial filters to the SST field, but if the perturbations are simply adjustments based on, say, latitude, then this might be easy to do.

If you are comfortable working with Python, it might not be difficult to use SciPy's interp2d to interpolate from something like a structured, latitude-longitude grid to the (longitude,latitude) coordinates at the center of each MPAS cell. Using the netCDF4 module, you could even write the interpolated result directly back to an MPAS netCDF file.
 
Top