question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

unstructured grids

See original GitHub issue

Has anyone used xesmf to regrid from unstructured grids like ICON, MPAS or FESOM?

Unstructured grids like ICON just have one spatial dimension like ncells and 2 spatial coordinates clon and clat.

I tried and failed.

https://gist.github.com/aaronspring/fd54970f71a39e26ab54a8b47170533d

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:11 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
sol1105commented, Oct 1, 2021

Using locstream to at least offer nearest neighbour remapping is a nice idea, since apparently the data on unstructured grids of the CMIP models is stored in this locstream-like format. I tested it for CMIP6 published ICON-OES and FESOM data: https://nbviewer.jupyter.org/github/roocs/regrid-prototype/blob/main/docs/notebooks/xESMF_unstructured_locstream_ref.ipynb

The only problem I encountered originates from the following lines in xesmf/backend.py:

def esmf_regrid_build( [...]):
[...]
    # ESMF bug? when using locstream objects, options src_mask_values
    # and dst_mask_values produce runtime errors
    allow_masked_values = True
    if isinstance(sourcefield.grid, ESMF.api.locstream.LocStream):
        allow_masked_values = False
    if isinstance(destfield.grid, ESMF.api.locstream.LocStream):
        allow_masked_values = False
[...]

Due to an ESMF bug masks are ignored when generating the weights. I tried then to apply a mask for target grid, by manipulating the weights after their creation and by applying the mask on the regridded data. Both options worked. So one could

  • add the option to manipulate the weights when a mask for the target grid is defined and the locstream option is used to make up for at least half of the ESMF bug
  • add the possibility to apply a mask on the regridded data to frontend.BaseRegridder.__call__ to be able to call it like: ds_out=regridder(ds, keep_attrs, skipna, na_thres, mask_out)
  • Should a warning be issued when a mask is ignored? It would have helped me at least 😃 What do you think?
0reactions
kthyngcommented, Mar 4, 2022

ok thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unstructured Grid - an overview
The use of unstructured grid offers several advantages over structured grids. These lie in the ability to deal with arbitrary complex geometries and...
Read more >
UNSTRUCTURED GRID TECHNIQUES
An overview of the current state of the art in unstructured mesh techniques for computational fluid dynamics is given. The topics of mesh...
Read more >
Grid Systems | CFD-101 | What Are the Advantages and ...
A popular type of unstructured grid consists of tetrahedral elements. These grids tend to be easier to generate than those composed of hexahedral...
Read more >
Chapter 11: Unstructured Grids Introduction
To generate curvilinear meshes it is necessary to map the physical geometry into a computational geometry. (a) physical grid in x-y co-ordinates. (b)...
Read more >
Smoothing of Unstructured Grids
Abstract. Two mesh smoothing techniques applied to unstructured grids are compared. These are based on the solution of elliptic equations,.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found