jllodra / ncdump-json Goto Github PK
View Code? Open in Web Editor NEWModified ncdump to output data in json format
Modified ncdump to output data in json format
I'm currently migrating servers and am in the process of reinstalling ncdump-json
. The installation instructions do however no longer work with the more recent versions of cmake due to syntax errors.
However, there is a workaround: cmake version 2.8.12.2. Posting it here for the sake of community knowledge.
Installing compatible CMake version
Follow these installation instructions: https://geeksww.com/tutorials/operating_systems/linux/installation/downloading_compiling_and_installing_cmake_on_linux.php Important: instead of 2.8.3 in the wget command, use 2.8.12.2.
In case you get any errors in the configure
phase (e.g. due to C++ compilers not found or Fortran related errors), execute sudo apt-get install gcc gfortran g++
and try again.
Running the make command
In the installation instructions, after $cmake, you'll have to run the make command from the ncdump-json folder. It may then be that you run into HDF5 errors:
Linking C executable ncdump-json
/usr/bin/ld: cannot find -lhdf5_hl
/usr/bin/ld: cannot find -lhdf5
collect2: error: ld returned 1 exit status
CMakeFiles/ncdump-json.dir/build.make:210: recipe for target 'ncdump-json' failed
make[2]: *** [ncdump-json] Error 1
CMakeFiles/Makefile2:60: recipe for target 'CMakeFiles/ncdump-json.dir/all' failed
make[1]: *** [CMakeFiles/ncdump-json.dir/all] Error 2
Makefile:113: recipe for target 'all' failed
make: *** [all] Error 2
To solve this, first ensure that you have installed the proper HDF5 dependencies:
sudo apt-get install libhdf5-serial-dev
Try again. If you get the same error, there is a mismatch between where your system has installed the files and where the makefile expects them to be.
To solve this, execute these steps:
cd /usr/lib/x86_64-linux-gnu
ls | grep libhdf5
.libhdf5_serial.so.8.0.2
or, in my case, libhdf5_serial.so.100
.sudo ln -s libhdf5_serial.so.8.0.2 libhdf5.so
sudo ln -s libhdf5_serial_hl.so.8.0.2 libhdf5_hl.so
Important: make sure to replace 8.0.2 with the number you identified in step 3.
5. Move towards the ncdump-json
directory, e.g. /home/username/ncdump-json
.
6. Run make
again.
The error disappeared and I got it running:
Linking C executable ncdump-json
[100%] Built target ncdump-json
Obviously, I ran this on a Unix based system with one of the more recent version of Debian (9). I hope it benefits some of you as it cost me several hours to figure it out, which will probably save some time for anyone dealing with this as well :)
cd 'C:\Users\selekao\Documents\NetBeansProjects\Cpp_Proiect_1'
C:\cygwin\bin\make.exe -f Makefile CONF=Debug
"/usr/bin/make" -f nbproject/Makefile-Debug.mk QMAKE= SUBPROJECTS= .build-conf
make[1]: Entering directory '/cygdrive/c/Users/selekao/Documents/NetBeansProjects/Cpp_Proiect_1'
"/usr/bin/make" -f nbproject/Makefile-Debug.mk dist/Debug/GNU_Cygwin-Windows/cpp_proiect_1.exe
make[2]: Entering directory '/cygdrive/c/Users/selekao/Documents/NetBeansProjects/Cpp_Proiect_1'
mkdir -p build/Debug/GNU_Cygwin-Windows
rm -f "build/Debug/GNU_Cygwin-Windows/main.o.d"
gcc -c -g -MMD -MP -MF "build/Debug/GNU_Cygwin-Windows/main.o.d" -o build/Debug/GNU_Cygwin-Windows/main.o main.cpp
main.cpp:1:0: fatal error: can't open /cygdrive/c/Users/selekao/AppData/Local/Temp/cck4APdB.s for writing: No such file or directory
/*
^
compilation terminated.
make[2]: *** [nbproject/Makefile-Debug.mk:68: build/Debug/GNU_Cygwin-Windows/main.o] Error 1
make[2]: Leaving directory '/cygdrive/c/Users/selekao/Documents/NetBeansProjects/Cpp_Proiect_1'
make[1]: *** [nbproject/Makefile-Debug.mk:59: .build-conf] Error 2
make[1]: Leaving directory '/cygdrive/c/Users/selekao/Documents/NetBeansProjects/Cpp_Proiect_1'
make: *** [nbproject/Makefile-impl.mk:40: .build-impl] Error 2
BUILD FAILED (exit value 2, total time: 1s)
Hi! Did you test on RHEL / Centos, I am on Centos 6.4, I could not build it, any guess what could be wrong ?
[root@localhost ncdump-json-master]# gcc --version
gcc (GCC) 4.8.1 20130715 (Red Hat 4.8.1-4)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[root@localhost ncdump-json-master]# g++ --version
g++ (GCC) 4.8.1 20130715 (Red Hat 4.8.1-4)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[root@localhost ncdump-json-master]# make
[ 16%] Building C object CMakeFiles/ncdump-json.dir/src/dumplib.c.o
[ 33%] Building C object CMakeFiles/ncdump-json.dir/src/ncdump.c.o
[ 50%] Building C object CMakeFiles/ncdump-json.dir/src/nctime.c.o
[ 66%] Building C object CMakeFiles/ncdump-json.dir/src/nciter.c.o
[ 83%] Building C object CMakeFiles/ncdump-json.dir/src/indent.c.o
[100%] Building C object CMakeFiles/ncdump-json.dir/src/vardata.c.o
Linking C executable ncdump-json
CMakeFiles/ncdump-json.dir/src/dumplib.c.o: In function count_udtypes': dumplib.c:(.text+0xdbd): undefined reference to
nc_inq_typeids'
dumplib.c:(.text+0xdf3): undefined reference to nc_inq_grps' dumplib.c:(.text+0xe3b): undefined reference to
nc_inq_grps'
CMakeFiles/ncdump-json.dir/src/dumplib.c.o: In function ncenum_typ_tostring': dumplib.c:(.text+0x2040): undefined reference to
nc_inq_enum_ident'
CMakeFiles/ncdump-json.dir/src/dumplib.c.o: In function nc_inq_gvarid': dumplib.c:(.text+0x3458): undefined reference to
nc_inq_grpname_full'
dumplib.c:(.text+0x349e): undefined reference to nc_inq_grpname_full' CMakeFiles/ncdump-json.dir/src/dumplib.c.o: In function
init_types':
dumplib.c:(.text+0x3808): undefined reference to nc_inq_typeids' dumplib.c:(.text+0x385e): undefined reference to
nc_inq_typeids'
dumplib.c:(.text+0x38e6): undefined reference to nc_inq_user_type' dumplib.c:(.text+0x3989): undefined reference to
nc_inq_grpname_full'
dumplib.c:(.text+0x39db): undefined reference to nc_inq_grpname_full' dumplib.c:(.text+0x3b79): undefined reference to
nc_inq_compound_field'
dumplib.c:(.text+0x3bf4): undefined reference to nc_inq_compound_field' dumplib.c:(.text+0x3e26): undefined reference to
nc_inq_grps'
dumplib.c:(.text+0x3e82): undefined reference to nc_inq_grps' CMakeFiles/ncdump-json.dir/src/dumplib.c.o: In function
isrecvar':
dumplib.c:(.text+0x415b): undefined reference to nc_inq_unlimdims' dumplib.c:(.text+0x41a6): undefined reference to
nc_inq_unlimdims'
CMakeFiles/ncdump-json.dir/src/dumplib.c.o: In function get_type_name': dumplib.c:(.text+0x44c7): undefined reference to
nc_inq_user_type'
CMakeFiles/ncdump-json.dir/src/dumplib.c.o: In function print_type_name': dumplib.c:(.text+0x45dc): undefined reference to
nc_inq_typeids'
dumplib.c:(.text+0x463d): undefined reference to nc_inq_typeids' dumplib.c:(.text+0x4718): undefined reference to
nc_inq_grp_parent'
CMakeFiles/ncdump-json.dir/src/ncdump.c.o: In function pr_att': ncdump.c:(.text+0x158b): undefined reference to
nc_free_string'
ncdump.c:(.text+0x15d3): undefined reference to nc_inq_user_type' ncdump.c:(.text+0x190e): undefined reference to
nc_inq_enum_ident'
CMakeFiles/ncdump-json.dir/src/ncdump.c.o: In function pr_att_specials': ncdump.c:(.text+0x1b07): undefined reference to
nc_inq_var_chunking'
ncdump.c:(.text+0x1bad): undefined reference to nc_inq_var_chunking' ncdump.c:(.text+0x1c98): undefined reference to
nc_inq_var_deflate'
ncdump.c:(.text+0x1d2a): undefined reference to nc_inq_var_fletcher32' ncdump.c:(.text+0x1da4): undefined reference to
nc_inq_var_endian'
ncdump.c:(.text+0x1e76): undefined reference to nc_inq_var_fill' CMakeFiles/ncdump-json.dir/src/ncdump.c.o: In function
print_enum_type':
ncdump.c:(.text+0x23e4): undefined reference to nc_inq_user_type' ncdump.c:(.text+0x2520): undefined reference to
nc_inq_enum_member'
CMakeFiles/ncdump-json.dir/src/ncdump.c.o: In function print_ud_type': ncdump.c:(.text+0x26f1): undefined reference to
nc_inq_user_type'
ncdump.c:(.text+0x289a): undefined reference to nc_inq_compound_field' CMakeFiles/ncdump-json.dir/src/ncdump.c.o: In function
do_ncdump_rec':
ncdump.c:(.text+0x306a): undefined reference to nc_inq_typeids' ncdump.c:(.text+0x30e7): undefined reference to
nc_inq_typeids'
ncdump.c:(.text+0x32e0): undefined reference to nc_inq_dimids' ncdump.c:(.text+0x331c): undefined reference to
nc_inq_unlimdims'
ncdump.c:(.text+0x3372): undefined reference to nc_inq_unlimdims' ncdump.c:(.text+0x4224): undefined reference to
nc_inq_grps'
ncdump.c:(.text+0x4284): undefined reference to nc_inq_grps' ncdump.c:(.text+0x42e3): undefined reference to
nc_inq_grpname'
CMakeFiles/ncdump-json.dir/src/ncdump.c.o: In function nc_inq_varname_count': ncdump.c:(.text+0x4df4): undefined reference to
nc_inq_grps'
ncdump.c:(.text+0x4e3f): undefined reference to nc_inq_grps' CMakeFiles/ncdump-json.dir/src/nciter.c.o: In function
nc_get_iter':
nciter.c:(.text+0x277): undefined reference to nc_inq_var_chunking' nciter.c:(.text+0x2c4): undefined reference to
nc_inq_var_chunking'
collect2: error: ld returned 1 exit status
make[2]: *** [ncdump-json] Error 1
make[1]: *** [CMakeFiles/ncdump-json.dir/all] Error 2
make: *** [all] Error 2
In the instructions it said that on $make warning would come up. I got 4 warnings and 7 errors.
Here's what I got:
Scanning dependencies of target ncdump-json
[ 16%] Building C object CMakeFiles/ncdump-json.dir/src/dumplib.c.o
In file included from /Users/malarout/Desktop/ncdump-json/src/dumplib.c:24:
/Users/malarout/Desktop/ncdump-json/src/dumplib.h:53:15: error: expected parameter
declarator
extern size_t strlcat(char *dst, const char *src, size_t siz);
^
/usr/include/secure/_string.h:111:44: note: expanded from macro 'strlcat'
__builtin___strlcat_chk (dest, src, len, __darwin_obsz (dest))
^
/usr/include/secure/_common.h:39:62: note: expanded from macro '__darwin_obsz'
#define __darwin_obsz(object) __builtin_object_size (object, _USE_FORTIFY_LEVEL > ...
^
/usr/include/secure/_common.h:30:32: note: expanded from macro '_USE_FORTIFY_LEVEL'
^
In file included from /Users/malarout/Desktop/ncdump-json/src/dumplib.c:24:
/Users/malarout/Desktop/ncdump-json/src/dumplib.h:53:15: error: expected ')'
/usr/include/secure/_string.h:111:44: note: expanded from macro 'strlcat'
__builtin___strlcat_chk (dest, src, len, __darwin_obsz (dest))
^
/usr/include/secure/_common.h:39:62: note: expanded from macro '__darwin_obsz'
#define __darwin_obsz(object) __builtin_object_size (object, _USE_FORTIFY_LEVEL > ...
^
/usr/include/secure/_common.h:30:32: note: expanded from macro '_USE_FORTIFY_LEVEL'
^
/Users/malarout/Desktop/ncdump-json/src/dumplib.h:53:15: note: to match this '('
/usr/include/secure/_string.h:111:44: note: expanded from macro 'strlcat'
__builtin___strlcat_chk (dest, src, len, __darwin_obsz (dest))
^
/usr/include/secure/_common.h:39:53: note: expanded from macro '__darwin_obsz'
^
In file included from /Users/malarout/Desktop/ncdump-json/src/dumplib.c:24:
/Users/malarout/Desktop/ncdump-json/src/dumplib.h:53:15: warning: type specifier missing,
defaults to 'int' [-Wimplicit-int]
extern size_t strlcat(char _dst, const char *src, size_t siz);
^
/usr/include/secure/_string.h:111:44: note: expanded from macro 'strlcat'
__builtin___strlcat_chk (dest, src, len, __darwin_obsz (dest))
^
/usr/include/secure/_common.h:39:31: note: expanded from macro '__darwin_obsz'
#define __darwin_obsz(object) __builtin_object_size (object, _USE_FORTIFY_LEVEL > ...
^
In file included from /Users/malarout/Desktop/ncdump-json/src/dumplib.c:24:
/Users/malarout/Desktop/ncdump-json/src/dumplib.h:53:15: error: conflicting types for
'__builtin___strlcat_chk'
/usr/include/secure/_string.h:111:3: note: expanded from macro 'strlcat'
__builtin___strlcat_chk (dest, src, len, __darwin_obsz (dest))
^
/Users/malarout/Desktop/ncdump-json/src/dumplib.h:53:15: note: '__builtin___strlcat_chk' is
a builtin with type 'unsigned long (char *, const char *, unsigned long, unsigned
long)'
/usr/include/secure/_string.h:111:3: note: expanded from macro 'strlcat'
__builtin___strlcat_chk (dest, src, len, __darwin_obsz (dest))
^
/Users/malarout/Desktop/ncdump-json/src/dumplib.c:165:1: error: expected parameter
declarator
strlcat(char *dst, const char *src, size_t siz) {
^
/usr/include/secure/_string.h:111:44: note: expanded from macro 'strlcat'
__builtin___strlcat_chk (dest, src, len, __darwin_obsz (dest))
^
/usr/include/secure/_common.h:39:62: note: expanded from macro '__darwin_obsz'
#define __darwin_obsz(object) __builtin_object_size (object, _USE_FORTIFY_LEVEL > ...
^
/usr/include/secure/_common.h:30:32: note: expanded from macro '_USE_FORTIFY_LEVEL'
^
/Users/malarout/Desktop/ncdump-json/src/dumplib.c:165:1: error: expected ')'
/usr/include/secure/_string.h:111:44: note: expanded from macro 'strlcat'
__builtin___strlcat_chk (dest, src, len, __darwin_obsz (dest))
^
/usr/include/secure/_common.h:39:62: note: expanded from macro '__darwin_obsz'
#define __darwin_obsz(object) __builtin_object_size (object, _USE_FORTIFY_LEVEL > ...
^
/usr/include/secure/_common.h:30:32: note: expanded from macro '_USE_FORTIFY_LEVEL'
^
/Users/malarout/Desktop/ncdump-json/src/dumplib.c:165:1: note: to match this '('
/usr/include/secure/_string.h:111:44: note: expanded from macro 'strlcat'
__builtin___strlcat_chk (dest, src, len, __darwin_obsz (dest))
^
/usr/include/secure/_common.h:39:53: note: expanded from macro '__darwin_obsz'
#define __darwin_obsz(object) __builtin_object_size (object, _USE_FORTIFY_LEVEL > ...
^
/Users/malarout/Desktop/ncdump-json/src/dumplib.c:165:1: warning: type specifier missing,
defaults to 'int' [-Wimplicit-int]
strlcat(char *dst, const char *src, size_t siz) {
^
/usr/include/secure/_string.h:111:44: note: expanded from macro 'strlcat'
__builtin___strlcat_chk (dest, src, len, __darwin_obsz (dest))
^
/usr/include/secure/_common.h:39:31: note: expanded from macro '__darwin_obsz'
#define __darwin_obsz(object) __builtin_object_size (object, _USE_FORTIFY_LEVEL > ...
^
/Users/malarout/Desktop/ncdump-json/src/dumplib.c:165:1: error: conflicting types for
'__builtin___strlcat_chk'
/usr/include/secure/_string.h:111:3: note: expanded from macro 'strlcat'
__builtin___strlcat_chk (dest, src, len, __darwin_obsz (dest))
^
/Users/malarout/Desktop/ncdump-json/src/dumplib.h:53:15: note: '__builtin___strlcat_chk' is
a builtin with type 'unsigned long (char *, const char *, unsigned long, unsigned
long)'
extern size_t strlcat(char *dst, const char *src, size_t siz);
^
/usr/include/secure/_string.h:111:3: note: expanded from macro 'strlcat'
__builtin___strlcat_chk (dest, src, len, __darwin_obsz (dest))
^
/Users/malarout/Desktop/ncdump-json/src/dumplib.c:165:1: error: definition of builtin
function '__builtin___strlcat_chk'
strlcat(char *dst, const char *src, size_t siz) {
^
/usr/include/secure/_string.h:111:3: note: expanded from macro 'strlcat'
__builtin___strlcat_chk (dest, src, len, __darwin_obsz (dest))
^
/Users/malarout/Desktop/ncdump-json/src/dumplib.c:820:40: warning: data argument not used
by format string [-Wformat-extra-args]
snprintf(sout, PRIM_LEN, "null", NCDL_NANF);
~~~~~~ ^
/Users/malarout/Desktop/ncdump-json/src/dumplib.c:807:19: note: expanded from macro
'NCDL_NANF'
#define NCDL_NANF "NaNf"
^
/usr/include/secure/_stdio.h:57:62: note: expanded from macro 'snprintf'
__builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), VA_ARGS)
^
/Users/malarout/Desktop/ncdump-json/src/dumplib.c:998:28: warning: format string is not a
string literal (potentially insecure) [-Wformat-security]
snprintf(sp, prelen + 1, prefix);
^~~~~~
/usr/include/secure/stdio.h:57:62: note: expanded from macro 'snprintf'
__builtin___snprintf_chk (str, len, 0, __darwin_obsz(str), VA_ARGS)
^
4 warnings and 7 errors generated.
make[2]: ** [CMakeFiles/ncdump-json.dir/src/dumplib.c.o] Error 1
make[1]: *** [CMakeFiles/ncdump-json.dir/all] Error 2
make: *** [all] Error 2
Can someone please help me out with this?
CMakeFiles/ncdump-json.dir/src/ncdump.c.o: In function main': /path/ncdump-json-r13/src/ncdump.c:(.text+0x6e6): undefined reference to
nc__testurl'
/path/ncdump-json-r13/src/ncdump.c:(.text+0x892): undefined reference to `nc__testurl'
if the cdl is a netcdf4 group type of file, ncdump-json produce an empty {} in the beginning of the json dump.
Hi, jllodra,
I am quite sure netcdf (v4.3.0) has been installed on NCAR yellowstone supercomputer. However, when I typed cmake . I got the error message like:
-- checking for module 'netcdf'
-- package 'netcdf' not found
I tried to change netcdf version (4.1.1) to (4.3.0), but still failed.
The staff at NCAR supercomputer center replied me saying that: "unfortunately it (ncdump-json) has some dependencies that are not easy to work around on yellowstone".
Any suggestions? What file should I modify ?
cfluzheng
hello, libnetcdf-dev this lib how to install on mac ? please tell me ?thanks!
Currently the run_tests.sh script is not testing the output of ncdump-json, just if the command should run.
I also believe that more cdls can be add to the testing suite (unidata has a lot of them). I think the best way to handle this is a list of the file locations (or http locations) so you could load the file, run ncdump-json in all entries, and test a json reader on the output.
Cheers
我尝试转换数据,但是我需要一份数据提供参考
The current release (r14) will not build on FreeBSD 12.1.
The first error is that make
cannot find netcdf.h. Once that issue was solved for, make
was unable to link libraries.
After some experimenting...I found the following to work for me:
Modified the CMakeFileLists.txt to include:
include_directories(/usr/local/include)
FILE(GLOB Netcdf_LIBRARIES "/usr/local/lib/libnetcdf.so")
Download and unzip project tree to some directory like /home/user/ncdump-json
[user@server]# yum install cmake
[user@server]# yum install netcdf-devel
[user@server]# cd /home/user/ncdump-json
[user@server]# cmake . -DCMAKE_EXE_LINKER_FLAGS="-lm"
[user@server]# make
[user@server]# make install
The last three steps look like this:
[user@server]# cmake . -DCMAKE_EXE_LINKER_FLAGS="-lm"
-- Configuring done
-- Generating done
-- Build files have been written to: /home/user/ncdump-json
[user@server]# make
[ 16%] Building C object CMakeFiles/ncdump-json.dir/src/dumplib.c.o
[ 33%] Building C object CMakeFiles/ncdump-json.dir/src/nciter.c.o
[ 50%] Building C object CMakeFiles/ncdump-json.dir/src/indent.c.o
[ 66%] Building C object CMakeFiles/ncdump-json.dir/src/vardata.c.o
[ 83%] Building C object CMakeFiles/ncdump-json.dir/src/ncdump.c.o
[100%] Building C object CMakeFiles/ncdump-json.dir/src/nctime.c.o
Linking C executable ncdump-json
[100%] Built target ncdump-json
[user@server]# make install
[100%] Built target ncdump-json
Install the project...
-- Install configuration: "Release"
-- Installing: /usr/local/bin/ncdump-json
Not sure, but it seems like it's developed on OSX.
Is it tested on other platforms?
Can make process be more liberal and allow building under Cygwin?
Thanks
If the cdl file has no global attributes, the json dump output of ncdump-json is invalid.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.