mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-12-21 08:39:46 +08:00
97ce621091
re: esupport 31942 * Add a new set of remote tests based on using the opendap hyrax server * Re-enable --enable-dap-remote-tests as default on * Make it possible to query the DMR separate from the DAP so that it is possible to delay reading data until it is actually requested. This make things like ncdump -h much more efficient. * Fix handling of <Map>s in DMRs. * Fix some memory leaks
67 lines
1.4 KiB
C
67 lines
1.4 KiB
C
/*********************************************************************
|
|
* Copyright 2016, UCAR/Unidata
|
|
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
|
|
*********************************************************************/
|
|
|
|
/**
|
|
Test the netcdf-4 data building process.
|
|
*/
|
|
|
|
#include "config.h"
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include "netcdf.h"
|
|
|
|
#define DEBUG
|
|
|
|
static void
|
|
fail(int code)
|
|
{
|
|
if(code != NC_NOERR) {
|
|
fprintf(stderr,"***Fail: %s\n",nc_strerror(code));
|
|
fflush(stderr);
|
|
}
|
|
exit((code==NC_NOERR?EXIT_SUCCESS:EXIT_FAILURE));
|
|
}
|
|
|
|
int
|
|
main(int argc, char** argv)
|
|
{
|
|
int ret = NC_NOERR;
|
|
char url[4096];
|
|
int ncid;
|
|
|
|
/* Skip cmd name */
|
|
argc++;
|
|
argv++;
|
|
|
|
if(argc < 2) {
|
|
fprintf(stderr, "too few arguments: t_dmrdata.c <infile> <outfile>\n");
|
|
fail(NC_NOERR);
|
|
}
|
|
|
|
/* build the url */
|
|
snprintf(url,sizeof(url),"file://%s#dap4&debug=copy",argv[0]);
|
|
if(argc >= 3) {
|
|
strlcat(url,"&substratename=",sizeof(url));
|
|
strlcat(url,argv[1],sizeof(url));
|
|
}
|
|
#ifdef DEBUG
|
|
strlcat(url,"&log",sizeof(url));
|
|
#endif
|
|
|
|
#ifdef DEBUG
|
|
fprintf(stderr,"test_data url=%s\n",url);
|
|
#endif
|
|
|
|
/* Use the open/close mechanism */
|
|
if((ret=nc_open(url,NC_NETCDF4,&ncid))) goto done;
|
|
if((ret=nc_close(ncid))) goto done;
|
|
|
|
done:
|
|
#ifdef DEBUG
|
|
fprintf(stderr,"code=%d %s\n",ret,nc_strerror(ret));
|
|
#endif
|
|
return (ret ? 1 : 0);
|
|
}
|