mirror of
https://github.com/Unidata/netcdf-c.git
synced 2025-03-19 17:30:27 +08:00
Updating files to refer to the top-level COPYRIGHT file.
This commit is contained in:
parent
991dbabfa6
commit
3c59fb860d
@ -1,3 +1,10 @@
|
||||
# Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
|
||||
# 2015, 2016, 2017, 2018
|
||||
# University Corporation for Atmospheric Research/Unidata.
|
||||
|
||||
# See netcdf-c/COPYRIGHT file for more info.
|
||||
|
||||
SET(abs_top_srcdir ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
remove_definitions(-DDLL_EXPORT)
|
||||
|
@ -1,5 +1,5 @@
|
||||
## This is a automake file, part of Unidata's netCDF package.
|
||||
# Copyright 2011, see the COPYRIGHT file for more information.
|
||||
# Copyright 2018, see the COPYRIGHT file for more information.
|
||||
|
||||
# This file builds and runs DAP4 tests.
|
||||
|
||||
|
@ -1,3 +1,10 @@
|
||||
# Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
|
||||
# 2015, 2016, 2017, 2018
|
||||
# University Corporation for Atmospheric Research/Unidata.
|
||||
|
||||
# See netcdf-c/COPYRIGHT file for more info.
|
||||
|
||||
FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*)
|
||||
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
|
||||
|
||||
|
@ -1,3 +1,10 @@
|
||||
# Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
|
||||
# 2015, 2016, 2017, 2018
|
||||
# University Corporation for Atmospheric Research/Unidata.
|
||||
|
||||
# See netcdf-c/COPYRIGHT file for more info.
|
||||
|
||||
FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*)
|
||||
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
|
||||
|
||||
|
@ -1,3 +1,10 @@
|
||||
# Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
|
||||
# 2015, 2016, 2017, 2018
|
||||
# University Corporation for Atmospheric Research/Unidata.
|
||||
|
||||
# See netcdf-c/COPYRIGHT file for more info.
|
||||
|
||||
FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*)
|
||||
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
|
||||
|
||||
|
@ -1,3 +1,10 @@
|
||||
# Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
|
||||
# 2015, 2016, 2017, 2018
|
||||
# University Corporation for Atmospheric Research/Unidata.
|
||||
|
||||
# See netcdf-c/COPYRIGHT file for more info.
|
||||
|
||||
FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*)
|
||||
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
|
||||
|
||||
|
@ -1,3 +1,10 @@
|
||||
# Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
|
||||
# 2015, 2016, 2017, 2018
|
||||
# University Corporation for Atmospheric Research/Unidata.
|
||||
|
||||
# See netcdf-c/COPYRIGHT file for more info.
|
||||
|
||||
FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*)
|
||||
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
|
||||
|
||||
|
@ -1,3 +1,10 @@
|
||||
# Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
|
||||
# 2015, 2016, 2017, 2018
|
||||
# University Corporation for Atmospheric Research/Unidata.
|
||||
|
||||
# See netcdf-c/COPYRIGHT file for more info.
|
||||
|
||||
FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*)
|
||||
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
|
||||
|
||||
|
@ -1,3 +1,10 @@
|
||||
# Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
|
||||
# 2015, 2016, 2017, 2018
|
||||
# University Corporation for Atmospheric Research/Unidata.
|
||||
|
||||
# See netcdf-c/COPYRIGHT file for more info.
|
||||
|
||||
FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*)
|
||||
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
|
||||
|
||||
|
@ -1,3 +1,10 @@
|
||||
# Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
|
||||
# 2015, 2016, 2017, 2018
|
||||
# University Corporation for Atmospheric Research/Unidata.
|
||||
|
||||
# See netcdf-c/COPYRIGHT file for more info.
|
||||
|
||||
FILE(GLOB COPY_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*)
|
||||
FILE(COPY ${COPY_FILES} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/ FILE_PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE)
|
||||
|
||||
|
@ -1,3 +1,10 @@
|
||||
# Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
|
||||
# 2015, 2016, 2017, 2018
|
||||
# University Corporation for Atmospheric Research/Unidata.
|
||||
|
||||
# See netcdf-c/COPYRIGHT file for more info.
|
||||
|
||||
#####
|
||||
# Build doxygen documentation, if need be.
|
||||
#####
|
||||
|
@ -1,37 +0,0 @@
|
||||
/*! \page copyright COPYRIGHT
|
||||
|
||||
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
|
||||
University Corporation for Atmospheric Research/Unidata.
|
||||
|
||||
Portions of this software were developed by the Unidata Program at the
|
||||
University Corporation for Atmospheric Research.
|
||||
|
||||
Access and use of this software shall impose the following obligations
|
||||
and understandings on the user. The user is granted the right, without
|
||||
any fee or cost, to use, copy, modify, alter, enhance and distribute
|
||||
this software, and any derivative works thereof, and its supporting
|
||||
documentation for any purpose whatsoever, provided that this entire
|
||||
notice appears in all copies of the software, derivative works and
|
||||
supporting documentation. Further, UCAR requests that the user credit
|
||||
UCAR/Unidata in any publications that result from the use of this
|
||||
software or in any product that includes this software, although this
|
||||
is not an obligation. The names UCAR and/or Unidata, however, may not
|
||||
be used in any advertising or publicity to endorse or promote any
|
||||
products or commercial entity unless specific written permission is
|
||||
obtained from UCAR/Unidata. The user also understands that
|
||||
UCAR/Unidata is not obligated to provide the user with any support,
|
||||
consulting, training or assistance of any kind with regard to the use,
|
||||
operation and performance of this software nor to provide the user
|
||||
with any updates, revisions, new versions or "bug fixes."
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY UCAR/UNIDATA "AS IS" AND ANY EXPRESS OR
|
||||
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL UCAR/UNIDATA BE LIABLE FOR ANY SPECIAL,
|
||||
INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
|
||||
FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
|
||||
WITH THE ACCESS, USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
*/
|
16
docs/COPYRIGHT.md
Normal file
16
docs/COPYRIGHT.md
Normal file
@ -0,0 +1,16 @@
|
||||
COPYRIGHT {#copyright}
|
||||
=====================
|
||||
|
||||
Copyright 2018 Unidata
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
@ -761,7 +761,7 @@ INPUT = \
|
||||
@abs_top_srcdir@/docs/all-error-codes.md \
|
||||
@abs_top_srcdir@/docs/FAQ.md \
|
||||
@abs_top_srcdir@/docs/known_problems.md \
|
||||
@abs_top_srcdir@/docs/COPYRIGHT.dox \
|
||||
@abs_top_srcdir@/docs/COPYRIGHT.md \
|
||||
@abs_top_srcdir@/docs/credits.md \
|
||||
@abs_top_srcdir@/docs/bestpractices.md \
|
||||
@abs_top_srcdir@/docs/tutorial.dox \
|
||||
|
@ -1,6 +1,10 @@
|
||||
## This is a automake file, part of Unidata's netCDF package.
|
||||
# Copyright 2005-2011, see the COPYRIGHT file for more information.
|
||||
# This file builds the netcdf documentation.
|
||||
# Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
|
||||
# 2015, 2016, 2017, 2018
|
||||
# University Corporation for Atmospheric Research/Unidata.
|
||||
|
||||
# See netcdf-c/COPYRIGHT file for more info.
|
||||
|
||||
# These files will be included with the dist.
|
||||
EXTRA_DIST = netcdf.m4 DoxygenLayout.xml Doxyfile.in footer.html \
|
||||
|
@ -1,3 +1,10 @@
|
||||
# Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
|
||||
# 2015, 2016, 2017, 2018
|
||||
# University Corporation for Atmospheric Research/Unidata.
|
||||
|
||||
# See netcdf-c/COPYRIGHT file for more info.
|
||||
|
||||
EXTRA_DIST = aqua.jpg chunking2.png compatibility3.png compression.png \
|
||||
groups.png nc4-model.png ncatts.png nc-classic-uml.png nccoords.png \
|
||||
ncfile.png pnetcdf.png terra.jpg netcdf_architecture.png \
|
||||
|
@ -111,4 +111,3 @@ user-defined format. (This is unnecessary if you just want to read
|
||||
HDF4 SD files, since the netCDF C library already includes an HDF4 SD
|
||||
file reader. This user-defined format library uses the same code. It
|
||||
is repackaged as a user-defined library to provide a working sample.)
|
||||
|
||||
|
@ -1,3 +1,10 @@
|
||||
# Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
|
||||
# 2015, 2016, 2017, 2018
|
||||
# University Corporation for Atmospheric Research/Unidata.
|
||||
|
||||
# See netcdf-c/COPYRIGHT file for more info.
|
||||
|
||||
SET(exam_C_tests simple_xy_wr simple_xy_rd sfc_pres_temp_wr sfc_pres_temp_rd pres_temp_4D_wr pres_temp_4D_rd)
|
||||
SET(exam_C_tests_source "")
|
||||
FOREACH(F ${exam_C_tests})
|
||||
|
@ -1,5 +1,5 @@
|
||||
# This is a automake file, part of Unidata's netCDF package.
|
||||
# Copyright 2006, see the COPYRIGHT file for more information.
|
||||
# Copyright 2018, see the COPYRIGHT file for more information.
|
||||
|
||||
# This file builds the C examples.
|
||||
|
||||
|
@ -1,5 +1,17 @@
|
||||
/*! \file
|
||||
|
||||
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
|
||||
2015, 2016, 2017, 2018
|
||||
University Corporation for Atmospheric Research/Unidata.
|
||||
|
||||
See \ref copyright file for more info.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/* This example program is part of Unidata's netCDF library for
|
||||
scientific data access.
|
||||
scientific data access.
|
||||
|
||||
This program demonstrates various ways to create a netCDF file,
|
||||
open an existing file, and close a file.
|
||||
@ -18,7 +30,7 @@
|
||||
printf("Bailing out in file %s, line %d, error:%s.\n", \
|
||||
__FILE__, __LINE__, nc_strerror(e)); \
|
||||
return e; \
|
||||
} while (0)
|
||||
} while (0)
|
||||
|
||||
#define FILENAME "test.nc"
|
||||
#define VARNAME "var1"
|
||||
@ -31,7 +43,7 @@ int
|
||||
main()
|
||||
{
|
||||
/* These are netCDF IDs for file, dimension, and variable. */
|
||||
int ncid, dimid, varid;
|
||||
int ncid, dimid, varid;
|
||||
|
||||
/* This array will hold one ID for each dimension in the
|
||||
variable, in this case, one. */
|
||||
@ -41,7 +53,7 @@ main()
|
||||
int data_out[] = {0,1,2,3,4,5,6,7,8,9};
|
||||
int data_in[DIMLEN];
|
||||
|
||||
int i, res;
|
||||
int i, res;
|
||||
|
||||
/* Create a classic format netCDF file, overwritting any file of
|
||||
this name that may already exist. */
|
||||
@ -99,11 +111,10 @@ main()
|
||||
fprintf(stderr, "Unexpected value!\n");
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
|
||||
/* Close the file again. */
|
||||
if ((res = nc_close(ncid)))
|
||||
BAIL(res);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,17 @@
|
||||
/*! \file
|
||||
|
||||
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
|
||||
2015, 2016, 2017, 2018
|
||||
University Corporation for Atmospheric Research/Unidata.
|
||||
|
||||
See \ref copyright file for more info.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/* This example program is part of Unidata's netCDF library for
|
||||
scientific data access.
|
||||
scientific data access.
|
||||
|
||||
This example shows how to create and deal with files of different
|
||||
netcdf formats (i.e. classic vs. 64-bit-offset).
|
||||
@ -19,7 +31,7 @@
|
||||
printf("Bailing out in file %s, line %d, error:%s.\n", \
|
||||
__FILE__, __LINE__, nc_strerror(e)); \
|
||||
return NC_EXAMPLE_ERROR; \
|
||||
} while (0)
|
||||
} while (0)
|
||||
|
||||
#define NUMDIMS 2
|
||||
#define NUMVARS 1
|
||||
@ -33,7 +45,7 @@ main()
|
||||
float temp[LAT_LEN][LON_LEN], *fp;
|
||||
char classic_file[] = "classic.nc", offset64_file[] = "offset.nc";
|
||||
char *file = classic_file;
|
||||
int i, res;
|
||||
int i, res;
|
||||
|
||||
/* Create a bunch of phoney data so we have something to write in
|
||||
the example file. */
|
||||
@ -59,12 +71,12 @@ main()
|
||||
BAIL(res);
|
||||
if ((res = nc_def_dim(ncid, "longitude", LON_LEN, &dimids[1])))
|
||||
BAIL(res);
|
||||
|
||||
|
||||
/* Define the variable. */
|
||||
if ((res = nc_def_var(ncid, "sfc_temp", NC_FLOAT, NUMDIMS,
|
||||
if ((res = nc_def_var(ncid, "sfc_temp", NC_FLOAT, NUMDIMS,
|
||||
dimids, &temp_varid)))
|
||||
BAIL(res);
|
||||
|
||||
|
||||
/* We're finished defining metadata. */
|
||||
if ((res = nc_enddef(ncid)))
|
||||
BAIL(res);
|
||||
@ -79,4 +91,3 @@ main()
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1,3 +1,14 @@
|
||||
/*! \file
|
||||
|
||||
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
|
||||
2015, 2016, 2017, 2018
|
||||
University Corporation for Atmospheric Research/Unidata.
|
||||
|
||||
See \ref copyright file for more info.
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <netcdf.h>
|
||||
@ -135,7 +146,7 @@ main() { /* create rec2Gp.nc */
|
||||
for(j=0; j<J_LEN; j++) {
|
||||
for (k=0; k<K_LEN; k++) {
|
||||
if (var1[j][k] != (signed char) n) {
|
||||
printf("Error on read, var1[%d, %d, %d, %d] = %d wrong, should be %d !\n", rec, i, j, k, var1[j][k], (signed char) n);
|
||||
printf("Error on read, var1[%d, %d, %d, %d] = %d wrong, should be %d !\n", rec, i, j, k, var1[j][k], (signed char) n);
|
||||
return 1;
|
||||
}
|
||||
n++;
|
||||
|
@ -1,5 +1,16 @@
|
||||
/*! \file
|
||||
|
||||
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
|
||||
2015, 2016, 2017, 2018
|
||||
University Corporation for Atmospheric Research/Unidata.
|
||||
|
||||
See \ref copyright file for more info.
|
||||
|
||||
*/
|
||||
|
||||
/* This example program is part of Unidata's netCDF library for
|
||||
scientific data access.
|
||||
scientific data access.
|
||||
|
||||
This program demonstrates various ways to create netCDF dimensions
|
||||
and variables.
|
||||
@ -35,7 +46,7 @@
|
||||
printf("Bailing out in file %s, line %d, error:%s.\n", \
|
||||
__FILE__, __LINE__, nc_strerror(e)); \
|
||||
return NC_EXAMPLE_ERROR; \
|
||||
} while (0)
|
||||
} while (0)
|
||||
|
||||
#define FILENAME "test.nc"
|
||||
#define NUMDIMS 4
|
||||
@ -118,7 +129,7 @@ main()
|
||||
size_t start[NUMDIMS], count[NUMDIMS];
|
||||
|
||||
float *fp, *ifp;
|
||||
int rec, i, res;
|
||||
int rec, i, res;
|
||||
|
||||
/* Create a bunch of phoney data so we have something to write in
|
||||
the example file. */
|
||||
@ -128,10 +139,10 @@ main()
|
||||
lat[i] = PHONEY_LAT_START + (i * PHONEY_LAT_MULT);
|
||||
for (i=0; i<HEIGHT_LEN; i++)
|
||||
height[i] = i * PHONEY_HEIGHT_INC;
|
||||
for (fp=(float *)temp, ifp=(float *)itemp, i=0;
|
||||
for (fp=(float *)temp, ifp=(float *)itemp, i=0;
|
||||
i<LAT_LEN*LON_LEN; i++)
|
||||
*fp++ = (*ifp++ = PHONEY_TEMP_START) + i/PHONEY_TEMP_DIV;
|
||||
for (fp=(float *)pres, ifp=(float *)ipres, i=0;
|
||||
for (fp=(float *)pres, ifp=(float *)ipres, i=0;
|
||||
i<LAT_LEN*LON_LEN*HEIGHT_LEN; i++)
|
||||
*fp++ = (*ifp++ = PHONEY_PRES_START) - i/PHONEY_PRES_DIV;
|
||||
|
||||
@ -142,7 +153,7 @@ main()
|
||||
/* Store a history string as a file-level attribute. This could
|
||||
store the name of the person or lab producing the data, or any
|
||||
information that applies to the dataset as a whole. */
|
||||
if ((res = nc_put_att_text(ncid, NC_GLOBAL, HISTORY,
|
||||
if ((res = nc_put_att_text(ncid, NC_GLOBAL, HISTORY,
|
||||
strlen(HISTSTR), HISTSTR)))
|
||||
BAIL(res);
|
||||
|
||||
@ -157,23 +168,23 @@ main()
|
||||
BAIL(res);
|
||||
if ((res = nc_def_dim(ncid, LON_NAME, LON_LEN, &lon_dimid)))
|
||||
BAIL(res);
|
||||
if ((res = nc_def_dim(ncid, HEIGHT_NAME, HEIGHT_LEN,
|
||||
if ((res = nc_def_dim(ncid, HEIGHT_NAME, HEIGHT_LEN,
|
||||
&height_dimid)))
|
||||
BAIL(res);
|
||||
|
||||
|
||||
/* Define the variables. Each variable's dimension ids are set in
|
||||
the dimids array before the call to nc_def_var. The first two
|
||||
variables share three dimensions, time, lat and lon. */
|
||||
dimids[0] = time_dimid;
|
||||
dimids[1] = lat_dimid;
|
||||
dimids[2] = lon_dimid;
|
||||
if ((res = nc_def_var(ncid, TEMP_VARNAME, NC_FLOAT, NUMDIMS_3D,
|
||||
if ((res = nc_def_var(ncid, TEMP_VARNAME, NC_FLOAT, NUMDIMS_3D,
|
||||
dimids, &temp_varid)))
|
||||
BAIL(res);
|
||||
|
||||
|
||||
/* For pressure we also add a 4th dimension: height. */
|
||||
dimids[3] = height_dimid;
|
||||
if ((res = nc_def_var(ncid, PRES_VARNAME, NC_FLOAT, NUMDIMS_4D,
|
||||
if ((res = nc_def_var(ncid, PRES_VARNAME, NC_FLOAT, NUMDIMS_4D,
|
||||
dimids, &pres_varid)))
|
||||
BAIL(res);
|
||||
|
||||
@ -181,23 +192,23 @@ main()
|
||||
they don't have a time dimension. */
|
||||
dimids[0] = lat_dimid;
|
||||
dimids[1] = lon_dimid;
|
||||
if ((res = nc_def_var(ncid, INIT_TEMP_VARNAME, NC_FLOAT,
|
||||
if ((res = nc_def_var(ncid, INIT_TEMP_VARNAME, NC_FLOAT,
|
||||
NUMDIMS_2D, dimids, &itemp_varid)))
|
||||
BAIL(res);
|
||||
dimids[2] = height_dimid;
|
||||
if ((res = nc_def_var(ncid, INIT_PRES_VARNAME, NC_FLOAT,
|
||||
if ((res = nc_def_var(ncid, INIT_PRES_VARNAME, NC_FLOAT,
|
||||
NUMDIMS_3D, dimids, &ipres_varid)))
|
||||
BAIL(res);
|
||||
|
||||
/* We'll store the units as attributes for the temperature and
|
||||
pressure variables. */
|
||||
if ((res = nc_put_att_text(ncid, pres_varid, UNITS,
|
||||
if ((res = nc_put_att_text(ncid, pres_varid, UNITS,
|
||||
strlen(MILIBARS), MILIBARS)))
|
||||
BAIL(res);
|
||||
if ((res = nc_put_att_text(ncid, temp_varid, UNITS,
|
||||
if ((res = nc_put_att_text(ncid, temp_varid, UNITS,
|
||||
strlen(CELSIUS), CELSIUS)))
|
||||
BAIL(res);
|
||||
|
||||
|
||||
|
||||
/* In order to store the coordinate axis data we need to define a
|
||||
netCDF variable for each axis we want to store data for. In our
|
||||
@ -208,13 +219,13 @@ main()
|
||||
be the same as the dimension, it will be one-dimensional, with
|
||||
the length of the dimension. As it's dimension, it will be
|
||||
assigned the dimension that it represents. */
|
||||
if ((res = nc_def_var(ncid, LAT_NAME, NC_FLOAT, NUMDIMS_1D,
|
||||
if ((res = nc_def_var(ncid, LAT_NAME, NC_FLOAT, NUMDIMS_1D,
|
||||
&lat_dimid, &lat_varid)))
|
||||
BAIL(res);
|
||||
if ((res = nc_def_var(ncid, LON_NAME, NC_FLOAT, NUMDIMS_1D,
|
||||
if ((res = nc_def_var(ncid, LON_NAME, NC_FLOAT, NUMDIMS_1D,
|
||||
&lon_dimid, &lon_varid)))
|
||||
BAIL(res);
|
||||
if ((res = nc_def_var(ncid, HEIGHT_NAME, NC_INT, NUMDIMS_1D,
|
||||
if ((res = nc_def_var(ncid, HEIGHT_NAME, NC_INT, NUMDIMS_1D,
|
||||
&height_dimid, &height_varid)))
|
||||
BAIL(res);
|
||||
|
||||
@ -251,7 +262,7 @@ main()
|
||||
start[1] = 0;
|
||||
start[2] = 0;
|
||||
start[3] = 0;
|
||||
count[0] = 1;
|
||||
count[0] = 1;
|
||||
count[1] = LAT_LEN;
|
||||
count[2] = LON_LEN;
|
||||
count[3] = HEIGHT_LEN;
|
||||
@ -262,14 +273,14 @@ main()
|
||||
nc_put_vara_<type> function, which can write any array subset
|
||||
of the variable. */
|
||||
start[0] = rec; /* We want to write *this* record. */
|
||||
if ((res = nc_put_vara_float(ncid, temp_varid, start, count,
|
||||
if ((res = nc_put_vara_float(ncid, temp_varid, start, count,
|
||||
(float *)temp)))
|
||||
BAIL(res);
|
||||
if ((res = nc_put_vara_float(ncid, pres_varid, start, count,
|
||||
(float *)pres)))
|
||||
BAIL(res);
|
||||
/* We're done writing one record. */
|
||||
}
|
||||
}
|
||||
|
||||
/* Close the file. We're done, so we can go out and see the new
|
||||
Harry Potter movie! */
|
||||
@ -278,4 +289,3 @@ main()
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -188,4 +188,3 @@ fn_exit:
|
||||
MPI_Finalize();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ temperatures. It is intended to illustrate the use of the netCDF C
|
||||
API. The companion program pres_temp_4D_rd.c shows how to read the
|
||||
netCDF data file created by this program.
|
||||
|
||||
Copyright 2006 University Corporation for Atmospheric
|
||||
Copyright 2018 University Corporation for Atmospheric
|
||||
Research/Unidata. See COPYRIGHT file for conditions of use.
|
||||
*/
|
||||
|
||||
@ -76,7 +76,7 @@ main()
|
||||
|
||||
/* Loop indexes. */
|
||||
int lvl, lat, lon, rec, i = 0;
|
||||
|
||||
|
||||
/* Error handling. */
|
||||
int retval;
|
||||
|
||||
@ -87,7 +87,7 @@ main()
|
||||
lats[lat] = START_LAT + 5.*lat;
|
||||
for (lon = 0; lon < NLON; lon++)
|
||||
lons[lon] = START_LON + 5.*lon;
|
||||
|
||||
|
||||
for (lvl = 0; lvl < NLVL; lvl++)
|
||||
for (lat = 0; lat < NLAT; lat++)
|
||||
for (lon = 0; lon < NLON; lon++)
|
||||
@ -118,18 +118,18 @@ main()
|
||||
since coordinate variables only have one dimension, we can
|
||||
simply provide the address of that dimension ID (&lat_dimid) and
|
||||
similarly for (&lon_dimid). */
|
||||
if ((retval = nc_def_var(ncid, LAT_NAME, NC_FLOAT, 1, &lat_dimid,
|
||||
if ((retval = nc_def_var(ncid, LAT_NAME, NC_FLOAT, 1, &lat_dimid,
|
||||
&lat_varid)))
|
||||
ERR(retval);
|
||||
if ((retval = nc_def_var(ncid, LON_NAME, NC_FLOAT, 1, &lon_dimid,
|
||||
if ((retval = nc_def_var(ncid, LON_NAME, NC_FLOAT, 1, &lon_dimid,
|
||||
&lon_varid)))
|
||||
ERR(retval);
|
||||
|
||||
/* Assign units attributes to coordinate variables. */
|
||||
if ((retval = nc_put_att_text(ncid, lat_varid, UNITS,
|
||||
if ((retval = nc_put_att_text(ncid, lat_varid, UNITS,
|
||||
strlen(DEGREES_NORTH), DEGREES_NORTH)))
|
||||
ERR(retval);
|
||||
if ((retval = nc_put_att_text(ncid, lon_varid, UNITS,
|
||||
if ((retval = nc_put_att_text(ncid, lon_varid, UNITS,
|
||||
strlen(DEGREES_EAST), DEGREES_EAST)))
|
||||
ERR(retval);
|
||||
|
||||
@ -144,18 +144,18 @@ main()
|
||||
|
||||
/* Define the netCDF variables for the pressure and temperature
|
||||
* data. */
|
||||
if ((retval = nc_def_var(ncid, PRES_NAME, NC_FLOAT, NDIMS,
|
||||
if ((retval = nc_def_var(ncid, PRES_NAME, NC_FLOAT, NDIMS,
|
||||
dimids, &pres_varid)))
|
||||
ERR(retval);
|
||||
if ((retval = nc_def_var(ncid, TEMP_NAME, NC_FLOAT, NDIMS,
|
||||
if ((retval = nc_def_var(ncid, TEMP_NAME, NC_FLOAT, NDIMS,
|
||||
dimids, &temp_varid)))
|
||||
ERR(retval);
|
||||
|
||||
/* Assign units attributes to the netCDF variables. */
|
||||
if ((retval = nc_put_att_text(ncid, pres_varid, UNITS,
|
||||
if ((retval = nc_put_att_text(ncid, pres_varid, UNITS,
|
||||
strlen(PRES_UNITS), PRES_UNITS)))
|
||||
ERR(retval);
|
||||
if ((retval = nc_put_att_text(ncid, temp_varid, UNITS,
|
||||
if ((retval = nc_put_att_text(ncid, temp_varid, UNITS,
|
||||
strlen(TEMP_UNITS), TEMP_UNITS)))
|
||||
ERR(retval);
|
||||
|
||||
@ -188,10 +188,10 @@ main()
|
||||
for (rec = 0; rec < NREC; rec++)
|
||||
{
|
||||
start[0] = rec;
|
||||
if ((retval = nc_put_vara_float(ncid, pres_varid, start, count,
|
||||
if ((retval = nc_put_vara_float(ncid, pres_varid, start, count,
|
||||
&pres_out[0][0][0])))
|
||||
ERR(retval);
|
||||
if ((retval = nc_put_vara_float(ncid, temp_varid, start, count,
|
||||
if ((retval = nc_put_vara_float(ncid, temp_varid, start, count,
|
||||
&temp_out[0][0][0])))
|
||||
ERR(retval);
|
||||
}
|
||||
@ -199,7 +199,7 @@ main()
|
||||
/* Close the file. */
|
||||
if ((retval = nc_close(ncid)))
|
||||
ERR(retval);
|
||||
|
||||
|
||||
printf("*** SUCCESS writing example file %s!\n", FILE_NAME);
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,5 +1,16 @@
|
||||
/*! \file
|
||||
|
||||
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
|
||||
2015, 2016, 2017, 2018
|
||||
University Corporation for Atmospheric Research/Unidata.
|
||||
|
||||
See \ref copyright file for more info.
|
||||
|
||||
*/
|
||||
|
||||
/* This example program is part of Unidata's netCDF library for
|
||||
scientific data access.
|
||||
scientific data access.
|
||||
|
||||
This program (quickly, but not thoroughly) tests the large file
|
||||
features.
|
||||
@ -19,14 +30,14 @@
|
||||
printf("Bailing out in file %s, line %d, error:%s.\n", \
|
||||
__FILE__, __LINE__, nc_strerror(e)); \
|
||||
return NC_EXAMPLE_ERROR; \
|
||||
} while (0)
|
||||
} while (0)
|
||||
|
||||
#define NUMDIMS 1
|
||||
#define NUMVARS 2
|
||||
/* This dim len is the max size for an 8-byte type in 64-bit offset
|
||||
format: (2*32 - 4) / 8, that is, 4 GB minus a bit, on an 8 byte
|
||||
boundary. */
|
||||
#define DIM_LEN 536870911
|
||||
#define DIM_LEN 536870911
|
||||
|
||||
int
|
||||
main()
|
||||
@ -34,7 +45,7 @@ main()
|
||||
int ncid, spockid, kirkid, dimids[NUMDIMS];
|
||||
double val_in, val_out = 999.99;
|
||||
size_t index[NUMDIMS] = {DIM_LEN-1};
|
||||
int i, res;
|
||||
int i, res;
|
||||
|
||||
/* Create the netCDF 64-bit offset format file. */
|
||||
if ((res = nc_create("example.nc", NC_CLOBBER|NC_64BIT_OFFSET, &ncid)))
|
||||
@ -47,15 +58,15 @@ main()
|
||||
/* Define dimension. */
|
||||
if ((res = nc_def_dim(ncid, "longdim", DIM_LEN, dimids)))
|
||||
BAIL(res);
|
||||
|
||||
|
||||
/* Define two variables. */
|
||||
if ((res = nc_def_var(ncid, "spock", NC_DOUBLE, NUMDIMS,
|
||||
if ((res = nc_def_var(ncid, "spock", NC_DOUBLE, NUMDIMS,
|
||||
dimids, &spockid)))
|
||||
BAIL(res);
|
||||
if ((res = nc_def_var(ncid, "kirk", NC_DOUBLE, NUMDIMS,
|
||||
if ((res = nc_def_var(ncid, "kirk", NC_DOUBLE, NUMDIMS,
|
||||
dimids, &kirkid)))
|
||||
BAIL(res);
|
||||
|
||||
|
||||
/* We're finished defining metadata. */
|
||||
if ((res = nc_enddef(ncid)))
|
||||
BAIL(res);
|
||||
@ -69,9 +80,3 @@ main()
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -1,5 +1,16 @@
|
||||
/*! \file
|
||||
|
||||
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
|
||||
2015, 2016, 2017, 2018
|
||||
University Corporation for Atmospheric Research/Unidata.
|
||||
|
||||
See \ref copyright file for more info.
|
||||
|
||||
*/
|
||||
|
||||
/* This example program is part of Unidata's netCDF library for
|
||||
scientific data access.
|
||||
scientific data access.
|
||||
|
||||
This program will create a large file in netCDF classic
|
||||
format. From the netcdf docs:
|
||||
@ -25,7 +36,7 @@
|
||||
printf("Bailing out in file %s, line %d, error:%s.\n", \
|
||||
__FILE__, __LINE__, nc_strerror(e)); \
|
||||
return NC_EXAMPLE_ERROR; \
|
||||
} while (0)
|
||||
} while (0)
|
||||
|
||||
#define NUMDIMS 1
|
||||
#define NUMVARS 2
|
||||
@ -40,7 +51,7 @@ main()
|
||||
int ncid, spockid, kirkid, dimids[NUMDIMS];
|
||||
double val_in, val_out = 999.99;
|
||||
size_t index[NUMDIMS] = {1};
|
||||
int i, res;
|
||||
int i, res;
|
||||
|
||||
/* Create the netCDF classic format file. */
|
||||
if ((res = nc_create("example.nc", NC_CLOBBER, &ncid)))
|
||||
@ -53,15 +64,15 @@ main()
|
||||
/* Define dimension. */
|
||||
if ((res = nc_def_dim(ncid, "longdim", DIM_LEN, dimids)))
|
||||
BAIL(res);
|
||||
|
||||
|
||||
/* Define two variables. */
|
||||
if ((res = nc_def_var(ncid, "spock", NC_DOUBLE, NUMDIMS,
|
||||
if ((res = nc_def_var(ncid, "spock", NC_DOUBLE, NUMDIMS,
|
||||
dimids, &spockid)))
|
||||
BAIL(res);
|
||||
if ((res = nc_def_var(ncid, "kirk", NC_DOUBLE, NUMDIMS,
|
||||
if ((res = nc_def_var(ncid, "kirk", NC_DOUBLE, NUMDIMS,
|
||||
dimids, &kirkid)))
|
||||
BAIL(res);
|
||||
|
||||
|
||||
/* We're finished defining metadata. */
|
||||
if ((res = nc_enddef(ncid)))
|
||||
BAIL(res);
|
||||
@ -75,4 +86,3 @@ main()
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,10 @@
|
||||
#!/bin/sh
|
||||
# Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
|
||||
# 2015, 2016, 2017, 2018
|
||||
# University Corporation for Atmospheric Research/Unidata.
|
||||
|
||||
# See netcdf-c/COPYRIGHT file for more info.
|
||||
# This shell script runs the examples.
|
||||
# Ed Hartnett
|
||||
|
||||
|
@ -1,4 +1,10 @@
|
||||
#!/bin/sh
|
||||
# Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
|
||||
# 2015, 2016, 2017, 2018
|
||||
# University Corporation for Atmospheric Research/Unidata.
|
||||
|
||||
# See netcdf-c/COPYRIGHT file for more info.
|
||||
# This shell script runs the examples for netCDF4.
|
||||
# Ed Hartnett
|
||||
|
||||
|
@ -1,6 +1,10 @@
|
||||
#!/bin/sh
|
||||
# This shell script runs the examples for netCDF4.
|
||||
# Ed Hartnett
|
||||
# Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
|
||||
# 2015, 2016, 2017, 2018
|
||||
# University Corporation for Atmospheric Research/Unidata.
|
||||
|
||||
# See netcdf-c/COPYRIGHT file for more info.
|
||||
|
||||
if test "x$srcdir" = x ; then srcdir=`pwd`; fi
|
||||
. ../../test_common.sh
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* This is part of the netCDF package.
|
||||
|
||||
Copyright 2006 University Corporation for Atmospheric
|
||||
Copyright 2018 University Corporation for Atmospheric
|
||||
Research/Unidata. See COPYRIGHT file for conditions of use.
|
||||
|
||||
This is a simple example which writes and then reads some surface
|
||||
@ -72,7 +72,7 @@ main()
|
||||
* applies to the entire file, not just to one variable. Don't
|
||||
* forget that sizeof does not include the null terminator, so if
|
||||
* you want it, you need to add one more byte. */
|
||||
if ((retval = nc_put_att_text(ncid, NC_GLOBAL, SONNET_NAME,
|
||||
if ((retval = nc_put_att_text(ncid, NC_GLOBAL, SONNET_NAME,
|
||||
sizeof(poem) + 1, poem)))
|
||||
return retval;
|
||||
|
||||
@ -118,7 +118,7 @@ main()
|
||||
/* Close the file. */
|
||||
if ((retval = nc_close(ncid)))
|
||||
return retval;
|
||||
|
||||
|
||||
/* Open the file and check that everything's OK. */
|
||||
if ((retval = nc_open(FILE_NAME, 0, &ncid)))
|
||||
return retval;
|
||||
@ -134,7 +134,7 @@ main()
|
||||
free(att_in);
|
||||
if (error)
|
||||
return -2;
|
||||
|
||||
|
||||
/* Read the data. */
|
||||
if ((retval = nc_get_var_float(ncid, pres_varid, pres_in)))
|
||||
return retval;
|
||||
|
@ -5,8 +5,8 @@ This is an example which reads some surface pressure and
|
||||
temperatures. The data file read by this program is produced by the
|
||||
companion program sfc_pres_temp_wr.c. It is intended to illustrate the
|
||||
use of the netCDF C API.
|
||||
|
||||
Copyright 2006 University Corporation for Atmospheric
|
||||
|
||||
Copyright 2018 University Corporation for Atmospheric
|
||||
Research/Unidata. See COPYRIGHT file for conditions of use.
|
||||
|
||||
*/
|
||||
@ -82,14 +82,14 @@ main()
|
||||
many netCDF variables, dimensions, and global attributes are in
|
||||
the file; also the dimension id of the unlimited dimension, if
|
||||
there is one. */
|
||||
if ((retval = nc_inq(ncid, &ndims_in, &nvars_in, &ngatts_in,
|
||||
if ((retval = nc_inq(ncid, &ndims_in, &nvars_in, &ngatts_in,
|
||||
&unlimdimid_in)))
|
||||
ERR(retval);
|
||||
|
||||
/* In this case we know that there are 2 netCDF dimensions, 4
|
||||
netCDF variables, no global attributes, and no unlimited
|
||||
dimension. */
|
||||
if (ndims_in != 2 || nvars_in != 4 || ngatts_in != 0 ||
|
||||
if (ndims_in != 2 || nvars_in != 4 || ngatts_in != 0 ||
|
||||
unlimdimid_in != -1) return 2;
|
||||
|
||||
/* Get the varids of the latitude and longitude coordinate
|
||||
@ -139,12 +139,12 @@ main()
|
||||
them and check them. */
|
||||
if ((retval = nc_get_att_text(ncid, lat_varid, UNITS, lat_units_in)))
|
||||
ERR(retval);
|
||||
if (strncmp(lat_units_in, LAT_UNITS, strlen(LAT_UNITS)))
|
||||
if (strncmp(lat_units_in, LAT_UNITS, strlen(LAT_UNITS)))
|
||||
return 2;
|
||||
|
||||
if ((retval = nc_get_att_text(ncid, lon_varid, UNITS, lon_units_in)))
|
||||
ERR(retval);
|
||||
if (strncmp(lon_units_in, LON_UNITS, strlen(LON_UNITS)))
|
||||
if (strncmp(lon_units_in, LON_UNITS, strlen(LON_UNITS)))
|
||||
return 2;
|
||||
|
||||
if ((retval = nc_get_att_text(ncid, pres_varid, UNITS, pres_units_in)))
|
||||
|
@ -5,8 +5,8 @@ This example writes some surface pressure and temperatures. It is
|
||||
intended to illustrate the use of the netCDF C API. The companion
|
||||
program sfc_pres_temp_rd.c shows how to read the netCDF data file
|
||||
created by this program.
|
||||
|
||||
Copyright 2006 University Corporation for Atmospheric
|
||||
|
||||
Copyright 2018 University Corporation for Atmospheric
|
||||
Research/Unidata. See COPYRIGHT file for conditions of use.
|
||||
*/
|
||||
|
||||
@ -68,7 +68,7 @@ main()
|
||||
|
||||
/* Loop indexes. */
|
||||
int lat, lon;
|
||||
|
||||
|
||||
/* Error handling. */
|
||||
int retval;
|
||||
|
||||
@ -79,7 +79,7 @@ main()
|
||||
lats[lat] = START_LAT + 5.*lat;
|
||||
for (lon = 0; lon < NLON; lon++)
|
||||
lons[lon] = START_LON + 5.*lon;
|
||||
|
||||
|
||||
for (lat = 0; lat < NLAT; lat++)
|
||||
for (lon = 0; lon < NLON; lon++)
|
||||
{
|
||||
@ -100,10 +100,10 @@ main()
|
||||
/* Define coordinate netCDF variables. They will hold the
|
||||
coordinate information, that is, the latitudes and longitudes. A
|
||||
varid is returned for each.*/
|
||||
if ((retval = nc_def_var(ncid, LAT_NAME, NC_FLOAT, 1, &lat_dimid,
|
||||
if ((retval = nc_def_var(ncid, LAT_NAME, NC_FLOAT, 1, &lat_dimid,
|
||||
&lat_varid)))
|
||||
ERR(retval);
|
||||
if ((retval = nc_def_var(ncid, LON_NAME, NC_FLOAT, 1, &lon_dimid,
|
||||
if ((retval = nc_def_var(ncid, LON_NAME, NC_FLOAT, 1, &lon_dimid,
|
||||
&lon_varid)))
|
||||
ERR(retval);
|
||||
|
||||
@ -114,10 +114,10 @@ main()
|
||||
not use null-terminated strings. In general it is up to the
|
||||
reading C program to ensure that it puts null-terminators on
|
||||
strings where necessary.*/
|
||||
if ((retval = nc_put_att_text(ncid, lat_varid, UNITS,
|
||||
if ((retval = nc_put_att_text(ncid, lat_varid, UNITS,
|
||||
strlen(DEGREES_NORTH), DEGREES_NORTH)))
|
||||
ERR(retval);
|
||||
if ((retval = nc_put_att_text(ncid, lon_varid, UNITS,
|
||||
if ((retval = nc_put_att_text(ncid, lon_varid, UNITS,
|
||||
strlen(DEGREES_EAST), DEGREES_EAST)))
|
||||
ERR(retval);
|
||||
|
||||
@ -125,18 +125,18 @@ main()
|
||||
the dimids of the dimensions of the variables.*/
|
||||
dimids[0] = lat_dimid;
|
||||
dimids[1] = lon_dimid;
|
||||
if ((retval = nc_def_var(ncid, PRES_NAME, NC_FLOAT, NDIMS,
|
||||
if ((retval = nc_def_var(ncid, PRES_NAME, NC_FLOAT, NDIMS,
|
||||
dimids, &pres_varid)))
|
||||
ERR(retval);
|
||||
if ((retval = nc_def_var(ncid, TEMP_NAME, NC_FLOAT, NDIMS,
|
||||
if ((retval = nc_def_var(ncid, TEMP_NAME, NC_FLOAT, NDIMS,
|
||||
dimids, &temp_varid)))
|
||||
ERR(retval);
|
||||
|
||||
/* Define units attributes for vars. */
|
||||
if ((retval = nc_put_att_text(ncid, pres_varid, UNITS,
|
||||
if ((retval = nc_put_att_text(ncid, pres_varid, UNITS,
|
||||
strlen(pres_units), pres_units)))
|
||||
ERR(retval);
|
||||
if ((retval = nc_put_att_text(ncid, temp_varid, UNITS,
|
||||
if ((retval = nc_put_att_text(ncid, temp_varid, UNITS,
|
||||
strlen(temp_units), temp_units)))
|
||||
ERR(retval);
|
||||
|
||||
@ -162,7 +162,7 @@ main()
|
||||
/* Close the file. */
|
||||
if ((retval = nc_close(ncid)))
|
||||
ERR(retval);
|
||||
|
||||
|
||||
printf("*** SUCCESS writing example file sfc_pres_temp.nc!\n");
|
||||
return 0;
|
||||
}
|
||||
|
@ -1,5 +1,16 @@
|
||||
/*! \file
|
||||
|
||||
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
|
||||
2015, 2016, 2017, 2018
|
||||
University Corporation for Atmospheric Research/Unidata.
|
||||
|
||||
See \ref copyright file for more info.
|
||||
|
||||
*/
|
||||
|
||||
/* This example program is part of Unidata's netCDF library for
|
||||
scientific data access.
|
||||
scientific data access.
|
||||
|
||||
How about a short, but meaningful, netCDF program?
|
||||
|
||||
@ -18,7 +29,7 @@
|
||||
printf("Bailing out in file %s, line %d, error:%s.\n", \
|
||||
__FILE__, __LINE__, nc_strerror(e)); \
|
||||
return NC_EXAMPLE_ERROR; \
|
||||
} while (0)
|
||||
} while (0)
|
||||
|
||||
#define NUMDIMS 2
|
||||
#define NUMVARS 1
|
||||
@ -31,7 +42,7 @@ main()
|
||||
{
|
||||
int ncid, temp_varid, dimids[NUMDIMS];
|
||||
float temp[LAT_LEN][LON_LEN], *fp;
|
||||
int i, res;
|
||||
int i, res;
|
||||
|
||||
/* Create a bunch of phoney data so we have something to write in
|
||||
the example file. */
|
||||
@ -47,14 +58,14 @@ main()
|
||||
BAIL(res);
|
||||
if ((res = nc_def_dim(ncid, "longitude", LON_LEN, &dimids[1])))
|
||||
BAIL(res);
|
||||
|
||||
|
||||
/* Define the variable. */
|
||||
if ((res = nc_def_var(ncid, "sfc_temp", NC_FLOAT, NUMDIMS,
|
||||
if ((res = nc_def_var(ncid, "sfc_temp", NC_FLOAT, NUMDIMS,
|
||||
dimids, &temp_varid)))
|
||||
BAIL(res);
|
||||
|
||||
|
||||
/* We'll store the units. */
|
||||
if ((res = nc_put_att_text(ncid, temp_varid, "units",
|
||||
if ((res = nc_put_att_text(ncid, temp_varid, "units",
|
||||
strlen(CELSIUS), CELSIUS)))
|
||||
BAIL(res);
|
||||
|
||||
@ -71,4 +82,3 @@ main()
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -7,7 +7,7 @@ features of netCDF-4.0.
|
||||
This example reads a simple file created by simple_nc4_wr.c. This is
|
||||
intended to illustrate the use of the netCDF-4 C API.
|
||||
|
||||
This is part of the netCDF package. Copyright 2006-2011 University
|
||||
This is part of the netCDF package. Copyright 2006-2018 University
|
||||
Corporation for Atmospheric Research/Unidata. See COPYRIGHT file for
|
||||
conditions of use. Full documentation of the netCDF can be found at
|
||||
http://www.unidata.ucar.edu/software/netcdf/docs.
|
||||
@ -41,7 +41,7 @@ main()
|
||||
int x, y, retval;
|
||||
|
||||
/* The following struct is written as a compound type. */
|
||||
struct s1
|
||||
struct s1
|
||||
{
|
||||
int i1;
|
||||
int i2;
|
||||
@ -61,7 +61,7 @@ main()
|
||||
|
||||
/* Get the varid of the uint64 data variable, based on its name, in
|
||||
* grp1. */
|
||||
if ((retval = nc_inq_varid(grp1id, "data", &varid1)))
|
||||
if ((retval = nc_inq_varid(grp1id, "data", &varid1)))
|
||||
ERR(retval);
|
||||
|
||||
/* Read the data. */
|
||||
@ -70,7 +70,7 @@ main()
|
||||
|
||||
/* Get the varid of the compound data variable, based on its name,
|
||||
* in grp2. */
|
||||
if ((retval = nc_inq_varid(grp2id, "data", &varid2)))
|
||||
if ((retval = nc_inq_varid(grp2id, "data", &varid2)))
|
||||
ERR(retval);
|
||||
|
||||
/* Read the data. */
|
||||
|
@ -6,7 +6,7 @@ some netCDF variables in different subgroups. The variables will
|
||||
include a compound and an enum type, as well as some of the new atomic
|
||||
types, like the unsigned 64-bit integer.
|
||||
|
||||
This is part of the netCDF package. Copyright 2006-2011 University
|
||||
This is part of the netCDF package. Copyright 2006-2018 University
|
||||
Corporation for Atmospheric Research/Unidata. See COPYRIGHT file for
|
||||
conditions of use. Full documentation of the netCDF can be found at
|
||||
http://www.unidata.ucar.edu/software/netcdf/docs.
|
||||
@ -45,7 +45,7 @@ main()
|
||||
int x, y, retval;
|
||||
|
||||
/* The following struct is written as a compound type. */
|
||||
struct s1
|
||||
struct s1
|
||||
{
|
||||
int i1;
|
||||
int i2;
|
||||
@ -85,7 +85,7 @@ main()
|
||||
|
||||
/* Define an unsigned 64bit integer variable in grp1, using dimensions
|
||||
* in the root group. */
|
||||
if ((retval = nc_def_var(grp1id, "data", NC_UINT64, NDIMS,
|
||||
if ((retval = nc_def_var(grp1id, "data", NC_UINT64, NDIMS,
|
||||
dimids, &varid1)))
|
||||
ERR(retval);
|
||||
|
||||
@ -95,19 +95,19 @@ main()
|
||||
ERR(retval);
|
||||
|
||||
/* Create a compound type. This will cause nc_reddef to be called. */
|
||||
if (nc_def_compound(grp2id, sizeof(struct s1), "sample_compound_type",
|
||||
if (nc_def_compound(grp2id, sizeof(struct s1), "sample_compound_type",
|
||||
&typeid))
|
||||
ERR(retval);
|
||||
if (nc_insert_compound(grp2id, typeid, "i1",
|
||||
if (nc_insert_compound(grp2id, typeid, "i1",
|
||||
offsetof(struct s1, i1), NC_INT))
|
||||
ERR(retval);
|
||||
if (nc_insert_compound(grp2id, typeid, "i2",
|
||||
if (nc_insert_compound(grp2id, typeid, "i2",
|
||||
offsetof(struct s1, i2), NC_INT))
|
||||
ERR(retval);
|
||||
|
||||
/* Define a compound type variable in grp2, using dimensions
|
||||
* in the root group. */
|
||||
if ((retval = nc_def_var(grp2id, "data", typeid, NDIMS,
|
||||
if ((retval = nc_def_var(grp2id, "data", typeid, NDIMS,
|
||||
dimids, &varid2)))
|
||||
ERR(retval);
|
||||
|
||||
|
@ -1,6 +1,11 @@
|
||||
/*! \file
|
||||
An example program demonstrating a simple 2D write.
|
||||
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
|
||||
2015, 2016, 2017, 2018
|
||||
University Corporation for Atmospheric Research/Unidata.
|
||||
|
||||
See netcdf-c/COPYRIGHT file for more info.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
@ -65,7 +70,7 @@ main()
|
||||
|
||||
/* Define the variable. The type of the variable in this case is
|
||||
* NC_INT (4-byte integer). */
|
||||
if ((retval = nc_def_var(ncid, "data", NC_INT, NDIMS,
|
||||
if ((retval = nc_def_var(ncid, "data", NC_INT, NDIMS,
|
||||
dimids, &varid)))
|
||||
ERR(retval);
|
||||
|
||||
|
@ -1,7 +1,13 @@
|
||||
/*********************************************************************
|
||||
* Copyright 1993, UCAR/Unidata
|
||||
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
|
||||
*********************************************************************/
|
||||
/*! \file
|
||||
|
||||
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
|
||||
2015, 2016, 2017, 2018
|
||||
University Corporation for Atmospheric Research/Unidata.
|
||||
|
||||
See \ref copyright file for more info.
|
||||
|
||||
*/
|
||||
/* $Header$ */
|
||||
|
||||
#ifndef CECONSTRAINTS_H
|
||||
@ -28,4 +34,3 @@ CES_VALUE=18, CES_SLICE=19
|
||||
} CEsort;
|
||||
|
||||
#endif /*CECONSTRAINTS_H*/
|
||||
|
||||
|
@ -3,7 +3,8 @@
|
||||
Main header file for the C API.
|
||||
|
||||
Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014
|
||||
2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014,
|
||||
2015, 2016, 2017, 2018
|
||||
University Corporation for Atmospheric Research/Unidata.
|
||||
|
||||
See \ref copyright file for more info.
|
||||
|
Loading…
x
Reference in New Issue
Block a user