1{ lib, stdenv, fetchurl, curl, hdf5, netcdf, eccodes, python3
2, # build, install and link to a CDI library [default=no]
3 enable_cdi_lib ? false
4, # build a completely statically linked CDO binary
5 enable_all_static ? stdenv.hostPlatform.isStatic
6, # Use CXX as default compiler [default=no]
7 enable_cxx ? false
8}:
9
10stdenv.mkDerivation rec {
11 pname = "cdo";
12 version = "2.2.2";
13
14 # Dependencies
15 buildInputs = [ curl netcdf hdf5 python3 ];
16
17 src = fetchurl {
18 url = "https://code.mpimet.mpg.de/attachments/download/28882/${pname}-${version}.tar.gz";
19 sha256 = "sha256-QZx3MVJEAZr0GilsBQZvR0zMv5Tev6rp4hBtpRvHyTc=";
20 };
21
22 configureFlags = [
23 "--with-netcdf=${netcdf}"
24 "--with-hdf5=${hdf5}"
25 "--with-eccodes=${eccodes}"
26 ]
27 ++ lib.optional enable_cdi_lib "--enable-cdi-lib"
28 ++ lib.optional enable_all_static "--enable-all-static"
29 ++ lib.optional enable_cxx "--enable-cxx";
30
31 meta = with lib; {
32 description = "Collection of command line Operators to manipulate and analyse Climate and NWP model Data";
33 longDescription = ''
34 Supported data formats are GRIB 1/2, netCDF 3/4, SERVICE, EXTRA and IEG.
35 There are more than 600 operators available.
36 '';
37 homepage = "https://code.mpimet.mpg.de/projects/cdo/";
38 license = licenses.bsd3;
39 maintainers = [ maintainers.ltavard ];
40 platforms = with platforms; linux ++ darwin;
41 };
42}