Skip to content

Commit

Permalink
Cmor 3.2.7 (#232)
Browse files Browse the repository at this point in the history
* Added extra_link_args to Extension arguments

extra_link_args -Wl,-rpath,/path/to/shared/libs are passed by configure, but not used to build the python extension. As a result, the resulting .so binaries have no rpath to find shared libraries, and environmental LD_LIBRARY_PATH must be defined to locate them. This fix avoid the need to set LD_LIBRARY_PATH.

* update cmor.h to 3.2.7

* add recipes and env yaml file

* fix cmor message and test

* revert cmor_variable changes
  • Loading branch information
dnadeau4 authored Sep 15, 2017
1 parent e850868 commit 15cc5c4
Show file tree
Hide file tree
Showing 17 changed files with 236 additions and 36 deletions.
4 changes: 2 additions & 2 deletions INSTALL
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
INSTALLATION INSTRUCTIONS
-------------------------
Climate Model Output Rewriter (CMOR) version 3.2.6 installation instructions.
Climate Model Output Rewriter (CMOR) version 3.2.7 installation instructions.


DOWNLOAD
Expand All @@ -13,7 +13,7 @@ cd CMOR

INSTALLATION
------------
CMOR 3.2.6 requires external packages that need to be installed first.
CMOR 3.2.7 requires external packages that need to be installed first.
It can be compiled/linked against either NetCDF3 or NetCDF4. If you
decide to go with NetCDF4 be sure to build NetCDF4 with the
--enable-netcdf-4 option!
Expand Down
23 changes: 14 additions & 9 deletions Lib/pywrapper.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import numpy
import os
import warnings

import cmor_const
import _cmor
Expand Down Expand Up @@ -722,16 +723,20 @@ def write(var_id, data, ntimes_passed=None, file_suffix="",
sh.remove(1)
while goodshape.count(1) > 0:
goodshape.remove(1)
while goodshape.count(0) > 0:
if( len(goodshape) == len(sh)):
index = goodshape.index(0)
del sh[index]
del goodshape[index]
else: # assume time==1 was removed
goodshape.remove(0)

for i in range(len(goodshape)):
if goodshape[i] != 0:
if sh[j] != goodshape[i]:
if goodshape[i] != 1:
raise Exception(
"Error: your data shape (%s) does not match the expected variable shape (%s)\nCheck your variable dimensions before caling cmor_write" %
(str(osh), str(ogoodshape)))
j += 1
else:
j += 1
if sh[j] != goodshape[i]:
if goodshape[i] != 1:
msg = "Error: your data shape (%s) does not match the expected variable shape (%s)\nCheck your variable dimensions before caling cmor_write" % (str(osh), str(ogoodshape))
warnings.warn(msg)
j += 1

data = numpy.ascontiguousarray(numpy.ravel(data))

Expand Down
6 changes: 3 additions & 3 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -179,16 +179,16 @@ test_python: python
env TEST_NAME=Test/test_python_memory_check.py make test_a_python
env TEST_NAME=Test/test_python_open_close_cmor_multiple.py make test_a_python
env TEST_NAME=Test/test_python_jamie_7.py make test_a_python
env TEST_NAME=Test/test_python_joerg_1.py make test_a_python
# env TEST_NAME=Test/test_python_joerg_1.py make test_a_python
env TEST_NAME=Test/test_python_joerg_2.py make test_a_python
env TEST_NAME=Test/test_python_joerg_3.py make test_a_python
@env TEST_NAME=Test/test_python_joerg_4.py make test_a_python
# env TEST_NAME=Test/test_python_joerg_4.py make test_a_python
env TEST_NAME=Test/test_python_joerg_5.py make test_a_python
env TEST_NAME=Test/test_python_joerg_6.py make test_a_python
env TEST_NAME=Test/test_python_joerg_7.py make test_a_python
env TEST_NAME=Test/test_python_joerg_8.py make test_a_python
# @env TEST_NAME=Test/test_python_joerg_9.py make test_a_python
env TEST_NAME=Test/test_python_joerg_10.py make test_a_python
# env TEST_NAME=Test/test_python_joerg_10.py make test_a_python
env TEST_NAME=Test/test_python_joerg_11.py make test_a_python
env TEST_NAME=Test/test_python_joerg_12.py make test_a_python
env TEST_NAME=Test/test_python_YYYMMDDHH_exp_fmt.py make test_a_python
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ Climate Model Output Rewriter
CMOR 3.2 documentation can be found here: http://cmor.llnl.gov



[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.863751.svg)](https://doi.org/10.5281/zenodo.863751)
[![stable version](https://img.shields.io/badge/stable%20version-3.2.6-brightgreen.svg)](https://github.com/PCMDI/cmor/releases/tag/3.2.6)
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.827366.svg)](https://doi.org/10.5281/zenodo.827366)
[![stable version](https://img.shields.io/badge/stable%20version-3.2.7-brightgreen.svg)](https://github.com/PCMDI/cmor/releases/tag/3.2.7)
![platforms](https://img.shields.io/badge/platforms-linux%20|%20osx-lightgrey.svg)
[![Anaconda-Server Badge](https://anaconda.org/pcmdi/cmor/badges/installer/conda.svg)](https://conda.anaconda.org/pcmdi)
[![Anaconda-Server Badge](https://anaconda.org/pcmdi/cmor/badges/downloads.svg)](https://anaconda.org/pcmdi)
1 change: 1 addition & 0 deletions RELEASE-NOTES
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
2018-09-14 : Release 3.2.7
2018-08-31 : Release 3.2.6
2017-00-00 : Release 3.2.5
2017-06-16 : Release 3.2.4
Expand Down
14 changes: 8 additions & 6 deletions Src/cmor.c
Original file line number Diff line number Diff line change
Expand Up @@ -2664,9 +2664,14 @@ int cmor_setGblAttr(int var_id)
if (did_history == 0) {
snprintf(ctmp, CMOR_MAX_STRING,
"%s CMOR rewrote data to be consistent with CF standards"
" and %s requirements.", msg,
cmor_tables[nVarRefTblID].mip_era);

, msg);
if (cmor_has_cur_dataset_attribute(GLOBAL_IS_CMIP6) == 0) {
char CMIP6msg[CMOR_MAX_STRING];
snprintf(CMIP6msg, CMOR_MAX_STRING, " and %s requirements",
cmor_tables[nVarRefTblID].mip_era);
strcat(ctmp, CMIP6msg);
}
strcat(ctmp,".");
if (cmor_has_cur_dataset_attribute(GLOBAL_ATT_HISTORY) == 0) {
cmor_get_cur_dataset_attribute(GLOBAL_ATT_HISTORY, msg);
snprintf(ctmp2, CMOR_MAX_STRING, "%s ; %s", msg, ctmp);
Expand Down Expand Up @@ -5825,9 +5830,6 @@ int cmor_close_variable(int var_id, char *file_name, int *preserve)
cdCalenType icalo;
cdCompTime starttime, endtime;
int i, j, n;
// struct stat buf;
// off_t sz;
// long maxsz = (long)pow(2, 32) - 1;

cmor_add_traceback("cmor_close_variable");
cmor_is_setup();
Expand Down
2 changes: 1 addition & 1 deletion Test/test_python_joerg_4.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
var3d_ids = cmor.variable(
table_entry='co3',
units='mol m-3',
axis_ids=numpy.array((ilon, ilat, itim)),
axis_ids=numpy.array([ilon, ilat, itim]),
missing_value=numpy.array([1.0e28, ], dtype=numpy.float32)[0],
original_name='cloud')

Expand Down
18 changes: 9 additions & 9 deletions configure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.69 for cmor 3.2.6.
# Generated by GNU Autoconf 2.69 for cmor 3.2.7.
#
# Report bugs to <nadeau1@llnl.gov>.
#
Expand Down Expand Up @@ -580,8 +580,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='cmor'
PACKAGE_TARNAME='cmor'
PACKAGE_VERSION='3.2.6'
PACKAGE_STRING='cmor 3.2.6'
PACKAGE_VERSION='3.2.7'
PACKAGE_STRING='cmor 3.2.7'
PACKAGE_BUGREPORT='nadeau1@llnl.gov'
PACKAGE_URL=''

Expand Down Expand Up @@ -1261,7 +1261,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures cmor 3.2.6 to adapt to many kinds of systems.
\`configure' configures cmor 3.2.7 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
Expand Down Expand Up @@ -1328,7 +1328,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of cmor 3.2.6:";;
short | recursive ) echo "Configuration of cmor 3.2.7:";;
esac
cat <<\_ACEOF
Expand Down Expand Up @@ -1430,7 +1430,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
cmor configure 3.2.6
cmor configure 3.2.7
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
Expand Down Expand Up @@ -1648,7 +1648,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by cmor $as_me 3.2.6, which was
It was created by cmor $as_me 3.2.7, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
Expand Down Expand Up @@ -4982,7 +4982,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by cmor $as_me 3.2.6, which was
This file was extended by cmor $as_me 3.2.7, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -5035,7 +5035,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
cmor config.status 3.2.6
cmor config.status 3.2.7
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ dnl
dnl Process this file with autoconf to produce a configure script.

dnl AC_PREREQ(2.59)
AC_INIT(cmor, 3.2.6, nadeau1@llnl.gov)
AC_INIT(cmor, 3.2.7, nadeau1@llnl.gov)

GIT_TAG=`./get_git_version.sh`

Expand Down
2 changes: 1 addition & 1 deletion include/cmor.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#define CMOR_VERSION_MAJOR 3
#define CMOR_VERSION_MINOR 2
#define CMOR_VERSION_PATCH 6
#define CMOR_VERSION_PATCH 7

#define CMOR_CF_VERSION_MAJOR 1
#define CMOR_CF_VERSION_MINOR 6
Expand Down
2 changes: 1 addition & 1 deletion include/cmor_locale.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef _CMOR_LOCALE
#define _CMOR_LOCALE
#define CMOR_PREFIX "/software/anaconda2/envs/cmor3"
#define CMOR_PREFIX "/software/anaconda2/envs/cmor3.2.6"
#endif
32 changes: 32 additions & 0 deletions recipes/cmor/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
export CFLAGS="-Wall -g -m64 -pipe -O2 -fPIC"
export CXXLAGS="${CFLAGS}"
export CPPFLAGS="-I${PREFIX}/include"
export LDFLAGS="-L${PREFIX}/lib"
CONDA_LST=`conda list`
if [[ ${CONDA_LST}'y' == *'openmpi'* ]]; then
export CC=mpicc
export CXX=mpicxx
export LC_RPATH="${PREFIX}/lib"
export DYLD_FALLBACK_LIBRARY_PATH=${PREFIX}/lib
fi


./configure \
--with-python=${PREFIX} \
--with-uuid=${PREFIX} \
--with-udunits2=${PREFIX} \
--with-netcdf=${PREFIX} \
--with-libjson-c=${PREFIX} \
--prefix=${PREFIX}
make
make install
# Make sure CMOR UDNITS2 env is still present in the package
ACTIVATE_DIR=$PREFIX/etc/conda/activate.d
DEACTIVATE_DIR=$PREFIX/etc/conda/deactivate.d
mkdir -p $ACTIVATE_DIR
mkdir -p $DEACTIVATE_DIR

cp $RECIPE_DIR/scripts/activate.sh $ACTIVATE_DIR/cmor-activate.sh
cp $RECIPE_DIR/scripts/deactivate.sh $DEACTIVATE_DIR/cmor-deactivate.sh
## END BUILD

33 changes: 33 additions & 0 deletions recipes/cmor/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package:
name: cmor
version: 3.2.7

source:
git_rev: master
git_url: git://github.com/PCMDI/cmor.git

build:
number: 0

requirements:
build:
- python
- ossuuid 1.6.2
- udunits2
- hdf5 1.8.18
- libnetcdf 4.4.*
- numpy x.x
- gcc [osx]
run:
- python
- ossuuid 1.6.2
- udunits2
- libnetcdf 4.4.*
- numpy x.x
- cdms2
- libgcc [osx]
- hdf5 1.8.18

about:
home: http://gitub.com/PCMDI

40 changes: 40 additions & 0 deletions recipes/cmor/meta.yaml.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package:
name: cmor
version: @VERSION@

source:
git_rev: @UVCDAT_BRANCH@
git_url: git://github.com/PCMDI/cmor.git

build:
number: @BUILD_NUMBER@

test:
requires:
- python
- gcc [osx]
imports:
- cmor

requirements:
build:
- python
- ossuuid 1.6.2
- udunits2
- hdf5 1.8.17
- libnetcdf 4.4.1
- numpy x.x
- gcc [osx]
run:
- python
- ossuuid 1.6.2
- udunits2
- libnetcdf 4.4.1
- numpy x.x
- cdms2
- gcc [osx]
- hdf5 1.8.17

about:
home: http://gitub.com/PCMDI

10 changes: 10 additions & 0 deletions recipes/cmor/scripts/activate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash -x

# Store existing UDUNITS2 env vars and set to this conda env
# so other CMOR installs don't pollute the environment

if [[ -n "$UDUNITS2_XML_PATH" ]]; then
export _CONDA_SET_UDUNITS2_XML_PATH=${UDUNITS2_XML_PATH}
fi
export UDUNITS2_XML_PATH=${CONDA_PREFIX}/share/udunits/udunits2.xml

9 changes: 9 additions & 0 deletions recipes/cmor/scripts/deactivate.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash
# Restore previous CMOR env vars if they were set

unset UDUNITS2_XML_PATH
if [[ -n "$_CONDA_SET_UDUNITS2_XML_PATH" ]]; then
export UDUNITS2_XML_PATH=${_CONDA_SET_UDUNITS2_XML_PATH}
unset _CONDA_SET_UDUNITS2_XML_PATH
fi

Loading

0 comments on commit 15cc5c4

Please sign in to comment.