Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress selected orphan opendap attributes #376

Merged
merged 4 commits into from
Mar 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ This file contains a high-level description of this package's evolution. Release

## 4.4.2 - TBD

* [Upgrade] Update utf8proc.[ch] to use the version now maintained by the
Julia Language project (https://github.com/JuliaLang/utf8proc/blob/master/LICENSE.md).
* [Upgrade][Bug] Corrected an issue regarding how "orphaned" DAS attributes were handled. See [GitHub #376](https://github.com/Unidata/netcdf-c/pull/376) for more information.
* [Upgrade] Update utf8proc.[ch] to use the version now maintained by the Julia Language project (https://github.com/JuliaLang/utf8proc/blob/master/LICENSE.md).
* [Bug] Addressed conversion problem with Windows sscanf. This primarily affected some OPeNDAP URLs on Windows. See [GitHub #365](https://github.com/Unidata/netcdf-c/issues/365) and [GitHub #366](https://github.com/Unidata/netcdf-c/issues/366) for more information.
* [Enhancement] Added support for HDF5 collective metadata operations when available. Patch submitted by Greg Sjaardema, see [Pull request #335](https://github.com/Unidata/netcdf-c/pull/335) for more information.
* [Bug] Addressed a potential type punning issue. See [GitHub #351](https://github.com/Unidata/netcdf-c/issues/351) for more information.
Expand Down
30 changes: 15 additions & 15 deletions libdap2/env
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ alias xx="cd ..;make; cd libdap2"
PARMS=""; ARGS=""; CON="" ; CE=""; OCON="" ; VAR=""; SHARP='#'
alias q0=;alias qq=;alias qv=;alias q=;alias qh=;alias qqh=;alias qall=;alias qv=;alias qo=;

F="http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/ncep.reanalysis.dailyavgs/pressure/air.1947.nc"
F='https://cida.usgs.gov/thredds/dodsC/new_gmo?longitude[0:1:461],latitude[0:1:221],time[0:1:22644]'

if test -e "/cygdrive/f/git/netcdf-c" ; then
TOP="/cygdrive/f/git/netcdf-c"
elif test -e "/cygdrive/d/git/netcdf-c" ; then
if test -e "/cygdrive/d/git/netcdf-c" ; then
TOP="/cygdrive/d/git/netcdf-c"
elif test -e "/cygdrive/f/git/netcdf-c" ; then
TOP="/cygdrive/f/git/netcdf-c"
elif test -e "/home/dmh/git/netcdf-c" ; then
TOP="/home/dmh/git/netcdf-c"
else
Expand All @@ -25,15 +25,15 @@ fi
P=`pwd`

PARMS="log"
#PARMS="${PARMS}&netcdf3"
#PARMS="${PARMS}&fetch=disk"
#PARMS="${PARMS}&cache"
#PARMS="${PARMS}&nocache"
#PARMS="${PARMS}&wholevar"
PARMS="${PARMS}&show=fetch"
#PARMS="${PARMS}&noprefetch"
#PARMS="${PARMS}&prefetch"
#PARMS="${PARMS}&prefetch=eager"
#PARMS="${PARMS}[netcdf3]"
#PARMS="${PARMS}[fetch=disk]"
#PARMS="${PARMS}[cache]"
#PARMS="${PARMS}[nocache]"
#PARMS="${PARMS}[wholevar]"
PARMS="${PARMS}[show=fetch]"
#PARMS="${PARMS}[noprefetch]"
#PARMS="${PARMS}[prefetch]"
#PARMS="${PARMS}[prefetch=eager]"
PARMS="[log][cache][noprefetch]"

VARGS="--leak-check=full"
Expand All @@ -52,10 +52,9 @@ if test "x$PROG" = x ; then
PROG="../ncdump/ncdump"
fi

if test "x$PARMS" != "x" ; then PARMS="\#$PARMS"; fi
U="$F"
if test "x$CON" != "x" ; then U="$U?$CON"; fi
UALL="$U${PARMS}"
UALL="${PARMS}$U"
#ARGS="-h $ARGS"
#ARGS="-w $ARGS"
#ARGS="-c $ARGS"
Expand Down Expand Up @@ -133,4 +132,5 @@ F="http://nomads.ncep.noaa.gov:9090/dods/gens/gens20140123/gep_all_12z"
VAR=prmslmsl
F="http://data.nodc.noaa.gov/thredds/dodsC/testdata/pathfinderAgg/pathFinderV5.2_night.ncml"
CON="sst_dtime.sst_dtime"
F="http://www.esrl.noaa.gov/psd/thredds/dodsC/Datasets/ncep.reanalysis.dailyavgs/pressure/air.1947.nc"
fi
4 changes: 0 additions & 4 deletions ncdap_test/expectremote3/test.01.1.dmp
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ variables:
"Ph.D" ;
:Facility.DataCenter = "COAS Environmental Computer Facility" ;
:Facility.DrifterType = "MetOcean WOCE/OCM" ;
:b.Description = "A test byte" ;
:b.units = "unknown" ;
:i32.Description = "A 32 bit test server int" ;
:i32.units = "unknown" ;
data:

f64 = 1000 ;
Expand Down
4 changes: 0 additions & 4 deletions ncdap_test/expectremote3/test.07.1.dmp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ variables:
"Ph.D" ;
:Facility.DataCenter = "COAS Environmental Computer Facility" ;
:Facility.DrifterType = "MetOcean WOCE/OCM" ;
:b.Description = "A test byte" ;
:b.units = "unknown" ;
:i32.Description = "A 32 bit test server int" ;
:i32.units = "unknown" ;
data:

person.age = 1, 2, 3, 5, 8 ;
Expand Down
4 changes: 0 additions & 4 deletions ncdap_test/expectremote3/test.07.3.dmp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ variables:
"Ph.D" ;
:Facility.DataCenter = "COAS Environmental Computer Facility" ;
:Facility.DrifterType = "MetOcean WOCE/OCM" ;
:b.Description = "A test byte" ;
:b.units = "unknown" ;
:i32.Description = "A 32 bit test server int" ;
:i32.units = "unknown" ;
data:

person.name =
Expand Down
4 changes: 0 additions & 4 deletions ncdap_test/expectremote3/test.07.4.dmp
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ variables:
"Ph.D" ;
:Facility.DataCenter = "COAS Environmental Computer Facility" ;
:Facility.DrifterType = "MetOcean WOCE/OCM" ;
:b.Description = "A test byte" ;
:b.units = "unknown" ;
:i32.Description = "A 32 bit test server int" ;
:i32.units = "unknown" ;
data:

types.f32 = 0, 0.9999833, 1.999867, 2.99955, 3.998933 ;
Expand Down
2 changes: 1 addition & 1 deletion ncdap_test/tst_remote.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
set -x

set -e

quiet=0
Expand Down
38 changes: 31 additions & 7 deletions oc2/ocnode.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ static const unsigned int MAX_UINT = 0xffffffff;

static OCerror mergedas1(OCnode* dds, OCnode* das);
static OCerror mergedods1(OCnode* dds, OCnode* das);
static OCerror mergeother1(OCnode* root, OCnode* das);
static char* pathtostring(OClist* path, char* separator);
static void computefullname(OCnode* node);
static OCerror mergeother1(OCnode* root, OCnode* das);
static OCerror mergeother(OCnode* ddsroot, OClist* dasnodes);

/* Process ocnodes to fix various semantic issues*/
void
Expand Down Expand Up @@ -334,13 +335,14 @@ ocddsdasmerge(OCstate* state, OCnode* dasroot, OCnode* ddsroot)
if(das == NULL) continue;
mergedods1(ddsroot,das);
}

/* 6. Assign other orphan attributes, which means
construct their full name and assign as a global attribute. */
for(i=0;i<oclistlength(dasnodes);i++) {
OCnode* das = (OCnode*)oclistget(dasnodes,i);
if(das == NULL) continue;
mergeother1(ddsroot, das);
}
construct their full name and assign as a global attribute.
This is complicated because some servers (e.g. thredds) returns
attributes for variables that were not referenced in the DDS.
These we continue to suppress.
*/
mergeother(ddsroot,dasnodes);

done:
/* cleanup*/
Expand All @@ -362,6 +364,11 @@ mergedas1(OCnode* dds, OCnode* das)
for(i=0;i<oclistlength(das->subnodes);i++) {
OCnode* attnode = (OCnode*)oclistget(das->subnodes,i);
if(attnode->octype == OC_Attribute) {
if(dds->octype == OC_Atomic
|| dds->octype == OC_Sequence
|| dds->octype == OC_Structure
|| dds->octype == OC_Grid)
attnode->att.var = dds;
OCattribute* att = makeattribute(attnode->name,
attnode->etype,
attnode->att.values);
Expand Down Expand Up @@ -406,6 +413,19 @@ mergedods1(OCnode* dds, OCnode* dods)
return OCTHROW(stat);
}

static OCerror
mergeother(OCnode* ddsroot, OClist* dasnodes)
{
OCerror stat = OC_NOERR;
int i;
for(i=0;i<oclistlength(dasnodes);i++) {
OCnode* das = (OCnode*)oclistget(dasnodes,i);
if(das == NULL) continue;
if((stat = mergeother1(ddsroot, das))) break;
}
return stat;
}

static OCerror
mergeother1(OCnode* root, OCnode* das)
{
Expand All @@ -415,6 +435,9 @@ mergeother1(OCnode* root, OCnode* das)
OCASSERT(root != NULL);
if(root->attributes == NULL) root->attributes = oclistnew();

/* Only include if this is not connected to a variable */
if(das->att.var != NULL) goto done;

if(das->octype == OC_Attribute) {
/* compute the full name of this attribute */
computefullname(das);
Expand All @@ -431,6 +454,7 @@ mergeother1(OCnode* root, OCnode* das)
}
} else
stat = OC_EDAS;
done:
return OCTHROW(stat);
}

Expand Down
1 change: 1 addition & 0 deletions oc2/ocnode.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ typedef struct OCattinfo {
int isglobal; /* is this supposed to be a global attribute set?*/
int isdods; /* is this a global DODS_XXX attribute set */
OClist* values; /* oclist<char*>*/
struct OCnode* var; /* containing var else null */
} OCattinfo;

/*! Specifies the OCnode. */
Expand Down