pangeo-data / xESMF

Universal Regridder for Geospatial Data
http://xesmf.readthedocs.io/
MIT License
183 stars 32 forks source link

Regridder error `ESMC_GridCreateNoPeriDim() failed with rc = 545` #314

Open eaven123 opened 7 months ago

eaven123 commented 7 months ago

use xe.Regridder: errors: File "/root/miniconda3/envs/xeradar/lib/python3.11/site-packages/esmpy/api/grid.py", line 410, in init self._struct = ESMP_GridCreateNoPeriDim(self.max_index, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/root/miniconda3/envs/xeradar/lib/python3.11/site-packages/esmpy/interface/cbindings.py", line 601, in ESMP_GridCreateNoPeriDim raise ValueError('ESMC_GridCreateNoPeriDim() failed with rc = '+str(rc)+ ValueError: ESMC_GridCreateNoPeriDim() failed with rc = 545. Please check the log files (named "*ESMF_LogFile"). image how to sovle?

huard commented 7 months ago

Those messages don't ring any bell. In case you get no tips, you might want to post a minimal example that reproduces this error.

aulemahal commented 7 months ago

Hi @eaven123, is this error raised when you are using xe.SpatialAverager ? If yes, this might be because of malformed polygons. Try simplifying with df["geometry"] = df.simplify(tolerance=0.02, preserve_topology=True), where tolerance is set to something smaller than the output grid resolution, but not too small.

eaven123 commented 7 months ago

Those messages don't ring any bell. In case you get no tips, you might want to post a minimal example that reproduces this error.

hi,the data cannot be provided to you, but the reference logic is as follows, and xesmf 0.8.2.

    url = env_config.get('path', 'OUTPUT_PATH') + method + "/" 
    if not os.path.exists(url):
        os.makedirs(url)
    if len(orig_lat) > 0 and len(orig_lon) > 0 and len(out_lat) > 0 and len(out_lon) > 0:
        filename = f"{method}_{ele}_{len(orig_lat)}x{len(orig_lon)}_{len(out_lat)}x{len(out_lon)}.nc"
        regridder = xe.Regridder(grid_in, grid_out, method, filename=url + filename, ignore_degenerate=True)
        # reuse_weights=True
        data_regrid = regridder(data).astype(np.float32)
eaven123 commented 7 months ago

Hi @eaven123, is this error raised when you are using xe.SpatialAverager ? If yes, this might be because of malformed polygons. Try simplifying with df["geometry"] = df.simplify(tolerance=0.02, preserve_topology=True), where tolerance is set to something smaller than the output grid resolution, but not too small.

This error is caused by xe.Regridder.

aulemahal commented 7 months ago

Hi @eaven123. By searching the error code with the search engine of github (the input box usually is in the top right of the page), I found that there was a discussion about this specific issue : https://github.com/pangeo-data/xESMF/discussions/307

Seems to be dependent on the dask setup. The suggestion would be to use a dask.distributed.Client (https://distributed.dask.org/en/stable/client.html) instead of the basic threaded configuration.

eaven123 commented 7 months ago

How to use it? Could you give me a small example or link for me to refer to?

---- Replied Message ---- | From | Pascal @.> | | Date | 11/15/2023 22:47 | | To | pangeo-data/xESMF @.> | | Cc | eaven123 @.>, Mention @.> | | Subject | Re: [pangeo-data/xESMF] Regridder error ESMC_GridCreateNoPeriDim() failed with rc = 545 (Issue #314) |

Hi @eaven123. By searching the error code with the search engine of github (the input box usually is in the top right of the page), I found that there was a discussion about this specific issue : #307

Seems to be dependent on the dask setup. The suggestion would be to use a dask.distributed.Client (https://distributed.dask.org/en/stable/client.html) instead of the basic threaded configuration.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

aulemahal commented 7 months ago
from dask.distributed import Client
import xesmf as xe

client = Client()

... your code ...
eaven123 commented 7 months ago

OK,thanks ---- Replied Message ---- | From | Pascal @.> | | Date | 11/15/2023 23:11 | | To | pangeo-data/xESMF @.> | | Cc | eaven123 @.>, Mention @.> | | Subject | Re: [pangeo-data/xESMF] Regridder error ESMC_GridCreateNoPeriDim() failed with rc = 545 (Issue #314) |

fromdask.distributedimportClientimportxesmfasxeclient=Client()

... yourcode ...

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

eaven123 commented 7 months ago

I have tried dask..., but the process keeps getting stuck and there is no corresponding result coming out.

在 2023-11-15 23:11:33,"Pascal Bourgault" @.***> 写道:

fromdask.distributedimportClientimportxesmfasxeclient=Client()

... yourcode ...

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>