Giter Site home page Giter Site logo

Comments (13)

shahramn avatar shahramn commented on June 12, 2024

I just tried it and it works for me

import os
print ("Before ECCODES_DEFINITION_PATH ", os.environ['ECCODES_DEFINITION_PATH'])
print ("Before GRIB_DEFINITION_PATH ",    os.environ['GRIB_DEFINITION_PATH'])

from gribapi import *
#from eccodes import *

print ("After ECCODES_DEFINITION_PATH ", os.environ['ECCODES_DEFINITION_PATH'])
print ("After GRIB_DEFINITION_PATH ",    os.environ['GRIB_DEFINITION_PATH'])

I run with:
ECCODES_DEFINITION_PATH=edp GRIB_DEFINITION_PATH=gdp python3 test_env.py

Tried with importing eccodes as well. No problem

from eccodes-python.

thebaptiste avatar thebaptiste commented on June 12, 2024

May be there is something wrong in my environment or I missed something in my build of eccodes library...

I'm on RockyLinux 8.5 with python 3.9.7

from eccodes-python.

thebaptiste avatar thebaptiste commented on June 12, 2024

Maybe something weird in eccodes include file eccodes_config.h :

/* #undef HAVE_MEMFS */

#ifdef HAVE_MEMFS
#undef ECCODES_DEFINITION_PATH
#define ECCODES_DEFINITION_PATH "/MEMFS/definitions"
#undef ECCODES_SAMPLES_PATH
#define ECCODES_SAMPLES_PATH "/MEMFS/samples"
#undef ECCODES_IFS_SAMPLES_PATH
#define ECCODES_IFS_SAMPLES_PATH "/MEMFS/ifs_samples"
#endif

and gribapi.gribapi.codes_definition_path()returns /MEMFS/definitions

from eccodes-python.

shahramn avatar shahramn commented on June 12, 2024

The MEMFS feature is described here:
https://confluence.ecmwf.int/pages/viewpage.action?pageId=143037711

from eccodes-python.

thebaptiste avatar thebaptiste commented on June 12, 2024

I didn't build eccodes with option ENABLE_MEMFS, but it should be OFF by default ?
My build options are : -DENABLE_PYTHON=OFF -DENABLE_JPG=ON -DENABLE_NETCDF=ON -DENABLE_FORTRAN=ON

codes_infois ok but, when using eccodes-python 1.4.1, after from gribapi import *, "something" seems to undefine ECCODES_DEFINITION_PATH as if HAVE_MEMFS was defined in eccodes_config.h

from eccodes-python.

thebaptiste avatar thebaptiste commented on June 12, 2024

May be I should build explicitely with -DENABLE_MEMFS=OFF ?

from eccodes-python.

thebaptiste avatar thebaptiste commented on June 12, 2024

I think I found the reason of my problem.
The python package ecmwflibs is also available in my environment (release 0.4.6, may be I should update). It's a required dependency of climetlab.
So eccodes-python doesn't use my eccodes build but the libeccodes library available in ecwmflibs and I suppose this library is built with mode memfs activated ?
Is there a way to force eccodes-python and other ecmwf python packages to use the local built eccodes library or at least to deactivate memfs mode (we need to use local definitions) ?

from eccodes-python.

thebaptiste avatar thebaptiste commented on June 12, 2024

May be it would be better to use ecmwlibs libraries only if the required libraries are not found rather than the opposite ?

from eccodes-python.

thebaptiste avatar thebaptiste commented on June 12, 2024

Yes, it seems that I can deactivate the usage of the libeccodes library provided by ecmwflibs by setting the environment variable ECMWFLIBS_ECCODES to my locally built eccodes library.
This is not very intuitive...

from eccodes-python.

thebaptiste avatar thebaptiste commented on June 12, 2024

From my point of vue, it's not a good idea to activate by default the MEMFS option in the eccodes library provided by ecmwflibs.

from eccodes-python.

thebaptiste avatar thebaptiste commented on June 12, 2024

May be this issue is rather an ecmwflibs issue...

from eccodes-python.

floriankrb avatar floriankrb commented on June 12, 2024

Yes, it seems that I can deactivate the usage of the libeccodes library provided by ecmwflibs by setting the environment variable ECMWFLIBS_ECCODES to my locally built eccodes library.
This is not very intuitive...

I think this is the main issue (the only issue?): "This is not very intuitive".

Perhaps eccodes-python should warn when there are env variables and they are ignored because it chooses ecmwflibs instead? And give a hint to use ECMWFLIBS_ECCODES?

from eccodes-python.

floriankrb avatar floriankrb commented on June 12, 2024

The commit ecmwf/ecmwflibs@f97bc93 in ecmwflibs solves the problem that "this is not intuitive". Adding warning and help when env variables are ignored.

This issue can be closed.

from eccodes-python.

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.