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