如何阅读netcdf4 MinGW?

问题描述

为了让您了解上下文,我正在尝试检查一种填充栅格时间序列中缺失数据的算法(称为 DINEOF)。该算法是用Fortran编写的,我了解到在Win10上运行它需要使用MinGW。

目前,我正在尝试遵循以下准则: http://modb.oce.ulg.ac.be/mediawiki/index.php/DINEOF_for_Windows 但是,我发现自己在这一步很挣扎:

./configure  --disable-netcdf-4  --disable-dap  > config.log
make > make.log
make check > check.log
make install

错误/警告消息:

$ ./configure  --disable-netcdf-4  --disable-dap  > config.log
configure: WARNING: Doxygen not found - documentation will not be built
configure: WARNING: dot not found - will use simple charts in documentation
configure: WARNING: netcdf-4 not enabled; disabling DAP4
$ make > make.log
In file included from ../include/ncdispatch.h:14:0,from dparallel.c:9:
c:\mingw\include\stdio.h:345:12: error: expected '=',',';','asm' or '__attribute__' before '__mingw__snprintf'
 extern int __mingw_stdio_redirect__(snprintf)(char*,size_t,const char*,...);
            ^
make[2]: *** [libdispatch_la-dparallel.lo] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
$ make check > check.log
In file included from ../include/ncdispatch.h:14:0,...);
            ^
make[1]: *** [libdispatch_la-dparallel.lo] Error 1
make: *** [check-recursive] Error 1

解决方法

您使用的说明用于构建 NetCDF 4.5.0,但最新的是 4.7.4,可以使用 cmake 构建。对我来说,以下内容适用于 http://winlibs.com/ 的 GCC 10.2.0(前提是存在):

wget -c https://www.unidata.ucar.edu/downloads/netcdf/ftp/netcdf-c-4.7.4.tar.gz
tar xfz netcdf-c-4.7.4.tar.gz
cd netcdf-c-4.7.4

# fix conflicting getopt in include/XGetopt.h
mv include/XGetopt.h include/XGetopt.h.bak &&
echo "#include <getopt.h>" > include/XGetopt.h

cmake.exe -Wno-dev -G"MSYS Makefiles" -DCMAKE_INSTALL_PREFIX:PATH=../../netcdf_build -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_SHARED_LIBS:BOOL=ON -DBUILD_DLL:BOOL=ON -DENABLE_DLL:BOOL=ON -DENABLE_CDF5:BOOL=OFF -DENABLE_HDF4:BOOL=ON -DENABLE_XGETOPT:BOOL=OFF -DENABLE_MMAP:BOOL=OFF -DENABLE_LOGGING:BOOL=OFF -DENABLE_EXAMPLES:BOOL=OFF -DBUILD_TESTING:BOOL=OFF -DBUILD_TESTSETS:BOOL=OFF -DENABLE_EXTRA_TESTS:BOOL=OFF -DENABLE_LARGE_FILE_TESTS:BOOL=OFF -DENABLE_FILTER_TESTING:BOOL=OFF -DENABLE_HDF4_FILE_TESTS:BOOL=OFF -DENABLE_TESTS:BOOL=OFF -DENABLE_UNIT_TESTS:BOOL=OFF -DCMAKE_C_FLAGS:STRING="-fcommon" -S. -Bbuild_shared &&
make -Cbuild_shared install/strip &&
echo SUCCESS

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...