Commit e096bc25 authored by Ralf Mueller's avatar Ralf Mueller 🎣
Browse files

added testdata (reduced + zipped)

a bit of error handling for CdiInfo
no testdata dir anymore because it's only a single file
parent f9d511cf
......@@ -8,7 +8,7 @@ int main() {
std::string _name;
CdiVariable var;
Cdi info("testdata/mulval.nc");
Cdi info("mulval.nc");
std::cout << "#===============================" << std::endl;
for (int i = 0; i < info.nvars; i++)
......
......@@ -38,9 +38,12 @@ libcdipp_la_SOURCES = cdi.cpp cdi.hpp
libcdipp_la_LIBADD = $(top_builddir)/src/libcdi.la
libcdipp_la_LDFLAGS = @NETCDF_LIBS@ @SZLIB_LIBS@ $(LDFLAGS)
CdiInfo_SOURCES = CdiInfo.cpp
CdiInfo_SOURCES = CdiInfo.cpp mulval.grb mulval.nc
CdiInfo_LDADD = libcdipp.la
CdiInfo_LDFLAGS = @NETCDF_LIBS@ @SZLIB_LIBS@ $(LDFLAGS)
mulval.nc: $(abs_top_srcdir)/interfaces/mulval.nc.gz
gunzip -c $< > $@
#
#
if ENABLE_RUBY
......@@ -59,7 +62,7 @@ $(RUBY_SHARED_LIB): $(RUBY_WRAPPER_FILE) $(RUBY_MAKEFILE)
ruby-binding: $(RUBY_SHARED_LIB)
rubyTest: $(RUBY_SHARED_LIB)
rubyTest: $(RUBY_SHARED_LIB) mulval.nc
cd ruby && ruby $(abs_top_srcdir)/interfaces/ruby/test.rb
install-ruby: $(RUBY_SHARED_LIB)
......@@ -82,7 +85,7 @@ python-binding: $(PYTHON_SHARED_LIB)
pythonTest: $(abs_top_srcdir)/interfaces/python/test.py
@cd python; python $<
install-python: $(PYTHON_SHARED_LIB)
install-python: $(PYTHON_SHARED_LIB) mulval.nc
cd python; CC="$(CC)" CXX="$(CXX)" BUILDLIBDIR="$(top_builddir)/src/.libs" LIBDIR=$(libdir) CFLAGS="$(CFLAGS)" LIBS="$(LIBS)" LDFLAGS="-L../../src/.libs $(LDFLAGS)" INCFLAGS="-I$(abs_top_srcdir)/interfaces" python setup.py install --prefix=$(prefix)
endif
#
......
......@@ -358,6 +358,11 @@ CdiVariable::getFValuesWithLevel(int tsID)
*/
Cdi::Cdi(const char *path) {
streamID = streamOpenRead(path);
if (0 > streamID) {
std::cout << "Failed to read input '" << path <<"'";
std::cout << "Got streamID = " << streamID;
}
vlistID = streamInqVlist(streamID);
nvars = vlistNvars(vlistID);
......
import CdiObj
import sys,os
sys.path.insert(0,os.getcwd())
print(sys.path)
import Cdi
ifile = "../testdata/mulval.grb"
ifile = "../mulval.nc"
cdi = CdiObj.Cdi(ifile)
cdi = Cdi.Cdi(ifile)
print('Stream: ',cdi.streamID,' vlistID:',cdi.vlistID,' nvars:{d}', cdi.nvars)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment