Merged latest from trunk.

This commit is contained in:
Ward Fisher 2013-03-25 19:46:16 +00:00
commit f0f14fce22
17 changed files with 58 additions and 39 deletions

View File

@ -317,7 +317,7 @@ int nc4_pg_varm(NC_PG_T pg, NC *nc, int ncid, int varid, const size_t *startp,
const size_t *countp, const ptrdiff_t *stridep,
const ptrdiff_t *imapp, nc_type xtype, int is_long, void *op);
int nc4_rec_match_dimscales(NC_GRP_INFO_T *grp);
int nc4_rec_write_metadata(NC_GRP_INFO_T *grp);
int nc4_rec_write_metadata(NC_GRP_INFO_T *grp, int bad_coord_order);
int nc4_rec_write_types(NC_GRP_INFO_T *grp);
int nc4_enddef_netcdf4_file(NC_HDF5_FILE_INFO_T *h5);
int nc4_reopen_dataset(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var);

View File

@ -258,7 +258,7 @@ fix::
done
##################################################
T=civ2
T=test_vara
v::
cc -g -c ${T}.c ${INCL}

View File

@ -245,7 +245,7 @@ dcemergeprojections(DCEprojection* merged, DCEprojection* addition)
that can be used with the url
*/
static char*
char*
buildprojectionstring(NClist* projections)
{
char* pstring;
@ -256,7 +256,7 @@ buildprojectionstring(NClist* projections)
return pstring;
}
static char*
char*
buildselectionstring(NClist* selections)
{
NCbytes* buf = ncbytesnew();
@ -267,7 +267,7 @@ buildselectionstring(NClist* selections)
return sstring;
}
static char*
char*
buildconstraintstring(DCEconstraint* constraints)
{
NCbytes* buf = ncbytesnew();

View File

@ -136,6 +136,14 @@ extern size_t dcesafeindex(DCEsegment* seg, size_t start, size_t stop);
/* Compute segment size for start upto stop */
extern size_t dcesegmentsize(DCEsegment*, size_t start, size_t stop);
/* Convert a DCE projection/selection/constraint instance into a string
that can be used with a url. Caller must free returned string.
*/
extern char* buildprojectionstring(NClist* projections);
extern char* buildselectionstring(NClist* selections);
extern char* buildconstraintstring(DCEconstraint* constraints);
extern int dceverbose;
#endif /*DCECONSTRAINTS_H*/

View File

@ -695,7 +695,8 @@ findfield(CDFnode* node, CDFnode* field)
}
static int
#ifdef EXTERN_UNUSED
int
nc3d_getvarmx(int ncid, int varid,
const size_t *start,
const size_t *edges,
@ -879,6 +880,7 @@ fprintf(stderr,"old: %lu -> %lu %f\n",
done:
return ncstat;
}
#endif /*EXTERN_UNUSED*/
static int
conversionrequired(nc_type t1, nc_type t2)

View File

@ -79,14 +79,15 @@ main()
size_t start[RANK];
size_t count[RANK];
char URL[4096];
const char* svc = NULL:
const char* svc = NULL;
/* Find Test Server *.
/* Find Test Server */
svc = NC_findtestserver("dts");
if(svc == NULL) {
fprintf(stderr,"Cannot locate test server\n");
exit(1);
}
printf("Using test server: %s\n",svc);
strcpy(URL,svc);
strcat(URL,DTSTEST);

View File

@ -31,11 +31,13 @@ static struct NCPROTOCOLLIST {
against future changes.
*/
static const char* servers[] = {
"http://motherlode.ucar.edu:8081", /* try this first */
"http://remotetest.unidata.ucar.edu",
"http://remotetest.ucar.edu",
"http://thredds-test.ucar.edu",
"http://thredds.ucar.edu",
"http://motherlode.ucar.edu:8081",
"http://motherlode.ucar.edu:8080",
"http://motherlode.ucar.edu",
"http://remotetest.unidata.ucar.edu",
"http://remotetest.ucar.edu",
"http://remotetests.unidata.ucar.edu",
"http://remotetests.ucar.edu",
NULL

View File

@ -4,7 +4,7 @@
#include <string.h>
#include <netcdf.h>
#define URL "http://motherlode.ucar.edu:8081/dts/test.02"
#define URL "http://thredds-test.ucar.edu/dts/test.02"
#define VAR "i32"
#define ERRCODE 2

View File

@ -2961,9 +2961,10 @@ sync_netcdf4_file(NC_HDF5_FILE_INFO_T *h5)
/* Write any metadata that has changed. */
if (!(h5->cmode & NC_NOWRITE))
{
int bad_coord_order = 0; /* if detected, propagate to all groups to consistently store dimids */
if ((retval = nc4_rec_write_types(h5->root_grp)))
return retval;
if ((retval = nc4_rec_write_metadata(h5->root_grp)))
if ((retval = nc4_rec_write_metadata(h5->root_grp, bad_coord_order)))
return retval;
}

View File

@ -1420,9 +1420,12 @@ var_create_dataset(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var, int write_dimid)
maxdimsize[d] = var->dim[d]->unlimited ? H5S_UNLIMITED : (hsize_t)var->dim[d]->len;
chunksize[d] = var->chunksizes[d];*/
for (d = 0; d < var->ndims; d++)
for (g = grp; g && (dims_found < var->ndims); g = g->parent)
for (dim = g->dim; dim; dim = dim->next)
for (d = 0; d < var->ndims; d++)
{
for (g = grp; g && (dims_found < var->ndims); g = g->parent)
{
for (dim = g->dim; dim; dim = dim->next)
{
if (dim->dimid == var->dimids[d])
{
dimsize[d] = dim->unlimited ? NC_HDF5_UNLIMITED_DIMSIZE : dim->len;
@ -1456,6 +1459,9 @@ var_create_dataset(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var, int write_dimid)
dims_found++;
break;
}
}
}
}
if (var->contiguous)
{
@ -2420,20 +2426,20 @@ write_dim(NC_DIM_INFO_T *dim, NC_GRP_INFO_T *grp, int write_dimid)
}
/* Recursively write all the metadata in a group. Groups and types
* have all already been written. */
* have all already been written. Propagate bad cooordinate order to
* subgroups, if detected. */
int
nc4_rec_write_metadata(NC_GRP_INFO_T *grp)
nc4_rec_write_metadata(NC_GRP_INFO_T *grp, int bad_coord_order)
{
NC_DIM_INFO_T *dim;
NC_VAR_INFO_T *var;
NC_GRP_INFO_T *child_grp;
int found_coord, coord_varid = -1, wrote_coord;
int bad_coord_order = 0;
int last_dimid = -1;
int retval;
assert(grp && grp->name && grp->hdf_grpid);
LOG((3, "nc4_rec_write_metadata: grp->name %s", grp->name));
LOG((3, "nc4_rec_write_metadata: grp->name %s, bad_coord_order %d", grp->name, bad_coord_order));
/* Write global attributes for this group. */
if ((retval = write_attlist(grp->att, NC_GLOBAL, grp)))
@ -2516,7 +2522,7 @@ nc4_rec_write_metadata(NC_GRP_INFO_T *grp)
/* If there are any child groups, write their metadata. */
for (child_grp = grp->children; child_grp; child_grp = child_grp->next)
if ((retval = nc4_rec_write_metadata(child_grp)))
if ((retval = nc4_rec_write_metadata(child_grp, bad_coord_order)))
return retval;
return NC_NOERR;

View File

@ -668,7 +668,8 @@ nc4_dim_list_add(NC_DIM_INFO_T **list)
}
/* Add to the beginning of a dim list. */
static int
#ifdef EXTERN_UNUSED
int
nc4_dim_list_add2(NC_DIM_INFO_T **list, NC_DIM_INFO_T **new_dim)
{
NC_DIM_INFO_T *dim;
@ -684,6 +685,7 @@ nc4_dim_list_add2(NC_DIM_INFO_T **list, NC_DIM_INFO_T **new_dim)
*new_dim = dim;
return NC_NOERR;
}
#endif
/* Add to the end of an att list. */
int

View File

@ -361,7 +361,6 @@ nc_def_var_nc4(int ncid, const char *name, nc_type xtype,
NC_HDF5_FILE_INFO_T *h5;
NC_TYPE_INFO_T *type_info;
char norm_name[NC_MAX_NAME + 1];
int new_varid = 0;
int num_unlim = 0;
int d;
size_t num_values = 1;
@ -415,10 +414,6 @@ nc_def_var_nc4(int ncid, const char *name, nc_type xtype,
if (h5->no_write)
return NC_EPERM;
/* Get the new varid. */
for (var = grp->var; var; var = var->next)
new_varid++;
/* Check all the dimids to make sure they exist. */
for (d = 0; d < ndims; d++)
{

View File

@ -120,8 +120,6 @@ tst_att_ordering(int cmode)
int
main(int argc, char **argv)
{
(void) signal(SIGFPE, SIG_IGN);
signed char schar_in[ATT_LEN], schar_out[ATT_LEN] = {NC_MIN_BYTE, 1, NC_MAX_BYTE};
unsigned char uchar_in[ATT_LEN];
short short_in[ATT_LEN], short_out[ATT_LEN] = {NC_MIN_SHORT, -128, NC_MAX_SHORT};
@ -136,6 +134,8 @@ main(int argc, char **argv)
unsigned long long ulonglong_in[ATT_LEN] = {NC_MAX_UINT64, NC_MAX_UINT64, NC_MAX_UINT64};
unsigned long long ulonglong_out[ATT_LEN] = {0LL, 128LL, 3123456789LL};
(void) signal(SIGFPE, SIG_IGN);
printf("\n*** Testing netcdf-3 attribute functions.\n");
printf("*** testing really simple global atts...");
#define NUM_SIMPLE_ATTS 9

View File

@ -124,7 +124,7 @@ argo_all.cdp;1;&location.LATITUDE<1&location.LATITUDE>-1\
# Test string access
# this test cannot be used because the
# dataset has a limited lifetime
#REMOTEURLC4="http://motherlode.ucar.edu:$PORT/thredds/dodsC/station/metar"
#REMOTEURLC4="http://thredds-test.ucar.edu/thredds/dodsC/station/metar"
#REMOTETESTSC4="\
#Surface_METAR_20120101_0000.nc;1;weather[0:10]"

View File

@ -42,9 +42,9 @@ EXPECTED="${srcdir}/expecttds3"
# Special test info
##################################################
# TDS files under 10 megabytes
# TDS Catalog: http://motherlode.ucar.edu:8080/thredds/catalog/public/dataset/catalog.html
# TDS Catalog: http://thredds.ucar.edu/thredds/catalog/public/dataset/catalog.html
TDSURL1="http://motherlode.ucar.edu:8080/thredds/dodsC/public/dataset"
TDSURL1="http://thredds.ucar.edu/thredds/dodsC/public/dataset"
TDSTESTS1="\
tst-striped.nc \
tst-PROFILER_RASS.nc \

View File

@ -963,14 +963,10 @@ OCerror
oc_data_fieldbyname(OCobject link, OCobject datanode, const char* name, OCobject* fieldp)
{
OCerror err = OC_NOERR;
OCstate* state;
OCdata* data;
size_t count,i;
OCobject ddsnode;
OCVERIFY(OC_State,link);
OCDEREF(OCstate*,state,link);
OCVERIFY(OC_Data,datanode);
OCDEREF(OCdata*,data,datanode);
/* Get the dds node for this datanode */
err = oc_data_ddsnode(link,datanode,&ddsnode);

View File

@ -46,7 +46,8 @@ ocstrncmp(const char* s1, const char* s2, size_t len)
}
static void
#ifdef EXTERN_UNUSEd
void
makedimlist(OClist* path, OClist* dims)
{
unsigned int i,j;
@ -59,6 +60,7 @@ makedimlist(OClist* path, OClist* dims)
}
}
}
#endif
void
ocfreeprojectionclause(OCprojectionclause* clause)
@ -76,7 +78,8 @@ ocfreeprojectionclause(OCprojectionclause* clause)
free(clause);
}
static void
#ifdef EXTERN_UNUSED
void
freeAttributes(OClist* attset)
{
unsigned int i,j;
@ -93,8 +96,10 @@ freeAttributes(OClist* attset)
}
}
}
#endif
static void
#ifdef EXTERN_UNUSED
void
freeOCnode(OCnode* cdf, int deep)
{
unsigned int i;
@ -113,6 +118,7 @@ freeOCnode(OCnode* cdf, int deep)
}
free(cdf);
}
#endif
int
ocfindbod(OCbytes* buffer, size_t* bodp, size_t* ddslenp)