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.

Add 'unstructured_grid' support to write function

See original GitHub issue

Currently cfgrib can handle the gridType unstructured_grid when reading files (see #28). However, when writing a GRIB file using this data an error is raised NotImplementedError: Unsupported 'gridType': u'unstructured_grid'. Is it to difficult to implement this feature?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
guidocionicommented, Dec 19, 2018
ValueErrorTraceback (most recent call last)
<ipython-input-8-d316a23fef91> in <module>()
      1 import cfgrib
----> 2 cfgrib.to_grib(ds_subset, 'out1.grib')

/work/mh0731/m300382/conda_envs/my_base/lib/python2.7/site-packages/cfgrib/xarray_to_grib.py in to_grib(*args, **kwargs)
    261 
    262 def to_grib(*args, **kwargs):
--> 263     return canonical_dataset_to_grib(*args, **kwargs)

/work/mh0731/m300382/conda_envs/my_base/lib/python2.7/site-packages/cfgrib/xarray_to_grib.py in canonical_dataset_to_grib(dataset, path, mode, no_warn, grib_keys, **kwargs)
    257     with open(path, mode=mode) as file:
    258         for data_var in dataset.data_vars.values():
--> 259             canonical_dataarray_to_grib(data_var, file, grib_keys=real_grib_keys, **kwargs)
    260 
    261 

/work/mh0731/m300382/conda_envs/my_base/lib/python2.7/site-packages/cfgrib/xarray_to_grib.py in canonical_dataarray_to_grib(data_var, file, grib_keys, default_grib_keys, **kwargs)
    209         raise ValueError("required grib_key 'gridType' not passed nor auto-detected")
    210 
--> 211     template_message = make_template_message(merged_grib_keys, **kwargs)
    212 
    213     coords_names, data_var = expand_dims(data_var)

/work/mh0731/m300382/conda_envs/my_base/lib/python2.7/site-packages/cfgrib/xarray_to_grib.py in make_template_message(merged_grib_keys, template_path, sample_name)
    179         if sample_name is None:
    180             sample_name = detect_sample_name(merged_grib_keys)
--> 181         template_message = cfgrib.CfMessage.from_sample_name(sample_name)
    182 
    183     for key in MESSAGE_DEFINITION_KEYS:

/work/mh0731/m300382/conda_envs/my_base/lib/python2.7/site-packages/cfgrib/messages.pyc in from_sample_name(cls, sample_name, **kwargs)
     62     @classmethod
     63     def from_sample_name(cls, sample_name, **kwargs):
---> 64         codes_id = eccodes.codes_new_from_samples(sample_name.encode('ASCII'))
     65         return cls(codes_id=codes_id, **kwargs)
     66 

/work/mh0731/m300382/conda_envs/my_base/lib/python2.7/site-packages/cfgrib/eccodes.pyc in codes_new_from_samples(samplename, product_kind)
    590     handle = lib.codes_grib_handle_new_from_samples(ffi.NULL, samplename)
    591     if handle == ffi.NULL:
--> 592         raise ValueError("sample not found: %r" % samplename)
    593     return handle
    594 

ValueError: sample not found: 'unstructured_grid_sfc_grib2'
0reactions
guidocionicommented, Jan 23, 2019

Sorry for the delay… I will try to test the behaviour in the following days.

Read more comments on GitHub >

github_iconTop Results From Across the Web

pyvista.UnstructuredGrid — PyVista 0.37.0 documentation
Clip any mesh type using a pyvista.PolyData surface mesh. UnstructuredGrid.compute_cell_quality ([...]) Compute a function of ( ...
Read more >
Using ESMF unstructured grids #18 - GitHub
I'm wondering what it would take to support using ESMF's unstructured grids with xESMF. I had a conversation with @bekozi today where we ......
Read more >
Importing Unstructured Grids - Pointwise Plugin SDK
Create an unstructured grid assembler using PwVlstCreateBlockAssembler(). Add element faces to the assembler using PwAsmPushElementFace(). After adding the last ...
Read more >
vtkUnstructuredGrid Class Reference - VTK
A higher-performing variant of the virtual vtkDataSet::GetCellPoints() for unstructured grids. Given a cellId, return the number of defining points and the list ...
Read more >
Derivative of an interpolated function on an unstructured grid
I'm writing my own FEM Poisson equation solver in C++ and I'm using Mathematica as a benchmark - currently it seems that my...
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