Skip to content

Commit 43fc04b

Browse files
committed
Cleaned up wrapper code for EEMD function (ceemdan) and added it to our build system.
This function requires the GSL (GNU Scientific Library), so I added a BuildEEMD macro to handle this. This is a new package we will have to add to our build system, including conda!
1 parent 8fd91bf commit 43fc04b

File tree

9 files changed

+294
-78
lines changed

9 files changed

+294
-78
lines changed

Configure

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,8 @@ set buildhdf5=`$makecmd HDF5STUFF`
169169
echo -n "..."
170170
set buildgrib2=`$makecmd GRIB2STUFF`
171171
echo -n "..."
172+
set buildeemd=`$makecmd EEMDSTUFF`
173+
echo -n "..."
172174
set buildv5d=`$makecmd V5DSTUFF`
173175
echo -n "..."
174176
# set buildpyngl=`$makecmd PYNGLSTUFF`
@@ -699,6 +701,34 @@ if ("$buildncl" == "y" || "$buildncl" == "Y") then
699701
set altered
700702
endif
701703
704+
#
705+
# EEMD
706+
#
707+
if ($?verbose_option) then
708+
cat <<"EOF"
709+
======================================================================
710+
711+
If you want to use the EEMD routine, you must download
712+
and install the GSL library.
713+
714+
THIS LIBRARY IS NOT NEEDED FOR BUILDING NCAR GRAPHICS.
715+
716+
======================================================================
717+
"EOF"
718+
endif
719+
720+
echo ""
721+
echo "Build EEMD support (optional) into NCL? ($buildeemd)"
722+
echo "(Requires GSL ftp://ftp.gnu.org/gnu/gsl/"
723+
echo -n "Enter Return (default), y(yes), n(no), or q(quit) > "
724+
set answer="$<"
725+
if ("$answer" == "q") goto cleanup
726+
if (("$answer" != "") && ("$answer" != "$buildeemd")) then
727+
set buildeemd = $answer
728+
set newbuildeemd
729+
set altered
730+
endif
731+
702732
#
703733
# GRIDSPEC
704734
#
@@ -1364,6 +1394,15 @@ if ($?newbuildgrib2) then
13641394
endif
13651395
endif
13661396

1397+
if ($?newbuildeemd) then
1398+
if ("$buildeemd" == "y") then
1399+
echo "#define BuildEEMD 1" >> Site.local
1400+
else
1401+
echo "#define BuildEEMD 0" >> Site.local
1402+
echo "#define EEMDlib" >> Site.local
1403+
endif
1404+
endif
1405+
13671406
if ($?newbuildv5d) then
13681407
if ("$buildv5d" == "y") then
13691408
echo "#define BuildV5D 1" >> Site.local

config/Project

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,14 @@
9393
#endif
9494
#endif /* BuildGRIB2 */
9595

96+
#ifndef BuildEEMD
97+
#define BuildEEMD
98+
#else
99+
#if !BuildEEMD
100+
#undef BuildEEMD
101+
#endif
102+
#endif /* BuildEEMD */
103+
96104
#ifndef BuildTRIANGLE
97105
#define BuildTRIANGLE
98106
#else
@@ -238,12 +246,12 @@
238246
#endif /* PNGlib */
239247

240248
#ifndef CAIROlib
241-
#define CAIROlib -lcairo -lfontconfig -lpixman-1 -lfreetype -lexpat -lpng -lz -lpthread -lXrender -lbz2
249+
#define CAIROlib -lcairo -lXrender -lfontconfig -lpixman-1 -lfreetype -lexpat -lpng -lz -liconv -lbz2
242250
#endif
243251

244252
/* This should be same as CAIROlib except with no explicit paths */
245253
#ifndef CAIROlibuser
246-
#define CAIROlibuser -lcairo -lfontconfig -lpixman-1 -lfreetype -lexpat -lpng -lz -lpthread -lXrender -lbz2
254+
#define CAIROlibuser -lcairo -lXrender -lfontconfig -lpixman-1 -lfreetype -lexpat -lpng -lz -liconv -lbz2
247255
#endif
248256

249257
#ifdef BuildHDFEOS
@@ -298,6 +306,10 @@
298306
#define GRIB2lib -lgrib2c -ljasper -lpng -lz -ljpeg
299307
#endif /* GRIB2lib */
300308

309+
#ifndef EEMDlib
310+
#define EEMDlib -lgsl
311+
#endif /* EEMDlib */
312+
301313
#ifndef NetCDFlib
302314
#define NetCDFlib -lnetcdf -lcurl
303315
/*#define NetCDFlib -lnetcdf -lcurl -lssl -lidn -lrt -lldap */
@@ -666,6 +678,7 @@ HDFEOS5LIB = HDFEOS5lib
666678
HDF5LIB = HDF5lib
667679
GDALLIB = GDALlib
668680
GRIB2LIB = GRIB2lib
681+
EEMDLIB = EEMDlib
669682
UDUNITSLIB = UdUnitslib
670683
V5DLIB = V5Dlib
671684
OpenCLLIB = OpenCLlib

install/make-external/build_external

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
# jasper-x.y.z Required if you want GRIB2 support
5353
# g2clib-x.y.z Required if you want GRIB2 support
5454
# gdal-x.y.z Required if you want GDAL support
55+
# gsl-x.y.z Required (for EEMD function)
5556
# netcdf-x.y.z Required (classic NetCDF-4 support is optional)
5657
# proj-x.y.z Required if you want GDAL support
5758
# udunits-x.y.z Required if you want ut_calendar/ut_inv_calendar
@@ -236,6 +237,7 @@ EXPAT_DIR="expat-2.2.0"
236237
FREETYPE_DIR="freetype-2.6.5"
237238
G2CLIB_DIR="g2clib-1.6.0-patch"
238239
GDAL_DIR="gdal-2.1.1"
240+
GSL_DIR="gsl-2.2.1"
239241
HDF4_DIR="hdf-4.2.12"
240242
HDF5_DIR="hdf5-1.8.17"
241243
HDFEOS_DIR="hdfeos-2.19"
@@ -279,8 +281,9 @@ INSTALL_HDFEOS=1
279281
INSTALL_NETCDF4=1
280282
INSTALL_NETCDF4_FORTRAN=1
281283
INSTALL_PROJ4=1
282-
INSTALL_GDAL=1
283284
INSTALL_G2CLIB=1
285+
INSTALL_GDAL=1
286+
INSTALL_GSL=1
284287
INSTALL_UDUNITS=1
285288
INSTALL_EXPAT=1
286289
INSTALL_FREETYPE=1
@@ -397,6 +400,10 @@ if [ $INSTALL_G2CLIB ] && [ ! -d $G2CLIB_DIR ] ; then
397400
echo "$G2CLIB_DIR does not exist"
398401
exit
399402
fi
403+
if [ $INSTALL_GSL ] && [ ! -d $GSL_DIR ] ; then
404+
echo "$GSL_DIR does not exist"
405+
exit
406+
fi
400407
if [ $INSTALL_UDUNITS ] && [ ! -d $UDUNITS_DIR ] ; then
401408
echo "$UDUNITS_DIR does not exist"
402409
exit
@@ -1064,6 +1071,38 @@ else
10641071
echo "Not building GDAL..."
10651072
fi
10661073

1074+
#--------------------------------------------------------------------
1075+
# GSL
1076+
#--------------------------------------------------------------------
1077+
if [ $INSTALL_GSL ] ; then
1078+
if [ -d "$GSL_DIR" ] ; then
1079+
cd $GSL_DIR
1080+
if [ $CLEAN_BEFORE ] ; then
1081+
echo "Cleaning $GSL_DIR before making..."
1082+
make distclean
1083+
make clean
1084+
fi
1085+
echo "Building $GSL_DIR..."
1086+
./configure --prefix\=$PREFIX --disable-shared --enable-static
1087+
make all install
1088+
make install
1089+
if [ $? ] ; then
1090+
echo "$GSL_DIR build successful."
1091+
if [ $CLEAN_AFTER ] ; then
1092+
echo "Cleaning $GSL_DIR after making..."
1093+
make distclean
1094+
make clean
1095+
fi
1096+
else
1097+
echo "$GSL_DIR build NOT successful."
1098+
fi
1099+
cd ..
1100+
else
1101+
echo "Directory $GSL_DIR doesn't exist"
1102+
fi
1103+
else
1104+
echo "Not building GSL..."
1105+
fi
10671106

10681107
#--------------------------------------------------------------------
10691108
# Udunits

0 commit comments

Comments
 (0)