You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
Version 1
Next »
Problem
If you try to load the samples file "gg_ml.tmpl", it can fail because that one is not in the usual samples location but in "ifs_samples". Normally you extend the ECCODES_SAMPLES_PATH to include the ifs_samples directory. But with MEMFS the samples (and also definitions) are not installed (instead they are all embeddedwithin the library.
So for example let's say we have the following Fortran program that loads 2 samples:
program sample
use eccodes
implicit none
integer :: s1, s2, section4Length
! Try to load an IFS sample: ifs_samples/grib1_mlgrib2/gg_ml.tmpl
call codes_grib_new_from_samples(s1, "gg_ml" )
call codes_get(s1, 'section4Length' , section4Length)
write (*, *) 'IFS sample gg_ml: section4Length=' , section4Length
call codes_release(s1)
! Try to load a core sample: samples/GRIB2.tmpl
call codes_grib_new_from_samples(s2, "GRIB2" )
call codes_get(s2, 'section4Length' , section4Length)
write (*, *) 'Core sample GRIB2: section4Length=' , section4Length
call codes_release(s2)
end program sample
|
Compile and run the program. It should fail
% ./sample.exe
ECCODES ERROR : Unable to load sample file 'gg_ml.tmpl'
from /MEMFS/samples
ECCODES ERROR : grib_new_from_samples: (gg_ml) File not found
|
Solution
Extend the samples path to search in the IFS samples location too (by setting the ECCODES_SAMPLES_PATH environment variable):
% export ECCODES_SAMPLES_PATH=/MEMFS/ifs_samples/grib1_mlgrib2:/MEMFS/samples
% ./sample.exe
IFS sample gg_ml: section4Length= 770
Core sample GRIB2: section4Length= 34
# Now it works fine
Related articles