[cmor] 38/190: 2010-08-19 : dimensions were always stored as double regardless of what the table wanted. Fixed 2010-08-19 : go thru cmor_create_path to figure out isfixed and set frequency, even if directory layout is not required. 2010-08-19 : checker: works with version number of format major.minor.patch 2010-08-19 : checker: update git url from wich to fetch md5s tables 2010-08-19 : forcings attribute can now end with notes in between parenthesis
Alastair McKinstry
mckinstry at moszumanska.debian.org
Tue Jul 21 12:54:34 UTC 2015
This is an automated email from the git hooks/post-receive script.
mckinstry pushed a commit to branch debian/master
in repository cmor.
commit 8287573d82284e1e34b863745eb4d415dc617015
Author: Charles Doutriaux <doutriaux1 at llnl.gov>
Date: Thu Aug 19 11:19:59 2010 -0700
2010-08-19 : dimensions were always stored as double regardless of what the table wanted. Fixed
2010-08-19 : go thru cmor_create_path to figure out isfixed and set frequency, even if directory layout is not required.
2010-08-19 : checker: works with version number of format major.minor.patch
2010-08-19 : checker: update git url from wich to fetch md5s tables
2010-08-19 : forcings attribute can now end with notes in between parenthesis
---
Lib/check_CMOR_compliant.py | 5 ++---
Lib/pywrapper.py | 2 ++
RELEASE-NOTES | 5 +++++
Src/_cmormodule.c | 1 +
Src/cmor.c | 40 +++++++++++++++++++++++++++++++++++++---
Src/cmor_variables.c | 7 ++++++-
6 files changed, 53 insertions(+), 7 deletions(-)
diff --git a/Lib/check_CMOR_compliant.py b/Lib/check_CMOR_compliant.py
index 2e4d3ad..959f5cc 100644
--- a/Lib/check_CMOR_compliant.py
+++ b/Lib/check_CMOR_compliant.py
@@ -15,7 +15,7 @@ try:
except:
try:
import urllib2
- url=urllib2.urlopen("http://esg-repo.llnl.gov/gitweb/?p=cmor.git;a=blob_plain;f=Tables/md5s;hb=HEAD")
+ url=urllib2.urlopen("http://esgf.org/gitweb/?p=cmip5-cmor-tables.git;a=blob_plain;f=Tables/md5s;hb=HEAD")
ctrl_md5s=eval(url.read())
url.close()
del(url)
@@ -239,7 +239,6 @@ def checkCMOR(fout,file,table,noerror=cmor.CMOR_CRITICAL,variable=None,from_boun
## Axes[a]['out_name']='eta'
ver = e['general'].get('cmor_version',2.0)
- ver = '%g' % float(ver)
spver = ver.split('.')
major = int(spver[0])
if major>1:
@@ -386,7 +385,7 @@ def checkCMOR(fout,file,table,noerror=cmor.CMOR_CRITICAL,variable=None,from_boun
if not ok:
nerr+=manageLog(fout, noerror, 'parent_experiment_id file attribute must be one of : %s, you have: %s' % (str(shrt_vals), fval) )
elif att == 'forcing':
- sp = fval.split(',')
+ sp = fval.split("(")[0].split(',')
forcings=e['general'].get("forcings")
for vl in sp:
if not vl.strip() in forcings:
diff --git a/Lib/pywrapper.py b/Lib/pywrapper.py
index 1ff9a37..ec6ac65 100644
--- a/Lib/pywrapper.py
+++ b/Lib/pywrapper.py
@@ -541,6 +541,8 @@ def zfactor(zaxis_id,zfactor_name,units="",axis_ids=None,type=None,zfactor_value
bnds.append(zfactor_bounds[-1][1])
zfactor_bounds=numpy.array(bnds)
axis_ids = axis_ids.astype('i')
+
+ print "sending",zaxis_id,zfactor_name,units,ndims,axis_ids,type,zfactor_values,zfactor_bounds
return _cmor.zfactor(zaxis_id,zfactor_name,units,ndims,axis_ids,type,zfactor_values,zfactor_bounds)
def write(var_id,data,ntimes_passed=None,file_suffix="",time_vals=None,time_bnds=None,store_with=None):
diff --git a/RELEASE-NOTES b/RELEASE-NOTES
index dea6e58..0251b07 100644
--- a/RELEASE-NOTES
+++ b/RELEASE-NOTES
@@ -1,3 +1,8 @@
+2010-08-19 : dimensions were always stored as double regardless of what the table wanted. Fixed
+2010-08-19 : go thru cmor_create_path to figure out isfixed and set frequency, even if directory layout is not required.
+2010-08-19 : checker: works with version number of format major.minor.patch
+2010-08-19 : checker: update git url from wich to fetch md5s tables
+2010-08-19 : forcings attribute can now end with notes in between parenthesis
2010-08-18 : added a check for cmor_variables making sure axes/grid ids passed are valid
2010-08-18 : downgraded abs min/max CRITICAL error to NORMAL
2010-08-18 : dowgraded invalid min/max from NORMAL error to WARNING
diff --git a/Src/_cmormodule.c b/Src/_cmormodule.c
index 1987caa..5c8c75b 100644
--- a/Src/_cmormodule.c
+++ b/Src/_cmormodule.c
@@ -467,6 +467,7 @@ static PyObject *
bounds = (void *)bounds_array->data;
}
+ printf("ok sending %i, %i, %s, %s, %i, %i, %c\n",zvar_id,axis_id, name, units, ndims, axes_ids[0], type);
ierr = cmor_zfactor(&zvar_id,axis_id, name, units, ndims, axes_ids, type, values, bounds);
if (axes!=NULL) {Py_DECREF(axes);}
if (values_array!=NULL) {Py_DECREF(values_array);}
diff --git a/Src/cmor.c b/Src/cmor.c
index 93734f1..8ec6f01 100644
--- a/Src/cmor.c
+++ b/Src/cmor.c
@@ -64,8 +64,11 @@ void cmor_check_forcing_validity(int table_id,char *value) {
if (cmor_tables[table_id].nforcings==0) return;
strcpy(astr,value);
+ found=0;
for (i=0;i<strlen(astr);i++) {
if (astr[i]==',') astr[i]=' ';
+ /* removes everything after first paranthesis */
+ if (astr[i]=='(') astr[i]='\0';
}
cmor_convert_string_to_list(astr,'c',(void **)&bstr,&n);
if (n==0) return;
@@ -1772,6 +1775,7 @@ int cmor_write(int var_id,void *data, char type, char *suffix, int ntimes_passed
isfixed = cmor_create_output_path(var_id,outname);
}
else {
+ isfixed = cmor_create_output_path(var_id,msg);
strncpytrim(outname,cmor_current_dataset.outpath,CMOR_MAX_STRING);
}
strncat(outname,"/",CMOR_MAX_STRING-strlen(outname));
@@ -2433,7 +2437,22 @@ int cmor_write(int var_id,void *data, char type, char *suffix, int ntimes_passed
for (i=0;i<cmor_vars[var_id].ndims;i++) {
if (cmor_axes[cmor_vars[var_id].axes_ids[i]].store_in_netcdf == 0) continue;
if (cmor_axes[cmor_vars[var_id].axes_ids[i]].cvalues == NULL) {
- ierr = nc_def_var(ncid,cmor_axes[cmor_vars[var_id].axes_ids[i]].id,NC_DOUBLE,1,&nc_dim[i],&nc_vars[i]);
+ /* first we need to figure out the output type */
+ switch (cmor_tables[cmor_axes[cmor_vars[var_id].axes_ids[i]].ref_table_id].axes[cmor_axes[cmor_vars[var_id].axes_ids[i]].ref_axis_id].type) {
+ case ('f') :
+ j = NC_FLOAT;
+ break;
+ case('d') :
+ j = NC_DOUBLE;
+ break;
+ case ('i') :
+ j= NC_INT;
+ break;
+ default:
+ j=NC_DOUBLE;
+ break;
+ }
+ ierr = nc_def_var(ncid,cmor_axes[cmor_vars[var_id].axes_ids[i]].id,j,1,&nc_dim[i],&nc_vars[i]);
if (ierr != NC_NOERR) {snprintf(msg,CMOR_MAX_STRING, "NetCDF Error (%i) for variable %s error defining dim var: %i (%s)",ierr,cmor_vars[var_id].id,i,cmor_axes[cmor_vars[var_id].axes_ids[i]].id);cmor_handle_error(msg,CMOR_CRITICAL);}
/* /\* table are different ? *\/ */
@@ -2462,7 +2481,7 @@ int cmor_write(int var_id,void *data, char type, char *suffix, int ntimes_passed
nc_vars_af[i]=nc_vars[i];
if (ncid!=ncafid) {
- ierr = nc_def_var(ncafid,cmor_axes[cmor_vars[var_id].axes_ids[i]].id,NC_DOUBLE,1,&nc_dim_af[i],&nc_vars_af[i]);
+ ierr = nc_def_var(ncafid,cmor_axes[cmor_vars[var_id].axes_ids[i]].id,j,1,&nc_dim_af[i],&nc_vars_af[i]);
if (ierr != NC_NOERR) {snprintf(msg,CMOR_MAX_STRING, "NetCDF Error (%i) for variable %s error defining dim var: %i (%s) in metafile",ierr,cmor_vars[var_id].id,i,cmor_axes[cmor_vars[var_id].axes_ids[i]].id);cmor_handle_error(msg,CMOR_CRITICAL);}
/* Compression stuff */
@@ -2534,7 +2553,21 @@ int cmor_write(int var_id,void *data, char type, char *suffix, int ntimes_passed
}
dims_bnds_ids[0]=nc_dim[i];
dims_bnds_ids[1]=dim_bnds;
- ierr = nc_def_var(ncafid,ctmp,NC_DOUBLE,2,&dims_bnds_ids[0],&nc_bnds_vars[i]);
+ switch (cmor_tables[cmor_axes[cmor_vars[var_id].axes_ids[i]].ref_table_id].axes[cmor_axes[cmor_vars[var_id].axes_ids[i]].ref_axis_id].type) {
+ case ('f') :
+ j = NC_FLOAT;
+ break;
+ case('d') :
+ j = NC_DOUBLE;
+ break;
+ case ('i') :
+ j= NC_INT;
+ break;
+ default:
+ j=NC_DOUBLE;
+ break;
+ }
+ ierr = nc_def_var(ncafid,ctmp,j,2,&dims_bnds_ids[0],&nc_bnds_vars[i]);
if (ierr != NC_NOERR) {snprintf(msg,CMOR_MAX_STRING, "NetCDF Error (%i) for variable %s error defining bounds dim var: %i (%s)",ierr,cmor_vars[var_id].id,i,cmor_axes[cmor_vars[var_id].axes_ids[i]].id);cmor_handle_error(msg,CMOR_CRITICAL);}
/* Compression stuff */
@@ -3351,6 +3384,7 @@ int cmor_create_output_path(int var_id,char *outpath)
cmor_handle_error(tmp,CMOR_CRITICAL);
}
}
+
cmor_set_cur_dataset_attribute("frequency",tmp,1);
/* realm */
diff --git a/Src/cmor_variables.c b/Src/cmor_variables.c
index 9ee88fb..c85cc83 100644
--- a/Src/cmor_variables.c
+++ b/Src/cmor_variables.c
@@ -212,6 +212,7 @@ int cmor_zfactor (int *zvar_id,int axis_id, char *name, char *units, int ndims,
/* printf("in zf:%s, %s, %i, %i\n",name,cmor_axes[axis_id].id,ndims,axes_ids[0]); */
/* printf("in zf:%s, %s, %i, %i\n",name,cmor_axes[axis_id].id,cmor_axes[axis_id].hybrid_out,cmor_axes[axis_id].hybrid_in); */
if (cmor_axes[axis_id].hybrid_out==cmor_axes[axis_id].hybrid_in) { /* no it's a normal hybrid, no conv */
+ printf("this cmor var: %s, %s, %i, %i, %c\n",name,units,ndims,axes_ids[0],type);
i = cmor_variable(&var_id,name,units,ndims,axes_ids,type,NULL,NULL,NULL,NULL,NULL,NULL);
cmor_vars[var_id].needsinit=0;
cmor_vars[var_id].zaxis=axis_id;
@@ -688,12 +689,13 @@ int cmor_variable(int *var_id, char *name, char *units, int ndims, int axes_ids[
/* before anything we copy axes_ids into laxes_ids */
for (i=0;i<ndims;i++) {
laxes_ids[i] = axes_ids[i];
- /* printf("%s: axes[%i] = %i\n",cmor_vars[vrid].id,i,laxes_ids[i]); */
+ printf("%s: axes[%i] = %i\n",cmor_vars[vrid].id,i,laxes_ids[i]);
}
lndims=ndims;
aint=0; /* just to know if we deal with a grid */
/* ok we need to replace grids definitions with the grid axes */
for (i=0;i<ndims;i++) {
+ printf("ok lookinga t axes: %i, %s\n",laxes_ids[i],refvar.id);
if (laxes_ids[i]>cmor_naxes) {
sprintf(msg,"For variable (%s) you requested axis_id (%i) that has not been defined yet",cmor_vars[vrid].id,laxes_ids[i]);
cmor_handle_error(msg,CMOR_CRITICAL);
@@ -728,6 +730,7 @@ int cmor_variable(int *var_id, char *name, char *units, int ndims, int axes_ids[
}
/* for(i=0;i<refvar.ndims;i++) fprintf(stderr,"after the grid id section: %i, id: %i\n",i,laxes_ids[i]); */
olndims = lndims;
+ printf("ok: %i, %i, %i\n",refvar.ndims,aint,lndims);
if (refvar.ndims+aint!=lndims) {
lndims=0;
/* ok before we panic we check if there is a "dummy" dim */
@@ -755,9 +758,11 @@ int cmor_variable(int *var_id, char *name, char *units, int ndims, int axes_ids[
j-=1;
/* ok then we create a dummy axis that we will add at the end of the axes */
if (cmor_tables[CMOR_TABLE].axes[refvar.dimensions[i]].bounds_value[0]!=1.e20) {
+ printf("what!!!!\n");
ierr = cmor_axis(&k,cmor_tables[CMOR_TABLE].axes[refvar.dimensions[i]].id,cmor_tables[CMOR_TABLE].axes[refvar.dimensions[i]].units,1,&cmor_tables[CMOR_TABLE].axes[refvar.dimensions[i]].value,'d',&cmor_tables[CMOR_TABLE].axes[refvar.dimensions[i]].bounds_value[0],2,"");
}
else {
+ printf("CRAPPY\n");
ierr = cmor_axis(&k,cmor_tables[CMOR_TABLE].axes[refvar.dimensions[i]].id,cmor_tables[CMOR_TABLE].axes[refvar.dimensions[i]].units,1,&cmor_tables[CMOR_TABLE].axes[refvar.dimensions[i]].value,'d',NULL,0,"");
}
laxes_ids[ndims+lndims]=k;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/cmor.git
More information about the debian-science-commits
mailing list