Code Monkey home page Code Monkey logo

Comments (8)

pelson avatar pelson commented on August 19, 2024 1

Hi,

Does this mean that mercator grid in general is not supported by iris-grib?

Yes, I'm afraid so. The process of adding mercator is entirely achievable, but it is multi-staged:

  1. Add the Mercator coordinate system to iris.coord_systems. Turns out, Iris already has it in https://github.com/SciTools/iris/blob/master/lib/iris/coord_systems.py#L826.
  2. Get iris-grib to construct a Mercator coordinate system much like is done for LambertConformal in https://github.com/SciTools/iris-grib/blob/master/iris_grib/__init__.py#L439
  3. If you want save support for your cube, add it much like LambertConformal in
    elif isinstance(cs, LambertConformal):
    .

In all cases, take a look at the pull requests that created the reference work, so that you can follow a similar pattern of testing (a pre-requisite for accepting changes to the repository).

Hope that is helpful. Let me know if you need any more detail.

Cheers,

Phil

from iris-grib.

DPeterK avatar DPeterK commented on August 19, 2024

Hi @loxn8773, we've now added support to iris-grib for loading the Mercator grid definition template, which is available on the latest iris-grib master (with save support coming soon along with an iris-grib release that contains load and save support for Mercator). Could you check whether this fixes the issue you reported here?

from iris-grib.

lkugler avatar lkugler commented on August 19, 2024

Thank you all for your effort! I'm not sure if I did everything correct, so I set up a new conda env, installed iris and iris_grib from conda-forge.

The result is

(Iris) user@blablabla:~$ python iris-plot.py
iris.__version__: 2.1.0
iris_grib.__version__: 0.13.0
Traceback (most recent call last):
  File "iris-plot.py", line 27, in <module>
    cubes = iris.load(each)
  File "miniconda2/envs/Iris/lib/python2.7/site-packages/iris/__init__.py", line 343, in load
    return _load_collection(uris, constraints, callback).merged().cubes()
  File "/miniconda2/envs/Iris/lib/python2.7/site-packages/iris/__init__.py", line 313, in _load_collection
    result = iris.cube._CubeFilterCollection.from_cubes(cubes, constraints)
  File "/miniconda2/envs/Iris/lib/python2.7/site-packages/iris/cube.py", line 145, in from_cubes
    for cube in cubes:
  File "/miniconda2/envs/Iris/lib/python2.7/site-packages/iris/__init__.py", line 300, in _generate_cubes
    for cube in iris.io.load_files(part_names, callback, constraints):
  File "/miniconda2/envs/Iris/lib/python2.7/site-packages/iris/io/__init__.py", line 210, in load_files
    for cube in handling_format_spec.handler(fnames, callback):
  File "/miniconda2/envs/Iris/lib/python2.7/site-packages/iris/fileformats/rules.py", line 429, in load_cubes
    user_callback_wrapper=loadcubes_user_callback_wrapper):
  File "/miniconda2/envs/Iris/lib/python2.7/site-packages/iris/fileformats/rules.py", line 348, in _load_pairs_from_fields_and_filenames
    for field, filename in fields_and_filenames:
  File "/miniconda2/envs/Iris/lib/python2.7/site-packages/iris/fileformats/rules.py", line 412, in _generate_all_fields_and_filenames
    filename, **loader.field_generator_kwargs):
  File "/miniconda2/envs/Iris/lib/python2.7/site-packages/iris_grib/__init__.py", line 711, in _load_generate
    message = GribWrapper(message_id, grib_fh=grib_fh)
  File "/miniconda2/envs/Iris/lib/python2.7/site-packages/iris_grib/__init__.py", line 169, in __init__
    self._compute_extra_keys()
  File "/miniconda2/envs/Iris/lib/python2.7/site-packages/iris_grib/__init__.py", line 458, in _compute_extra_keys
    raise TranslationError("unhandled grid type: {}".format(gridType))
iris.exceptions.TranslationError: unhandled grid type: mercator

from iris-grib.

DPeterK avatar DPeterK commented on August 19, 2024

Hi @loxn8773, sorry this still isn't working for you! Interestingly all worked fine when loading the Mercator GRIB2 test file we were working from... I'll investigate further and see what I can come up with.

from iris-grib.

lkugler avatar lkugler commented on August 19, 2024

Thanks @dkillick. I think my files were GRIB1, but anyways, pygrib did the work for now and as long as nobody else had this issue you may also consider this closed.

from iris-grib.

DPeterK avatar DPeterK commented on August 19, 2024

Thanks @loxn8773 - the changes made were for GRIB2 only, which might explain this difference in behaviour...

from iris-grib.

marfel avatar marfel commented on August 19, 2024

I can confirm this issue, plus the suspicion that it's related to GRIB1 support. After using grib_set edition=2 on my files (output from some customized WRF model, I believe), the mercator grid was correctly parsed.

from iris-grib.

pp-mo avatar pp-mo commented on August 19, 2024

Since old comment above

@lkugler Thanks @dkillick. I think my files were GRIB1, but anyways, pygrib did the work for now and as long as nobody else had this issue you may also consider this closed.

Can be closed.

from iris-grib.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.