The Mars Climate Database FAQ
Here are some answers, pointers and comments about frequently asked questions by MCD users.
What is this NetCDF library the MCD needs? (click to expand/fold section)
NetCDF stands for "Network Common Data Form". The NetCDF library is a set of software to read and write self-describing, machine-independent data formats.
The MCD datafiles are written in NetCDF and thus the MCD software
needs the NetCDF library to read them.
You will thus have to download and install the NetCDF (from the official netCDF website) library on your system to use the MCD.
Note that you do not necessarily need recent versions (i.e. 4.x) of the
library, older ones (e.g. 3.6.x) will work nicely (and are easier to install as they do not require also installing the HDF5 and zlib libraries).
Linux users might be interested in the following script
install_netcdf4.0.1.bash to (hopefully) automatically install the 4.0.1 NetCDF library.
Run ./install_netcdf4.0.1.bash -h for available options.
Last updated: May 2018
Common Linux compiling issues (click to expand/fold section)
A good way to check if the MCD compiles and runs well is to try to compile the provided Fortran example "test_mcd.F" using the "compile" script (after having adapted the later to use your favorite compiler and having set the correct paths to your NetCDF installation).
Here are the most often reported issues and how to fix them:
- If you get error messages of the likes of:
undefined reference to `nf__inq_varid_'
undefined reference to `nf_get_var_real_'
etc.
This means the NetCDF Fortran routines are not found by the compiler. Check that you indeed provided the correct path in the "compile" script. If there is no problem with the path, then it might be that your NetCDF installation generated (this is either the default or an option depending on the version of the NetCDF library that is built) separate libraries for C and Fortran (namely libraries libnetcdf.la and libnetcdff.la), you should then specify both when compiling, e.g. :
gfortran test_mcd.F call_mcd.F julian.F heights.F -I. -I$NCDFINC -L$NCDFLIB -lnetcdf -lnetcdff -o test_mcd
- If compilation went fine, but when your run the MCD you get an error of the likes of:
error while loading shared libraries: libnetcdf.so
This means that you are linking with a shared library which is loaded at run-time but that the path to your netcdf library is not included in your LD_LIBRARY_PATH environment variable. You should add the path to your NetCDF library's 'lib' directory to LD_LIBRARY_PATH.
Last updated: May 2016
How to install and run the MCD on Windows? (click to expand/fold section)
We don't usually run on Windows, but here are some steps (thanks to Vladimir Zakharov) illustrating how one would install the MCD (tested on Windows 7 with MS Visual Studio 2012 and Intel Fortran) which you could adapt to your own needs:
- Decompress the MCD tarball MCD5.2.tar.gz for example in C:\Program\
C:\Program\MCD5.2\ should contain (at least):
data\
Sets of data
docs\
User Manual
mcd\
call_mcd.F
constants_mcd.inc
heights.F
julian.F
- Install the NetCDF library (easier with earlier versions of the library) by retrieving a compiled version from the UCAR website, e.g.
ftp://ftp.unidata.ucar.edu/pub/netcdf/contrib/win32/netcdf-ifort-3.6.1.zip
Decompress netcdf-ifort-3.6.1.zip in C:\Program\
C:\Program\netCDF3.6.1\ should contain:
bin\
ncdump.exe
ncgen.exe
include\
netcdf.h
netcdf.inc
netcdf.mod
typesizes.mod
lib\
netcdf.dll
netcdf.exp
netcdf.lib
netcdf_f90.lib
netcdfs.lib
- Compiling the provided test case
Copy from C:\Program\MCD5.2\mcd\ in the working directory:
- The test case source code:
test_mcd.F
test_mcd.def
- The Fortran interface:
call_mcd.F
constants_mcd.inc
heights.F
julian.F
|
|
Add in the Project Properties:
#1 Fortran->General->Additional Include Directories: C:\Program\netCDF3.6.1\include
#2 Fortran->General->Compile time diagnostic: Disable all (by default was Custom)
#3 Linker->General->Additional Library Directories: C:\Program\netCDF3.6.1\lib
#4 Linker->Input->Additional Dependencies: netcdf.lib
Note that you will have to copy C:\Program\netCDF3.6.1\lib\netcdf.dll to the directory where the executable file is to be run.
Last updated: April 2016
How to run the MCD C interface on Windows? (click to expand/fold section)
As a follow-up of "How to install and run the MCD on Windows" above, here is an illustration of how to run the C interface (tested on Windows 7 with
MS Visual Studio 2012 and Intel compilers, thanks to Vladimir Zakharov):
Copy from C:\Program\MCD5.2\mcd\c_interfaces\ in the working directory:
- the test case source code:
test_mcd.c
- the C header:
mcd.h
- The object files (obtained from the Fortran test case)
call_mcd.obj
heights.obj
julian.obj
|
|
Add in the Project Properties:
#1 C/C++->Preprocessor->Preprocessor Definitions: _CRT_SECURE_NO_WARNINGS
#2 C/C++->Advanced->Calling Convention: __cdecl(/Gd)
#3 C/C++->General-> Additional Include Directories: C:\Program\netCDF3.6.1\include
#4 Linker->General-> Additional Library Directories:
C:\Program\netCDF3.6.1\lib and C:\Program Files (x86)\Intel\Composer XE\compiler\lib\ia32
#5 Linker->Input->Additional Dependencies: netcdf.lib and ifconsol.lib
Modify file test_mcd.c :
//char dset[]="../MCD_DATA/";
char dset[]="C:/Program/MCD5.2/data/";
//julian_(&month, &day, &year, &hour, &min, &sec, &ier, &xdate);
JULIAN(&month, &day, &year, &hour, &min, &sec, &ier, &xdate);
//call_mcd_(&zkey,&xz,&xlon,&xlat,&hireskey,
CALL_MCD(&zkey,&xz,&xlon,&xlat,&hireskey,
Note that you will have to copy C:\Program\netCDF3.6.1\lib\netcdf.dll to the directory where the executable file is to be run.
Last updated: April 2016