From 30d63bbaa55cfabbe0980483da20c0d3fb503d36 Mon Sep 17 00:00:00 2001 From: Dennis Heimbigner Date: Tue, 4 Dec 2018 19:22:02 -0700 Subject: [PATCH 01/24] Fix failings of nc_test/run_inmemory.sh re: issue https://github.com/Unidata/netcdf-c/issues/1233 Changes: 1. remove exit that was there for testing. 2. the program tst_open_mem must be netcdf-4 only. 3. fix some diff problems - Change dataset name for tst_inmemory4_create to tst_inmemory4 - Modify tst_inmemory.c to reorder the variables (somewhat major rewrite) Minor Unrelated Fixes: 1. fix comment problem in nc_provenance.h 2. Fix memory leak in tst_open_mem.c 3. fix ncdump/bindata.c to properly compile if netcdf4 is disabled. 4. minor changes to ncgen.l --- debug/README.txt | 1 + debug/cf.cmake | 2 +- include/nc_provenance.h | 3 +- nc_test/run_inmemory.sh | 8 +- nc_test/tst_inmemory.c | 32 +- nc_test/tst_open_mem.c | 11 +- ncgen/bindata.c | 6 +- ncgen/ncgenl.c | 868 +++++++++++++++------------------------- 8 files changed, 366 insertions(+), 565 deletions(-) diff --git a/debug/README.txt b/debug/README.txt index a772f2c1d9..961bafb1ee 100644 --- a/debug/README.txt +++ b/debug/README.txt @@ -1,5 +1,6 @@ This directory contains various scripts for debugging by Dennis Heimbigner @ Unidata. +DO NOT DELETE. USE AT YOUR OWN PERIL. diff --git a/debug/cf.cmake b/debug/cf.cmake index a2b31fc13c..7baea55b52 100644 --- a/debug/cf.cmake +++ b/debug/cf.cmake @@ -97,7 +97,7 @@ NCLIB="${NCLIB}/build/liblib" #G="-GUnix Makefiles" #T="--trace-expand" cmake "${G}" $FLAGS .. -if test "x$NOBUILD" == x ; then +if test "x$NOBUILD" = x ; then make all make test fi diff --git a/include/nc_provenance.h b/include/nc_provenance.h index ef9825a3dc..b35d8c8763 100644 --- a/include/nc_provenance.h +++ b/include/nc_provenance.h @@ -1,13 +1,12 @@ /* Copyright 2005-2018 University Corporation for Atmospheric Research/Unidata. */ -/** /** * @file * @internal Contains information for creating provenance * info and/or displaying provenance info. * * @author Dennis Heimbigner, Ward Fisher - +*/ /**************************************************/ /** diff --git a/nc_test/run_inmemory.sh b/nc_test/run_inmemory.sh index b4515c5d1b..6dc7a2d7a5 100755 --- a/nc_test/run_inmemory.sh +++ b/nc_test/run_inmemory.sh @@ -16,7 +16,7 @@ CREATE3=tst_inmemory3_create FILE4=tst_inmemory4 CREATE4=tst_inmemory4_create -# For tst_open_mem +# For tst_open_mem NETCDF4 only OMEMFILE=f03tst_open_mem.nc echo "" @@ -26,8 +26,9 @@ HASNC4=`${top_builddir}/nc-config --has-nc4` # Execute the core of the inmemory tests ${execdir}/tst_inmemory -exit +if test "x$HASNC4" = xyes ; then ${execdir}/tst_open_mem ${srcdir}/${OMEMFILE} +fi echo "**** Test ncdump of the resulting inmemory data" ${NCDUMP} -n "${FILE3}" ${FILE3}.nc > ${FILE3}.cdl @@ -36,8 +37,9 @@ diff -wb ${FILE3}.cdl ${CREATE3}.cdl if test "x$HASNC4" = "xyes" ; then ${NCDUMP} ${FILE4}.nc > ${FILE4}.cdl -${NCDUMP} ${CREATE4}.nc > ${CREATE4}.cdl +${NCDUMP} -n ${FILE4} ${CREATE4}.nc > ${CREATE4}.cdl diff -wb ${FILE4}.cdl ${CREATE4}.cdl +fi # cleanup rm -f ${FILE3}.nc ${FILE4}.nc ${CREATE3}.nc ${CREATE4}.nc diff --git a/nc_test/tst_inmemory.c b/nc_test/tst_inmemory.c index af3f1b6e10..384b0671ba 100644 --- a/nc_test/tst_inmemory.c +++ b/nc_test/tst_inmemory.c @@ -61,8 +61,8 @@ extern int H5Eprint1(FILE * stream); #define NVARS0 3 /* # variables in define_metadata */ #define VAR0_NAME "nightlife" -#define VAR1_NAME "time" -#define VAR2_NAME "taxi_distance" +#define VAR1_NAME "taxi_distance" +#define VAR2_NAME "time" /* Variable added by modify_file */ #define VAR3_NAME "miles" @@ -270,19 +270,19 @@ define_metadata(int ncid) { int stat = NC_NOERR; int dimid[MAXDIMS], varid0, varid1, varid2; - short short_data[DIM1_LEN]; size_t start[1] = {0}; size_t count[1] = {DIM1_LEN}; int dimprod = (DIM0_LEN*DIM1_LEN); int i; float float_data; int nightdata[DIM0_LEN*DIM1_LEN] ; + short taxi_distance[DIM1_LEN] ; /* Create data to write */ float_data = FLOATVAL; for (i = 0; i < DIM1_LEN; i++) - short_data[i] = i; + taxi_distance[i] = i; for (i = 0; i < dimprod; i++) nightdata[i] = (100*i); @@ -294,13 +294,13 @@ define_metadata(int ncid) CHECK(nc_def_dim(ncid, DIM1_NAME, DIM1_LEN, &dimid[1])); CHECK(nc_def_var(ncid, VAR0_NAME, NC_INT, 2, dimid, &varid0)); - CHECK(nc_def_var(ncid, VAR1_NAME, NC_FLOAT, 0, NULL, &varid1)); - CHECK(nc_def_var(ncid, VAR2_NAME, NC_SHORT, 1, &dimid[1], &varid2)); + CHECK(nc_def_var(ncid, VAR1_NAME, NC_SHORT, 1, &dimid[1], &varid1)); + CHECK(nc_def_var(ncid, VAR2_NAME, NC_FLOAT, 0, NULL, &varid2)); CHECK(nc_enddef(ncid)); - CHECK(nc_put_vara_float(ncid, varid1, NULL, NULL, &float_data)); - CHECK(nc_put_vara_short(ncid, varid2, start, count, short_data)); + CHECK(nc_put_vara_short(ncid, varid1, start, count, taxi_distance)); + CHECK(nc_put_var_float(ncid, varid2, &float_data)); { size_t start[2] = {0,0}; @@ -407,6 +407,7 @@ verify_file(int ncid, int modified, int extra) float float_data_in; int milesdata_in[MAXDIMLEN]; int expenses_in[MAXDIMLEN]; + short taxi_distance_in[MAXDIMLEN]; int dimprod = DIM0_LEN * DIM1_LEN; #ifdef USE_NETCDF4 int tmp; @@ -456,18 +457,23 @@ verify_file(int ncid, int modified, int extra) if (strcmp(name_in, VAR0_NAME) || type_in != NC_INT || ndims_in != NDIMS0 || dimid_in[0] != 0 || dimid_in[1] != 1 || natts_in != 0) CHECK(NC_EINVAL); CHECK(nc_inq_var(ncid, varid[1], name_in, &type_in, &ndims_in, dimid_in, &natts_in)); - if (strcmp(name_in, VAR1_NAME) || type_in != NC_FLOAT || ndims_in != 0 || - natts_in != 0) CHECK(NC_EINVAL); + if (strcmp(name_in, VAR1_NAME) || type_in != NC_SHORT || ndims_in != 1 || dimid_in[0] != 1 || natts_in != 0) + CHECK(NC_EINVAL); CHECK(nc_inq_var(ncid, varid[2], name_in, &type_in, &ndims_in, dimid_in, &natts_in)); - if (strcmp(name_in, VAR2_NAME) || type_in != NC_SHORT || ndims_in != 1 || - dimid_in[0] != 1 || natts_in != 0) CHECK(NC_EINVAL); + if (strcmp(name_in, VAR2_NAME) || type_in != NC_FLOAT || ndims_in != 0 || natts_in != 0) + CHECK(NC_EINVAL); CHECK(nc_get_var_int(ncid, varid[0], nightdata_in)); for(i=0;isize = (size_t)filesize; memio->memory = memory; + memory = NULL; } done: if(status != NC_NOERR && memory != NULL) @@ -82,6 +87,8 @@ main(int argc, char** argv) goto exit; if((retval = nc_close(ncid))) goto exit; + if(mem.memory) + free(mem.memory); return 0; exit: fprintf(stderr,"retval=%d\n",retval); diff --git a/ncgen/bindata.c b/ncgen/bindata.c index 840dfdbb57..f14e3568e8 100644 --- a/ncgen/bindata.c +++ b/ncgen/bindata.c @@ -431,13 +431,15 @@ Internal equivalent of ncaux_reclaim_data. /* It is helpful to have a structure that contains memory and an offset */ typedef struct Reclaim {char* memory; ptrdiff_t offset;} Reclaim; -static ptrdiff_t read_alignment(ptrdiff_t offset, unsigned long alignment); static int bin_reclaim_datar(Symbol* tsym, Reclaim* reclaim); +#ifdef USE_NETCDF4 +static ptrdiff_t read_alignment(ptrdiff_t offset, unsigned long alignment); static int bin_reclaim_usertype(Symbol* tsym, Reclaim* reclaim); static int bin_reclaim_compound(Symbol* tsym, Reclaim* reclaim); static int bin_reclaim_vlen(Symbol* tsym, Reclaim* reclaim); static int bin_reclaim_enum(Symbol* tsym, Reclaim* reclaim); static int bin_reclaim_opaque(Symbol* tsym, Reclaim* reclaim); +#endif int binary_reclaim_data(Symbol* tsym, void* memory, size_t count) @@ -493,6 +495,7 @@ bin_reclaim_datar(Symbol* tsym, Reclaim* reclaimer) return stat; } +#ifdef USE_NETCDF4 static int bin_reclaim_usertype(Symbol* tsym, Reclaim* reclaimer) { @@ -587,6 +590,7 @@ bin_reclaim_compound(Symbol* tsym, Reclaim* reclaimer) done: return stat; } +#endif /*USE_NETCDF4*/ #endif /*ENABLE_BINARY*/ diff --git a/ncgen/ncgenl.c b/ncgen/ncgenl.c index 27fbefe8d5..f854611c96 100644 --- a/ncgen/ncgenl.c +++ b/ncgen/ncgenl.c @@ -1,5 +1,5 @@ -#line 2 "ncgenl.c" +#line 3 "ncgenl.c" #define YY_INT_ALIGNED short int @@ -7,17 +7,11 @@ #define yy_create_buffer ncg_create_buffer #define yy_delete_buffer ncg_delete_buffer -#define yy_scan_buffer ncg_scan_buffer -#define yy_scan_string ncg_scan_string -#define yy_scan_bytes ncg_scan_bytes +#define yy_flex_debug ncg_flex_debug #define yy_init_buffer ncg_init_buffer #define yy_flush_buffer ncg_flush_buffer #define yy_load_buffer_state ncg_load_buffer_state #define yy_switch_to_buffer ncg_switch_to_buffer -#define yypush_buffer_state ncgpush_buffer_state -#define yypop_buffer_state ncgpop_buffer_state -#define yyensure_buffer_stack ncgensure_buffer_stack -#define yy_flex_debug ncg_flex_debug #define yyin ncgin #define yyleng ncgleng #define yylex ncglex @@ -33,245 +27,11 @@ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 6 -#define YY_FLEX_SUBMINOR_VERSION 4 +#define YY_FLEX_SUBMINOR_VERSION 0 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif -#ifdef yy_create_buffer -#define ncg_create_buffer_ALREADY_DEFINED -#else -#define yy_create_buffer ncg_create_buffer -#endif - -#ifdef yy_delete_buffer -#define ncg_delete_buffer_ALREADY_DEFINED -#else -#define yy_delete_buffer ncg_delete_buffer -#endif - -#ifdef yy_scan_buffer -#define ncg_scan_buffer_ALREADY_DEFINED -#else -#define yy_scan_buffer ncg_scan_buffer -#endif - -#ifdef yy_scan_string -#define ncg_scan_string_ALREADY_DEFINED -#else -#define yy_scan_string ncg_scan_string -#endif - -#ifdef yy_scan_bytes -#define ncg_scan_bytes_ALREADY_DEFINED -#else -#define yy_scan_bytes ncg_scan_bytes -#endif - -#ifdef yy_init_buffer -#define ncg_init_buffer_ALREADY_DEFINED -#else -#define yy_init_buffer ncg_init_buffer -#endif - -#ifdef yy_flush_buffer -#define ncg_flush_buffer_ALREADY_DEFINED -#else -#define yy_flush_buffer ncg_flush_buffer -#endif - -#ifdef yy_load_buffer_state -#define ncg_load_buffer_state_ALREADY_DEFINED -#else -#define yy_load_buffer_state ncg_load_buffer_state -#endif - -#ifdef yy_switch_to_buffer -#define ncg_switch_to_buffer_ALREADY_DEFINED -#else -#define yy_switch_to_buffer ncg_switch_to_buffer -#endif - -#ifdef yypush_buffer_state -#define ncgpush_buffer_state_ALREADY_DEFINED -#else -#define yypush_buffer_state ncgpush_buffer_state -#endif - -#ifdef yypop_buffer_state -#define ncgpop_buffer_state_ALREADY_DEFINED -#else -#define yypop_buffer_state ncgpop_buffer_state -#endif - -#ifdef yyensure_buffer_stack -#define ncgensure_buffer_stack_ALREADY_DEFINED -#else -#define yyensure_buffer_stack ncgensure_buffer_stack -#endif - -#ifdef yylex -#define ncglex_ALREADY_DEFINED -#else -#define yylex ncglex -#endif - -#ifdef yyrestart -#define ncgrestart_ALREADY_DEFINED -#else -#define yyrestart ncgrestart -#endif - -#ifdef yylex_init -#define ncglex_init_ALREADY_DEFINED -#else -#define yylex_init ncglex_init -#endif - -#ifdef yylex_init_extra -#define ncglex_init_extra_ALREADY_DEFINED -#else -#define yylex_init_extra ncglex_init_extra -#endif - -#ifdef yylex_destroy -#define ncglex_destroy_ALREADY_DEFINED -#else -#define yylex_destroy ncglex_destroy -#endif - -#ifdef yyget_debug -#define ncgget_debug_ALREADY_DEFINED -#else -#define yyget_debug ncgget_debug -#endif - -#ifdef yyset_debug -#define ncgset_debug_ALREADY_DEFINED -#else -#define yyset_debug ncgset_debug -#endif - -#ifdef yyget_extra -#define ncgget_extra_ALREADY_DEFINED -#else -#define yyget_extra ncgget_extra -#endif - -#ifdef yyset_extra -#define ncgset_extra_ALREADY_DEFINED -#else -#define yyset_extra ncgset_extra -#endif - -#ifdef yyget_in -#define ncgget_in_ALREADY_DEFINED -#else -#define yyget_in ncgget_in -#endif - -#ifdef yyset_in -#define ncgset_in_ALREADY_DEFINED -#else -#define yyset_in ncgset_in -#endif - -#ifdef yyget_out -#define ncgget_out_ALREADY_DEFINED -#else -#define yyget_out ncgget_out -#endif - -#ifdef yyset_out -#define ncgset_out_ALREADY_DEFINED -#else -#define yyset_out ncgset_out -#endif - -#ifdef yyget_leng -#define ncgget_leng_ALREADY_DEFINED -#else -#define yyget_leng ncgget_leng -#endif - -#ifdef yyget_text -#define ncgget_text_ALREADY_DEFINED -#else -#define yyget_text ncgget_text -#endif - -#ifdef yyget_lineno -#define ncgget_lineno_ALREADY_DEFINED -#else -#define yyget_lineno ncgget_lineno -#endif - -#ifdef yyset_lineno -#define ncgset_lineno_ALREADY_DEFINED -#else -#define yyset_lineno ncgset_lineno -#endif - -#ifdef yywrap -#define ncgwrap_ALREADY_DEFINED -#else -#define yywrap ncgwrap -#endif - -#ifdef yyalloc -#define ncgalloc_ALREADY_DEFINED -#else -#define yyalloc ncgalloc -#endif - -#ifdef yyrealloc -#define ncgrealloc_ALREADY_DEFINED -#else -#define yyrealloc ncgrealloc -#endif - -#ifdef yyfree -#define ncgfree_ALREADY_DEFINED -#else -#define yyfree ncgfree -#endif - -#ifdef yytext -#define ncgtext_ALREADY_DEFINED -#else -#define yytext ncgtext -#endif - -#ifdef yyleng -#define ncgleng_ALREADY_DEFINED -#else -#define yyleng ncgleng -#endif - -#ifdef yyin -#define ncgin_ALREADY_DEFINED -#else -#define yyin ncgin -#endif - -#ifdef yyout -#define ncgout_ALREADY_DEFINED -#else -#define yyout ncgout -#endif - -#ifdef yy_flex_debug -#define ncg_flex_debug_ALREADY_DEFINED -#else -#define yy_flex_debug ncg_flex_debug -#endif - -#ifdef yylineno -#define ncglineno_ALREADY_DEFINED -#else -#define yylineno ncglineno -#endif - /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ @@ -342,48 +102,60 @@ typedef unsigned int flex_uint32_t; #define UINT32_MAX (4294967295U) #endif -#ifndef SIZE_MAX -#define SIZE_MAX (~(size_t)0) -#endif - #endif /* ! C99 */ #endif /* ! FLEXINT_H */ -/* begin standard C++ headers. */ +#ifdef __cplusplus -/* TODO: this is always defined, so inline it */ -#define yyconst const +/* The "const" storage-class-modifier is valid. */ +#define YY_USE_CONST -#if defined(__GNUC__) && __GNUC__ >= 3 -#define yynoreturn __attribute__((__noreturn__)) +#else /* ! __cplusplus */ + +/* C99 requires __STDC__ to be defined as 1. */ +#if defined (__STDC__) + +#define YY_USE_CONST + +#endif /* defined (__STDC__) */ +#endif /* ! __cplusplus */ + +#ifdef YY_USE_CONST +#define yyconst const #else -#define yynoreturn +#define yyconst #endif /* Returned upon end-of-file. */ #define YY_NULL 0 -/* Promotes a possibly negative, possibly signed char to an - * integer in range [0..255] for use as an array index. +/* Promotes a possibly negative, possibly signed char to an unsigned + * integer for use as an array index. If the signed char is negative, + * we want to instead treat it as an 8-bit unsigned char, hence the + * double cast. */ -#define YY_SC_TO_UI(c) ((YY_CHAR) (c)) +#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c) /* Enter a start condition. This macro really ought to take a parameter, * but we do it the disgusting crufty way forced on us by the ()-less * definition of BEGIN. */ #define BEGIN (yy_start) = 1 + 2 * + /* Translate the current start state into a value that can be later handed * to BEGIN to return to the state. The YYSTATE alias is for lex * compatibility. */ #define YY_START (((yy_start) - 1) / 2) #define YYSTATE YY_START + /* Action number for EOF rule of a given start state. */ #define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1) + /* Special action meaning "start processing a new file". */ -#define YY_NEW_FILE yyrestart( yyin ) +#define YY_NEW_FILE ncgrestart(ncgin ) + #define YY_END_OF_BUFFER_CHAR 0 /* Size of default input buffer. */ @@ -413,14 +185,14 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; typedef size_t yy_size_t; #endif -extern int yyleng; +extern yy_size_t ncgleng; -extern FILE *yyin, *yyout; +extern FILE *ncgin, *ncgout; #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 - + #define YY_LESS_LINENO(n) #define YY_LINENO_REWIND_TO(ptr) @@ -428,15 +200,16 @@ extern FILE *yyin, *yyout; #define yyless(n) \ do \ { \ - /* Undo effects of setting up yytext. */ \ + /* Undo effects of setting up ncgtext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ *yy_cp = (yy_hold_char); \ YY_RESTORE_YY_MORE_OFFSET \ (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \ - YY_DO_BEFORE_ACTION; /* set up yytext again */ \ + YY_DO_BEFORE_ACTION; /* set up ncgtext again */ \ } \ while ( 0 ) + #define unput(c) yyunput( c, (yytext_ptr) ) #ifndef YY_STRUCT_YY_BUFFER_STATE @@ -451,7 +224,7 @@ struct yy_buffer_state /* Size of input buffer in bytes, not including room for EOB * characters. */ - int yy_buf_size; + yy_size_t yy_buf_size; /* Number of characters read into yy_ch_buf, not including EOB * characters. @@ -479,7 +252,7 @@ struct yy_buffer_state int yy_bs_lineno; /**< The line count. */ int yy_bs_column; /**< The column count. */ - + /* Whether to try to fill the input buffer when we reach the * end of it. */ @@ -496,8 +269,8 @@ struct yy_buffer_state * possible backing-up. * * When we actually see the EOF, we change the status to "new" - * (via yyrestart()), so that the user can continue scanning by - * just pointing yyin at a new input file. + * (via ncgrestart()), so that the user can continue scanning by + * just pointing ncgin at a new input file. */ #define YY_BUFFER_EOF_PENDING 2 @@ -507,7 +280,7 @@ struct yy_buffer_state /* Stack of input buffers. */ static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */ static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */ -static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ +static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */ /* We provide macros for accessing buffer states in case in the * future we want to put the buffer states in a more general @@ -518,98 +291,109 @@ static YY_BUFFER_STATE * yy_buffer_stack = NULL; /**< Stack as an array. */ #define YY_CURRENT_BUFFER ( (yy_buffer_stack) \ ? (yy_buffer_stack)[(yy_buffer_stack_top)] \ : NULL) + /* Same as previous macro, but useful when we know that the buffer stack is not * NULL or when we need an lvalue. For internal use only. */ #define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)] -/* yy_hold_char holds the character lost when yytext is formed. */ +/* yy_hold_char holds the character lost when ncgtext is formed. */ static char yy_hold_char; static int yy_n_chars; /* number of characters read into yy_ch_buf */ -int yyleng; +yy_size_t ncgleng; /* Points to current character in buffer. */ -static char *yy_c_buf_p = NULL; +static char *yy_c_buf_p = (char *) 0; static int yy_init = 0; /* whether we need to initialize */ static int yy_start = 0; /* start state number */ -/* Flag which is used to allow yywrap()'s to do buffer switches - * instead of setting up a fresh yyin. A bit of a hack ... +/* Flag which is used to allow ncgwrap()'s to do buffer switches + * instead of setting up a fresh ncgin. A bit of a hack ... */ static int yy_did_buffer_switch_on_eof; -void yyrestart ( FILE *input_file ); -void yy_switch_to_buffer ( YY_BUFFER_STATE new_buffer ); -YY_BUFFER_STATE yy_create_buffer ( FILE *file, int size ); -void yy_delete_buffer ( YY_BUFFER_STATE b ); -void yy_flush_buffer ( YY_BUFFER_STATE b ); -void yypush_buffer_state ( YY_BUFFER_STATE new_buffer ); -void yypop_buffer_state ( void ); +void ncgrestart (FILE *input_file ); +void ncg_switch_to_buffer (YY_BUFFER_STATE new_buffer ); +YY_BUFFER_STATE ncg_create_buffer (FILE *file,int size ); +void ncg_delete_buffer (YY_BUFFER_STATE b ); +void ncg_flush_buffer (YY_BUFFER_STATE b ); +void ncgpush_buffer_state (YY_BUFFER_STATE new_buffer ); +void ncgpop_buffer_state (void ); -static void yyensure_buffer_stack ( void ); -static void yy_load_buffer_state ( void ); -static void yy_init_buffer ( YY_BUFFER_STATE b, FILE *file ); -#define YY_FLUSH_BUFFER yy_flush_buffer( YY_CURRENT_BUFFER ) +static void ncgensure_buffer_stack (void ); +static void ncg_load_buffer_state (void ); +static void ncg_init_buffer (YY_BUFFER_STATE b,FILE *file ); -YY_BUFFER_STATE yy_scan_buffer ( char *base, yy_size_t size ); -YY_BUFFER_STATE yy_scan_string ( const char *yy_str ); -YY_BUFFER_STATE yy_scan_bytes ( const char *bytes, int len ); +#define YY_FLUSH_BUFFER ncg_flush_buffer(YY_CURRENT_BUFFER ) -void *yyalloc ( yy_size_t ); -void *yyrealloc ( void *, yy_size_t ); -void yyfree ( void * ); +YY_BUFFER_STATE ncg_scan_buffer (char *base,yy_size_t size ); +YY_BUFFER_STATE ncg_scan_string (yyconst char *yy_str ); +YY_BUFFER_STATE ncg_scan_bytes (yyconst char *bytes,yy_size_t len ); + +void *ncgalloc (yy_size_t ); +void *ncgrealloc (void *,yy_size_t ); +void ncgfree (void * ); + +#define yy_new_buffer ncg_create_buffer -#define yy_new_buffer yy_create_buffer #define yy_set_interactive(is_interactive) \ { \ if ( ! YY_CURRENT_BUFFER ){ \ - yyensure_buffer_stack (); \ + ncgensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer( yyin, YY_BUF_SIZE ); \ + ncg_create_buffer(ncgin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \ } + #define yy_set_bol(at_bol) \ { \ if ( ! YY_CURRENT_BUFFER ){\ - yyensure_buffer_stack (); \ + ncgensure_buffer_stack (); \ YY_CURRENT_BUFFER_LVALUE = \ - yy_create_buffer( yyin, YY_BUF_SIZE ); \ + ncg_create_buffer(ncgin,YY_BUF_SIZE ); \ } \ YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \ } + #define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol) /* Begin user sect3 */ -typedef flex_uint8_t YY_CHAR; -FILE *yyin = NULL, *yyout = NULL; +typedef unsigned char YY_CHAR; + +FILE *ncgin = (FILE *) 0, *ncgout = (FILE *) 0; typedef int yy_state_type; -extern int yylineno; -int yylineno = 1; +extern int ncglineno; + +int ncglineno = 1; -extern char *yytext; +extern char *ncgtext; #ifdef yytext_ptr #undef yytext_ptr #endif -#define yytext_ptr yytext +#define yytext_ptr ncgtext -static yy_state_type yy_get_previous_state ( void ); -static yy_state_type yy_try_NUL_trans ( yy_state_type current_state ); -static int yy_get_next_buffer ( void ); -static void yynoreturn yy_fatal_error ( const char* msg ); +static yy_state_type yy_get_previous_state (void ); +static yy_state_type yy_try_NUL_trans (yy_state_type current_state ); +static int yy_get_next_buffer (void ); +#if defined(__GNUC__) && __GNUC__ >= 3 +__attribute__((__noreturn__)) +#endif +static void yy_fatal_error (yyconst char msg[] ); /* Done after the current pattern has been matched and before the - * corresponding action - sets up yytext. + * corresponding action - sets up ncgtext. */ #define YY_DO_BEFORE_ACTION \ (yytext_ptr) = yy_bp; \ - yyleng = (int) (yy_cp - yy_bp); \ + ncgleng = (size_t) (yy_cp - yy_bp); \ (yy_hold_char) = *yy_cp; \ *yy_cp = '\0'; \ (yy_c_buf_p) = yy_cp; + #define YY_NUM_RULES 49 #define YY_END_OF_BUFFER 50 /* This struct is not used in this scanner, @@ -619,7 +403,7 @@ struct yy_trans_info flex_int32_t yy_verify; flex_int32_t yy_nxt; }; -static const flex_int16_t yy_accept[422] = +static yyconst flex_int16_t yy_accept[422] = { 0, 0, 0, 46, 46, 0, 0, 50, 48, 1, 44, 48, 48, 48, 48, 38, 32, 36, 36, 35, 35, @@ -670,7 +454,7 @@ static const flex_int16_t yy_accept[422] = 0 } ; -static const YY_CHAR yy_ec[256] = +static yyconst YY_CHAR yy_ec[256] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 2, 2, 1, 1, 1, 1, 1, 1, 1, @@ -702,7 +486,7 @@ static const YY_CHAR yy_ec[256] = 1, 1, 1, 1, 1 } ; -static const YY_CHAR yy_meta[69] = +static yyconst YY_CHAR yy_meta[69] = { 0, 1, 1, 2, 1, 1, 1, 3, 4, 5, 5, 6, 7, 8, 8, 8, 8, 8, 8, 8, 1, @@ -713,7 +497,7 @@ static const YY_CHAR yy_meta[69] = 11, 11, 11, 14, 1, 11, 11, 11 } ; -static const flex_int16_t yy_base[440] = +static yyconst flex_uint16_t yy_base[440] = { 0, 0, 0, 325, 321, 264, 255, 318, 2387, 67, 2387, 64, 269, 61, 62, 95, 77, 136, 259, 51, 61, @@ -765,7 +549,7 @@ static const flex_int16_t yy_base[440] = 2315, 2329, 2339, 2345, 2353, 2355, 2361, 2367, 2373 } ; -static const flex_int16_t yy_def[440] = +static yyconst flex_int16_t yy_def[440] = { 0, 421, 1, 422, 422, 423, 423, 421, 421, 421, 421, 424, 425, 421, 426, 421, 427, 421, 17, 428, 428, @@ -817,7 +601,7 @@ static const flex_int16_t yy_def[440] = 421, 421, 421, 421, 421, 421, 421, 421, 421 } ; -static const flex_int16_t yy_nxt[2456] = +static yyconst flex_uint16_t yy_nxt[2456] = { 0, 8, 9, 10, 9, 8, 11, 12, 8, 13, 14, 15, 16, 17, 18, 18, 18, 18, 18, 18, 8, @@ -1091,7 +875,7 @@ static const flex_int16_t yy_nxt[2456] = 421, 421, 421, 421, 421 } ; -static const flex_int16_t yy_chk[2456] = +static yyconst flex_int16_t yy_chk[2456] = { 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -1368,8 +1152,8 @@ static const flex_int16_t yy_chk[2456] = static yy_state_type yy_last_accepting_state; static char *yy_last_accepting_cpos; -extern int yy_flex_debug; -int yy_flex_debug = 0; +extern int ncg_flex_debug; +int ncg_flex_debug = 0; /* The intent behind this definition is that it'll catch * any uses of REJECT which flex missed. @@ -1378,7 +1162,7 @@ int yy_flex_debug = 0; #define yymore() yymore_used_but_not_detected #define YY_MORE_ADJ 0 #define YY_RESTORE_YY_MORE_OFFSET -char *yytext; +char *ncgtext; #line 1 "ncgen.l" #line 2 "ncgen.l" /********************************************************************* @@ -1518,7 +1302,7 @@ struct Specialtoken specials[] = { {NULL,0} /* null terminate */ }; -#line 1521 "ncgenl.c" + /* The most correct (validating) version of UTF8 character set (Taken from: http://www.w3.org/2005/03/23-lex-U) @@ -1561,7 +1345,7 @@ ID ([A-Za-z_]|{UTF8})([A-Z.@#\[\]a-z_0-9+-]|{UTF8})* /* Note: this definition of string will work for utf8 as well, although it is a very relaxed definition */ -#line 1564 "ncgenl.c" +#line 1349 "ncgenl.c" #define INITIAL 0 #define ST_C_COMMENT 1 @@ -1579,36 +1363,36 @@ ID ([A-Za-z_]|{UTF8})([A-Z.@#\[\]a-z_0-9+-]|{UTF8})* #define YY_EXTRA_TYPE void * #endif -static int yy_init_globals ( void ); +static int yy_init_globals (void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -int yylex_destroy ( void ); +int ncglex_destroy (void ); -int yyget_debug ( void ); +int ncgget_debug (void ); -void yyset_debug ( int debug_flag ); +void ncgset_debug (int debug_flag ); -YY_EXTRA_TYPE yyget_extra ( void ); +YY_EXTRA_TYPE ncgget_extra (void ); -void yyset_extra ( YY_EXTRA_TYPE user_defined ); +void ncgset_extra (YY_EXTRA_TYPE user_defined ); -FILE *yyget_in ( void ); +FILE *ncgget_in (void ); -void yyset_in ( FILE * _in_str ); +void ncgset_in (FILE * _in_str ); -FILE *yyget_out ( void ); +FILE *ncgget_out (void ); -void yyset_out ( FILE * _out_str ); +void ncgset_out (FILE * _out_str ); - int yyget_leng ( void ); +yy_size_t ncgget_leng (void ); -char *yyget_text ( void ); +char *ncgget_text (void ); -int yyget_lineno ( void ); +int ncgget_lineno (void ); -void yyset_lineno ( int _line_number ); +void ncgset_lineno (int _line_number ); /* Macros after this point can all be overridden by user definitions in * section 1. @@ -1616,31 +1400,32 @@ void yyset_lineno ( int _line_number ); #ifndef YY_SKIP_YYWRAP #ifdef __cplusplus -extern "C" int yywrap ( void ); +extern "C" int ncgwrap (void ); #else -extern int yywrap ( void ); +extern int ncgwrap (void ); #endif #endif #ifndef YY_NO_UNPUT - static void yyunput ( int c, char *buf_ptr ); + static void yyunput (int c,char *buf_ptr ); #endif #ifndef yytext_ptr -static void yy_flex_strncpy ( char *, const char *, int ); +static void yy_flex_strncpy (char *,yyconst char *,int ); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen ( const char * ); +static int yy_flex_strlen (yyconst char * ); #endif #ifndef YY_NO_INPUT + #ifdef __cplusplus -static int yyinput ( void ); +static int yyinput (void ); #else -static int input ( void ); +static int input (void ); #endif #endif @@ -1660,7 +1445,7 @@ static int input ( void ); /* This used to be an fputs(), but since the string might contain NUL's, * we now use fwrite(). */ -#define ECHO do { if (fwrite( yytext, (size_t) yyleng, 1, yyout )) {} } while (0) +#define ECHO do { if (fwrite( ncgtext, ncgleng, 1, ncgout )) {} } while (0) #endif /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, @@ -1671,20 +1456,20 @@ static int input ( void ); if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ { \ int c = '*'; \ - int n; \ + size_t n; \ for ( n = 0; n < max_size && \ - (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ + (c = getc( ncgin )) != EOF && c != '\n'; ++n ) \ buf[n] = (char) c; \ if ( c == '\n' ) \ buf[n++] = (char) c; \ - if ( c == EOF && ferror( yyin ) ) \ + if ( c == EOF && ferror( ncgin ) ) \ YY_FATAL_ERROR( "input in flex scanner failed" ); \ result = n; \ } \ else \ { \ errno=0; \ - while ( (result = (int) fread(buf, 1, (yy_size_t) max_size, yyin)) == 0 && ferror(yyin)) \ + while ( (result = fread(buf, 1, max_size, ncgin))==0 && ferror(ncgin)) \ { \ if( errno != EINTR) \ { \ @@ -1692,7 +1477,7 @@ static int input ( void ); break; \ } \ errno=0; \ - clearerr(yyin); \ + clearerr(ncgin); \ } \ }\ \ @@ -1725,12 +1510,12 @@ static int input ( void ); #ifndef YY_DECL #define YY_DECL_IS_OURS 1 -extern int yylex (void); +extern int ncglex (void); -#define YY_DECL int yylex (void) +#define YY_DECL int ncglex (void) #endif /* !YY_DECL */ -/* Code executed at the beginning of each rule, after yytext and yyleng +/* Code executed at the beginning of each rule, after ncgtext and ncgleng * have been set up. */ #ifndef YY_USER_ACTION @@ -1764,31 +1549,31 @@ YY_DECL if ( ! (yy_start) ) (yy_start) = 1; /* first start state */ - if ( ! yyin ) - yyin = stdin; + if ( ! ncgin ) + ncgin = stdin; - if ( ! yyout ) - yyout = stdout; + if ( ! ncgout ) + ncgout = stdout; if ( ! YY_CURRENT_BUFFER ) { - yyensure_buffer_stack (); + ncgensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer( yyin, YY_BUF_SIZE ); + ncg_create_buffer(ncgin,YY_BUF_SIZE ); } - yy_load_buffer_state( ); + ncg_load_buffer_state( ); } { #line 218 "ncgen.l" -#line 1785 "ncgenl.c" +#line 1571 "ncgenl.c" while ( /*CONSTCOND*/1 ) /* loops until end-of-file is reached */ { yy_cp = (yy_c_buf_p); - /* Support of yytext. */ + /* Support of ncgtext. */ *yy_cp = (yy_hold_char); /* yy_bp points to the position in yy_ch_buf of the start of @@ -1810,9 +1595,9 @@ YY_DECL { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 422 ) - yy_c = yy_meta[yy_c]; + yy_c = yy_meta[(unsigned int) yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; ++yy_cp; } while ( yy_base[yy_current_state] != 2387 ); @@ -1861,14 +1646,14 @@ YY_RULE_SETUP /* In netcdf4, this will be used in a variety of places, so only remove escapes */ /* -if(yyleng > MAXTRST) { +if(ncgleng > MAXTRST) { yyerror("string too long, truncated\n"); -yytext[MAXTRST-1] = '\0'; +ncgtext[MAXTRST-1] = '\0'; } */ - len = unescape((char *)yytext+1,yyleng-2,!ISIDENT,&s); + len = unescape((char *)ncgtext+1,ncgleng-2,!ISIDENT,&s); if(len < 0) { - sprintf(errstr,"Illegal character: %s",yytext); + sprintf(errstr,"Illegal character: %s",ncgtext); yyerror(errstr); } bbClear(lextext); @@ -1882,8 +1667,8 @@ case 4: YY_RULE_SETUP #line 248 "ncgen.l" { /* drop leading 0x; pad to even number of chars */ - char* p = yytext+2; - int len = yyleng - 2; + char* p = ncgtext+2; + int len = ncgleng - 2; bbClear(lextext); bbAppendn(lextext,p,len); if((len % 2) == 1) bbAppend(lextext,'0'); @@ -2008,7 +1793,7 @@ case 27: YY_RULE_SETUP #line 288 "ncgen.l" { /* missing value (pre-2.4 backward compatibility) */ - if (yytext[0] == '-') { + if (ncgtext[0] == '-') { double_val = NEGNC_INFINITE; } else { double_val = NC_INFINITE; @@ -2030,7 +1815,7 @@ case 29: YY_RULE_SETUP #line 303 "ncgen.l" {/* missing value (pre-2.4 backward compatibility)*/ - if (yytext[0] == '-') { + if (ncgtext[0] == '-') { float_val = NEGNC_INFINITEF; } else { float_val = NC_INFINITEF; @@ -2066,7 +1851,7 @@ YY_RULE_SETUP #line 328 "ncgen.l" { bbClear(lextext); - bbAppendn(lextext,(char*)yytext,yyleng+1); /* include null */ + bbAppendn(lextext,(char*)ncgtext,ncgleng+1); /* include null */ bbNull(lextext); yylval.sym = makepath(bbContents(lextext)); return lexdebug(PATH); @@ -2077,7 +1862,7 @@ YY_RULE_SETUP #line 337 "ncgen.l" {struct Specialtoken* st; bbClear(lextext); - bbAppendn(lextext,(char*)yytext,yyleng+1); /* include null */ + bbAppendn(lextext,(char*)ncgtext,ncgleng+1); /* include null */ bbNull(lextext); for(st=specials;st->name;st++) { if(strcmp(bbContents(lextext),st->name)==0) {return lexdebug(st->token);} @@ -2094,7 +1879,7 @@ YY_RULE_SETUP char* p; char* q; /* copy the trimmed name */ bbClear(lextext); - bbAppendn(lextext,(char*)yytext,yyleng+1); /* include null */ + bbAppendn(lextext,(char*)ncgtext,ncgleng+1); /* include null */ bbNull(lextext); p = bbContents(lextext); q = p; @@ -2110,8 +1895,8 @@ case 35: YY_RULE_SETUP #line 364 "ncgen.l" { char* id = NULL; int len; - len = strlen(yytext); - len = unescape(yytext,len,ISIDENT,&id); + len = strlen(ncgtext); + len = unescape(ncgtext,len,ISIDENT,&id); if(NCSTREQ(id, FILL_STRING)) { efree(id); return lexdebug(FILLMARKER); @@ -2195,21 +1980,21 @@ YY_RULE_SETUP { int c; int token = 0; - int slen = strlen(yytext); + int slen = strlen(ncgtext); char* stag = NULL; int tag = NC_NAT; - char* hex = yytext+2; /* point to first true hex digit */ + char* hex = ncgtext+2; /* point to first true hex digit */ int xlen = (slen - 3); /* true hex length */ - yytext[slen-1] = '\0'; + ncgtext[slen-1] = '\0'; /* capture the tag string */ - tag = collecttag(yytext,&stag); + tag = collecttag(ncgtext,&stag); if(tag == NC_NAT) { sprintf(errstr,"Illegal integer suffix: %s",stag); yyerror(errstr); goto done; } - yytext[slen - strlen(stag)] = '\0'; + ncgtext[slen - strlen(stag)] = '\0'; if(xlen > 16) { /* truncate hi order digits */ hex += (xlen - 16); } @@ -2231,8 +2016,8 @@ YY_RULE_SETUP token = UINT64_CONST; break; default: /* should never happen */ - if (sscanf((char*)yytext, "%i", &uint32_val) != 1) { - sprintf(errstr,"bad unsigned int constant: %s",(char*)yytext); + if (sscanf((char*)ncgtext, "%i", &uint32_val) != 1) { + sprintf(errstr,"bad unsigned int constant: %s",(char*)ncgtext); yyerror(errstr); } token = UINT_CONST; @@ -2244,8 +2029,8 @@ case 38: YY_RULE_SETUP #line 488 "ncgen.l" { - if (sscanf((char*)yytext, "%le", &double_val) != 1) { - sprintf(errstr,"bad long or double constant: %s",(char*)yytext); + if (sscanf((char*)ncgtext, "%le", &double_val) != 1) { + sprintf(errstr,"bad long or double constant: %s",(char*)ncgtext); yyerror(errstr); } return lexdebug(DOUBLE_CONST); @@ -2255,8 +2040,8 @@ case 39: YY_RULE_SETUP #line 495 "ncgen.l" { - if (sscanf((char*)yytext, "%e", &float_val) != 1) { - sprintf(errstr,"bad float constant: %s",(char*)yytext); + if (sscanf((char*)ncgtext, "%e", &float_val) != 1) { + sprintf(errstr,"bad float constant: %s",(char*)ncgtext); yyerror(errstr); } return lexdebug(FLOAT_CONST); @@ -2267,7 +2052,7 @@ case 40: YY_RULE_SETUP #line 502 "ncgen.l" { - (void) sscanf((char*)&yytext[1],"%c",&byte_val); + (void) sscanf((char*)&ncgtext[1],"%c",&byte_val); return lexdebug(BYTE_CONST); } YY_BREAK @@ -2275,9 +2060,9 @@ case 41: YY_RULE_SETUP #line 506 "ncgen.l" { - int oct = unescapeoct(&yytext[2]); + int oct = unescapeoct(&ncgtext[2]); if(oct < 0) { - sprintf(errstr,"bad octal character constant: %s",(char*)yytext); + sprintf(errstr,"bad octal character constant: %s",(char*)ncgtext); yyerror(errstr); } byte_val = (unsigned int)oct; @@ -2288,9 +2073,9 @@ case 42: YY_RULE_SETUP #line 515 "ncgen.l" { - int hex = unescapehex(&yytext[3]); + int hex = unescapehex(&ncgtext[3]); if(byte_val < 0) { - sprintf(errstr,"bad hex character constant: %s",(char*)yytext); + sprintf(errstr,"bad hex character constant: %s",(char*)ncgtext); yyerror(errstr); } byte_val = (unsigned int)hex; @@ -2301,7 +2086,7 @@ case 43: YY_RULE_SETUP #line 524 "ncgen.l" { - switch ((char)yytext[2]) { + switch ((char)ncgtext[2]) { case 'a': byte_val = '\007'; break; /* not everyone under- * stands '\a' yet */ case 'b': byte_val = '\b'; break; @@ -2313,7 +2098,7 @@ YY_RULE_SETUP case '\\': byte_val = '\\'; break; case '?': byte_val = '\177'; break; case '\'': byte_val = '\''; break; - default: byte_val = (char)yytext[2]; + default: byte_val = (char)ncgtext[2]; } return lexdebug(BYTE_CONST); } @@ -2363,7 +2148,7 @@ case 48: YY_RULE_SETUP #line 567 "ncgen.l" {/* Note: this next rule will not work for UTF8 characters */ - return lexdebug(yytext[0]) ; + return lexdebug(ncgtext[0]) ; } YY_BREAK case 49: @@ -2371,7 +2156,7 @@ YY_RULE_SETUP #line 570 "ncgen.l" ECHO; YY_BREAK -#line 2374 "ncgenl.c" +#line 2160 "ncgenl.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(TEXT): yyterminate(); @@ -2389,15 +2174,15 @@ case YY_STATE_EOF(TEXT): { /* We're scanning a new file or input source. It's * possible that this happened because the user - * just pointed yyin at a new source and called - * yylex(). If so, then we have to assure + * just pointed ncgin at a new source and called + * ncglex(). If so, then we have to assure * consistency between YY_CURRENT_BUFFER and our * globals. Here is the right place to do so, because * this is the first action (other than possibly a * back-up) that will match for the new input source. */ (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; - YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin; + YY_CURRENT_BUFFER_LVALUE->yy_input_file = ncgin; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL; } @@ -2450,11 +2235,11 @@ case YY_STATE_EOF(TEXT): { (yy_did_buffer_switch_on_eof) = 0; - if ( yywrap( ) ) + if ( ncgwrap( ) ) { /* Note: because we've taken care in * yy_get_next_buffer() to have set up - * yytext, we can now set up + * ncgtext, we can now set up * yy_c_buf_p so that if some total * hoser (like flex itself) wants to * call the scanner after we return the @@ -2504,7 +2289,7 @@ case YY_STATE_EOF(TEXT): } /* end of action switch */ } /* end of scanning one token */ } /* end of user's declarations */ -} /* end of yylex */ +} /* end of ncglex */ /* yy_get_next_buffer - try to read in a new buffer * @@ -2517,7 +2302,7 @@ static int yy_get_next_buffer (void) { char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; char *source = (yytext_ptr); - int number_to_move, i; + yy_size_t number_to_move, i; int ret_val; if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] ) @@ -2546,7 +2331,7 @@ static int yy_get_next_buffer (void) /* Try to read more data. */ /* First move last chars to start of buffer. */ - number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr) - 1); + number_to_move = (yy_size_t) ((yy_c_buf_p) - (yytext_ptr)) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); @@ -2559,7 +2344,7 @@ static int yy_get_next_buffer (void) else { - int num_to_read = + yy_size_t num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) @@ -2573,7 +2358,7 @@ static int yy_get_next_buffer (void) if ( b->yy_is_our_buffer ) { - int new_size = b->yy_buf_size * 2; + yy_size_t new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; @@ -2582,12 +2367,11 @@ static int yy_get_next_buffer (void) b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ - yyrealloc( (void *) b->yy_ch_buf, - (yy_size_t) (b->yy_buf_size + 2) ); + ncgrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ); } else /* Can't grow it, we don't own it. */ - b->yy_ch_buf = NULL; + b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( @@ -2615,7 +2399,7 @@ static int yy_get_next_buffer (void) if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; - yyrestart( yyin ); + ncgrestart(ncgin ); } else @@ -2629,15 +2413,12 @@ static int yy_get_next_buffer (void) else ret_val = EOB_ACT_CONTINUE_SCAN; - if (((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { + if ((int) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ int new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1); - YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc( - (void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf, (yy_size_t) new_size ); + YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) ncgrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" ); - /* "- 2" to take care of EOB's */ - YY_CURRENT_BUFFER_LVALUE->yy_buf_size = (int) (new_size - 2); } (yy_n_chars) += number_to_move; @@ -2670,9 +2451,9 @@ static int yy_get_next_buffer (void) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 422 ) - yy_c = yy_meta[yy_c]; + yy_c = yy_meta[(unsigned int) yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; } return yy_current_state; @@ -2698,9 +2479,9 @@ static int yy_get_next_buffer (void) { yy_current_state = (int) yy_def[yy_current_state]; if ( yy_current_state >= 422 ) - yy_c = yy_meta[yy_c]; + yy_c = yy_meta[(unsigned int) yy_c]; } - yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c]; + yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c]; yy_is_jam = (yy_current_state == 421); return yy_is_jam ? 0 : yy_current_state; @@ -2714,13 +2495,13 @@ static int yy_get_next_buffer (void) yy_cp = (yy_c_buf_p); - /* undo effects of setting up yytext */ + /* undo effects of setting up ncgtext */ *yy_cp = (yy_hold_char); if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) { /* need to shift things up to make room */ /* +2 for EOB chars. */ - int number_to_move = (yy_n_chars) + 2; + yy_size_t number_to_move = (yy_n_chars) + 2; char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[ YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2]; char *source = @@ -2732,7 +2513,7 @@ static int yy_get_next_buffer (void) yy_cp += (int) (dest - source); yy_bp += (int) (dest - source); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = - (yy_n_chars) = (int) YY_CURRENT_BUFFER_LVALUE->yy_buf_size; + (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size; if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 ) YY_FATAL_ERROR( "flex scanner push-back overflow" ); @@ -2771,7 +2552,7 @@ static int yy_get_next_buffer (void) else { /* need more input */ - int offset = (int) ((yy_c_buf_p) - (yytext_ptr)); + yy_size_t offset = (yy_c_buf_p) - (yytext_ptr); ++(yy_c_buf_p); switch ( yy_get_next_buffer( ) ) @@ -2788,14 +2569,14 @@ static int yy_get_next_buffer (void) */ /* Reset buffer status. */ - yyrestart( yyin ); + ncgrestart(ncgin ); /*FALLTHROUGH*/ case EOB_ACT_END_OF_FILE: { - if ( yywrap( ) ) - return 0; + if ( ncgwrap( ) ) + return EOF; if ( ! (yy_did_buffer_switch_on_eof) ) YY_NEW_FILE; @@ -2814,7 +2595,7 @@ static int yy_get_next_buffer (void) } c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */ - *(yy_c_buf_p) = '\0'; /* preserve yytext */ + *(yy_c_buf_p) = '\0'; /* preserve ncgtext */ (yy_hold_char) = *++(yy_c_buf_p); return c; @@ -2826,32 +2607,32 @@ static int yy_get_next_buffer (void) * * @note This function does not reset the start condition to @c INITIAL . */ - void yyrestart (FILE * input_file ) + void ncgrestart (FILE * input_file ) { if ( ! YY_CURRENT_BUFFER ){ - yyensure_buffer_stack (); + ncgensure_buffer_stack (); YY_CURRENT_BUFFER_LVALUE = - yy_create_buffer( yyin, YY_BUF_SIZE ); + ncg_create_buffer(ncgin,YY_BUF_SIZE ); } - yy_init_buffer( YY_CURRENT_BUFFER, input_file ); - yy_load_buffer_state( ); + ncg_init_buffer(YY_CURRENT_BUFFER,input_file ); + ncg_load_buffer_state( ); } /** Switch to a different input buffer. * @param new_buffer The new input buffer. * */ - void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) + void ncg_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body * with - * yypop_buffer_state(); - * yypush_buffer_state(new_buffer); + * ncgpop_buffer_state(); + * ncgpush_buffer_state(new_buffer); */ - yyensure_buffer_stack (); + ncgensure_buffer_stack (); if ( YY_CURRENT_BUFFER == new_buffer ) return; @@ -2864,21 +2645,21 @@ static int yy_get_next_buffer (void) } YY_CURRENT_BUFFER_LVALUE = new_buffer; - yy_load_buffer_state( ); + ncg_load_buffer_state( ); /* We don't actually know whether we did this switch during - * EOF (yywrap()) processing, but the only time this flag - * is looked at is after yywrap() is called, so it's safe + * EOF (ncgwrap()) processing, but the only time this flag + * is looked at is after ncgwrap() is called, so it's safe * to go ahead and always set it. */ (yy_did_buffer_switch_on_eof) = 1; } -static void yy_load_buffer_state (void) +static void ncg_load_buffer_state (void) { (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars; (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos; - yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; + ncgin = YY_CURRENT_BUFFER_LVALUE->yy_input_file; (yy_hold_char) = *(yy_c_buf_p); } @@ -2888,35 +2669,35 @@ static void yy_load_buffer_state (void) * * @return the allocated buffer state. */ - YY_BUFFER_STATE yy_create_buffer (FILE * file, int size ) + YY_BUFFER_STATE ncg_create_buffer (FILE * file, int size ) { YY_BUFFER_STATE b; - b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) ncgalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in ncg_create_buffer()" ); - b->yy_buf_size = size; + b->yy_buf_size = (yy_size_t)size; /* yy_ch_buf has to be 2 characters longer than the size given because * we need to put in 2 end-of-buffer characters. */ - b->yy_ch_buf = (char *) yyalloc( (yy_size_t) (b->yy_buf_size + 2) ); + b->yy_ch_buf = (char *) ncgalloc(b->yy_buf_size + 2 ); if ( ! b->yy_ch_buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in ncg_create_buffer()" ); b->yy_is_our_buffer = 1; - yy_init_buffer( b, file ); + ncg_init_buffer(b,file ); return b; } /** Destroy the buffer. - * @param b a buffer created with yy_create_buffer() + * @param b a buffer created with ncg_create_buffer() * */ - void yy_delete_buffer (YY_BUFFER_STATE b ) + void ncg_delete_buffer (YY_BUFFER_STATE b ) { if ( ! b ) @@ -2926,27 +2707,27 @@ static void yy_load_buffer_state (void) YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0; if ( b->yy_is_our_buffer ) - yyfree( (void *) b->yy_ch_buf ); + ncgfree((void *) b->yy_ch_buf ); - yyfree( (void *) b ); + ncgfree((void *) b ); } /* Initializes or reinitializes a buffer. * This function is sometimes called more than once on the same buffer, - * such as during a yyrestart() or at EOF. + * such as during a ncgrestart() or at EOF. */ - static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file ) + static void ncg_init_buffer (YY_BUFFER_STATE b, FILE * file ) { int oerrno = errno; - yy_flush_buffer( b ); + ncg_flush_buffer(b ); b->yy_input_file = file; b->yy_fill_buffer = 1; - /* If b is the current buffer, then yy_init_buffer was _probably_ - * called from yyrestart() or through yy_get_next_buffer. + /* If b is the current buffer, then ncg_init_buffer was _probably_ + * called from ncgrestart() or through yy_get_next_buffer. * In that case, we don't want to reset the lineno or column. */ if (b != YY_CURRENT_BUFFER){ @@ -2963,7 +2744,7 @@ static void yy_load_buffer_state (void) * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER. * */ - void yy_flush_buffer (YY_BUFFER_STATE b ) + void ncg_flush_buffer (YY_BUFFER_STATE b ) { if ( ! b ) return; @@ -2983,7 +2764,7 @@ static void yy_load_buffer_state (void) b->yy_buffer_status = YY_BUFFER_NEW; if ( b == YY_CURRENT_BUFFER ) - yy_load_buffer_state( ); + ncg_load_buffer_state( ); } /** Pushes the new state onto the stack. The new state becomes @@ -2992,14 +2773,14 @@ static void yy_load_buffer_state (void) * @param new_buffer The new state. * */ -void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) +void ncgpush_buffer_state (YY_BUFFER_STATE new_buffer ) { if (new_buffer == NULL) return; - yyensure_buffer_stack(); + ncgensure_buffer_stack(); - /* This block is copied from yy_switch_to_buffer. */ + /* This block is copied from ncg_switch_to_buffer. */ if ( YY_CURRENT_BUFFER ) { /* Flush out information for old buffer. */ @@ -3013,8 +2794,8 @@ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) (yy_buffer_stack_top)++; YY_CURRENT_BUFFER_LVALUE = new_buffer; - /* copied from yy_switch_to_buffer. */ - yy_load_buffer_state( ); + /* copied from ncg_switch_to_buffer. */ + ncg_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } @@ -3022,18 +2803,18 @@ void yypush_buffer_state (YY_BUFFER_STATE new_buffer ) * The next element becomes the new top. * */ -void yypop_buffer_state (void) +void ncgpop_buffer_state (void) { if (!YY_CURRENT_BUFFER) return; - yy_delete_buffer(YY_CURRENT_BUFFER ); + ncg_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; if ((yy_buffer_stack_top) > 0) --(yy_buffer_stack_top); if (YY_CURRENT_BUFFER) { - yy_load_buffer_state( ); + ncg_load_buffer_state( ); (yy_did_buffer_switch_on_eof) = 1; } } @@ -3041,7 +2822,7 @@ void yypop_buffer_state (void) /* Allocates the stack if it does not exist. * Guarantees space for at least one push. */ -static void yyensure_buffer_stack (void) +static void ncgensure_buffer_stack (void) { yy_size_t num_to_alloc; @@ -3051,15 +2832,15 @@ static void yyensure_buffer_stack (void) * scanner will even need a stack. We use 2 instead of 1 to avoid an * immediate realloc on the next call. */ - num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ - (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc + num_to_alloc = 1; /* After all that talk, this was set to 1 anyways... */ + (yy_buffer_stack) = (struct yy_buffer_state**)ncgalloc (num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); - + YY_FATAL_ERROR( "out of dynamic memory in ncgensure_buffer_stack()" ); + memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*)); - + (yy_buffer_stack_max) = num_to_alloc; (yy_buffer_stack_top) = 0; return; @@ -3071,12 +2852,12 @@ static void yyensure_buffer_stack (void) yy_size_t grow_size = 8 /* arbitrary grow size */; num_to_alloc = (yy_buffer_stack_max) + grow_size; - (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc + (yy_buffer_stack) = (struct yy_buffer_state**)ncgrealloc ((yy_buffer_stack), num_to_alloc * sizeof(struct yy_buffer_state*) ); if ( ! (yy_buffer_stack) ) - YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" ); + YY_FATAL_ERROR( "out of dynamic memory in ncgensure_buffer_stack()" ); /* zero only the new slots.*/ memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*)); @@ -3088,9 +2869,9 @@ static void yyensure_buffer_stack (void) * @param base the character buffer * @param size the size in bytes of the character buffer * - * @return the newly allocated buffer state object. + * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) +YY_BUFFER_STATE ncg_scan_buffer (char * base, yy_size_t size ) { YY_BUFFER_STATE b; @@ -3098,69 +2879,69 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size ) base[size-2] != YY_END_OF_BUFFER_CHAR || base[size-1] != YY_END_OF_BUFFER_CHAR ) /* They forgot to leave room for the EOB's. */ - return NULL; + return 0; - b = (YY_BUFFER_STATE) yyalloc( sizeof( struct yy_buffer_state ) ); + b = (YY_BUFFER_STATE) ncgalloc(sizeof( struct yy_buffer_state ) ); if ( ! b ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" ); + YY_FATAL_ERROR( "out of dynamic memory in ncg_scan_buffer()" ); - b->yy_buf_size = (int) (size - 2); /* "- 2" to take care of EOB's */ + b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */ b->yy_buf_pos = b->yy_ch_buf = base; b->yy_is_our_buffer = 0; - b->yy_input_file = NULL; + b->yy_input_file = 0; b->yy_n_chars = b->yy_buf_size; b->yy_is_interactive = 0; b->yy_at_bol = 1; b->yy_fill_buffer = 0; b->yy_buffer_status = YY_BUFFER_NEW; - yy_switch_to_buffer( b ); + ncg_switch_to_buffer(b ); return b; } -/** Setup the input buffer state to scan a string. The next call to yylex() will +/** Setup the input buffer state to scan a string. The next call to ncglex() will * scan from a @e copy of @a str. * @param yystr a NUL-terminated string to scan * * @return the newly allocated buffer state object. * @note If you want to scan bytes that may contain NUL values, then use - * yy_scan_bytes() instead. + * ncg_scan_bytes() instead. */ -YY_BUFFER_STATE yy_scan_string (const char * yystr ) +YY_BUFFER_STATE ncg_scan_string (yyconst char * yystr ) { - return yy_scan_bytes( yystr, (int) strlen(yystr) ); + return ncg_scan_bytes(yystr,strlen(yystr) ); } -/** Setup the input buffer state to scan the given bytes. The next call to yylex() will +/** Setup the input buffer state to scan the given bytes. The next call to ncglex() will * scan from a @e copy of @a bytes. * @param yybytes the byte buffer to scan * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. * * @return the newly allocated buffer state object. */ -YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) +YY_BUFFER_STATE ncg_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len ) { YY_BUFFER_STATE b; char *buf; yy_size_t n; - int i; + yy_size_t i; /* Get memory for full buffer, including space for trailing EOB's. */ - n = (yy_size_t) (_yybytes_len + 2); - buf = (char *) yyalloc( n ); + n = _yybytes_len + 2; + buf = (char *) ncgalloc(n ); if ( ! buf ) - YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" ); + YY_FATAL_ERROR( "out of dynamic memory in ncg_scan_bytes()" ); for ( i = 0; i < _yybytes_len; ++i ) buf[i] = yybytes[i]; buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR; - b = yy_scan_buffer( buf, n ); + b = ncg_scan_buffer(buf,n ); if ( ! b ) - YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" ); + YY_FATAL_ERROR( "bad buffer in ncg_scan_bytes()" ); /* It's okay to grow etc. this buffer, and we should throw it * away when we're done. @@ -3174,9 +2955,9 @@ YY_BUFFER_STATE yy_scan_bytes (const char * yybytes, int _yybytes_len ) #define YY_EXIT_FAILURE 2 #endif -static void yynoreturn yy_fatal_error (const char* msg ) +static void yy_fatal_error (yyconst char* msg ) { - fprintf( stderr, "%s\n", msg ); + (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); } @@ -3186,14 +2967,14 @@ static void yynoreturn yy_fatal_error (const char* msg ) #define yyless(n) \ do \ { \ - /* Undo effects of setting up yytext. */ \ + /* Undo effects of setting up ncgtext. */ \ int yyless_macro_arg = (n); \ YY_LESS_LINENO(yyless_macro_arg);\ - yytext[yyleng] = (yy_hold_char); \ - (yy_c_buf_p) = yytext + yyless_macro_arg; \ + ncgtext[ncgleng] = (yy_hold_char); \ + (yy_c_buf_p) = ncgtext + yyless_macro_arg; \ (yy_hold_char) = *(yy_c_buf_p); \ *(yy_c_buf_p) = '\0'; \ - yyleng = yyless_macro_arg; \ + ncgleng = yyless_macro_arg; \ } \ while ( 0 ) @@ -3202,126 +2983,126 @@ static void yynoreturn yy_fatal_error (const char* msg ) /** Get the current line number. * */ -int yyget_lineno (void) +int ncgget_lineno (void) { - - return yylineno; + + return ncglineno; } /** Get the input stream. * */ -FILE *yyget_in (void) +FILE *ncgget_in (void) { - return yyin; + return ncgin; } /** Get the output stream. * */ -FILE *yyget_out (void) +FILE *ncgget_out (void) { - return yyout; + return ncgout; } /** Get the length of the current token. * */ -int yyget_leng (void) +yy_size_t ncgget_leng (void) { - return yyleng; + return ncgleng; } /** Get the current token. * */ -char *yyget_text (void) +char *ncgget_text (void) { - return yytext; + return ncgtext; } /** Set the current line number. * @param _line_number line number * */ -void yyset_lineno (int _line_number ) +void ncgset_lineno (int _line_number ) { - yylineno = _line_number; + ncglineno = _line_number; } /** Set the input stream. This does not discard the current * input buffer. * @param _in_str A readable stream. * - * @see yy_switch_to_buffer + * @see ncg_switch_to_buffer */ -void yyset_in (FILE * _in_str ) +void ncgset_in (FILE * _in_str ) { - yyin = _in_str ; + ncgin = _in_str ; } -void yyset_out (FILE * _out_str ) +void ncgset_out (FILE * _out_str ) { - yyout = _out_str ; + ncgout = _out_str ; } -int yyget_debug (void) +int ncgget_debug (void) { - return yy_flex_debug; + return ncg_flex_debug; } -void yyset_debug (int _bdebug ) +void ncgset_debug (int _bdebug ) { - yy_flex_debug = _bdebug ; + ncg_flex_debug = _bdebug ; } static int yy_init_globals (void) { /* Initialization is the same as for the non-reentrant scanner. - * This function is called from yylex_destroy(), so don't allocate here. + * This function is called from ncglex_destroy(), so don't allocate here. */ - (yy_buffer_stack) = NULL; + (yy_buffer_stack) = 0; (yy_buffer_stack_top) = 0; (yy_buffer_stack_max) = 0; - (yy_c_buf_p) = NULL; + (yy_c_buf_p) = (char *) 0; (yy_init) = 0; (yy_start) = 0; /* Defined in main.c */ #ifdef YY_STDINIT - yyin = stdin; - yyout = stdout; + ncgin = stdin; + ncgout = stdout; #else - yyin = NULL; - yyout = NULL; + ncgin = (FILE *) 0; + ncgout = (FILE *) 0; #endif /* For future reference: Set errno on error, since we are called by - * yylex_init() + * ncglex_init() */ return 0; } -/* yylex_destroy is for both reentrant and non-reentrant scanners. */ -int yylex_destroy (void) +/* ncglex_destroy is for both reentrant and non-reentrant scanners. */ +int ncglex_destroy (void) { /* Pop the buffer stack, destroying each element. */ while(YY_CURRENT_BUFFER){ - yy_delete_buffer( YY_CURRENT_BUFFER ); + ncg_delete_buffer(YY_CURRENT_BUFFER ); YY_CURRENT_BUFFER_LVALUE = NULL; - yypop_buffer_state(); + ncgpop_buffer_state(); } /* Destroy the stack itself. */ - yyfree((yy_buffer_stack) ); + ncgfree((yy_buffer_stack) ); (yy_buffer_stack) = NULL; /* Reset the globals. This is important in a non-reentrant scanner so the next time - * yylex() is called, initialization will occur. */ + * ncglex() is called, initialization will occur. */ yy_init_globals( ); return 0; @@ -3332,7 +3113,7 @@ int yylex_destroy (void) */ #ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, const char * s2, int n ) +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n ) { int i; @@ -3342,7 +3123,7 @@ static void yy_flex_strncpy (char* s1, const char * s2, int n ) #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (const char * s ) +static int yy_flex_strlen (yyconst char * s ) { int n; for ( n = 0; s[n]; ++n ) @@ -3352,12 +3133,12 @@ static int yy_flex_strlen (const char * s ) } #endif -void *yyalloc (yy_size_t size ) +void *ncgalloc (yy_size_t size ) { - return malloc(size); + return (void *) malloc( size ); } -void *yyrealloc (void * ptr, yy_size_t size ) +void *ncgrealloc (void * ptr, yy_size_t size ) { /* The cast to (char *) in the following accommodates both @@ -3367,25 +3148,26 @@ void *yyrealloc (void * ptr, yy_size_t size ) * any pointer type to void*, and deal with argument conversions * as though doing an assignment. */ - return realloc(ptr, size); + return (void *) realloc( (char *) ptr, size ); } -void yyfree (void * ptr ) +void ncgfree (void * ptr ) { - free( (char *) ptr ); /* see yyrealloc() for (char *) cast */ + free( (char *) ptr ); /* see ncgrealloc() for (char *) cast */ } #define YYTABLES_NAME "yytables" #line 570 "ncgen.l" + static int lexdebug(int token) { if(debug >= 2) { - char* text = yytext; - text[yyleng] = 0; + char* text = ncgtext; + text[ncgleng] = 0; fprintf(stderr,"Token=%d |%s| line=%d\n",token,text,lineno); } return token; From 30540026db81316d4af03600f5651b74fd6d350b Mon Sep 17 00:00:00 2001 From: Greg Sjaardema Date: Fri, 7 Dec 2018 08:44:46 -0700 Subject: [PATCH 02/24] Eliminate nested comments Looks like extra comment begin and a missing comment end resulted in nested comments. Results in warning on at least the ibm compiler: ``` In file included from /g/g16/TPL/netcdf/netcdf-c/include/nc4internal.h:24:0, from /g/g16/TPL/netcdf/netcdf-c/ncgen/includes.h:50, from /g/g16/TPL/netcdf/netcdf-c/ncgen/genc.c:7: /g/g16/TPL/netcdf/netcdf-c/include/nc_provenance.h:4:1: warning: "/*" within comment [-Wcomment] /** ^ ``` --- include/nc_provenance.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/nc_provenance.h b/include/nc_provenance.h index ef9825a3dc..df7412c6a3 100644 --- a/include/nc_provenance.h +++ b/include/nc_provenance.h @@ -1,12 +1,13 @@ /* Copyright 2005-2018 University Corporation for Atmospheric Research/Unidata. */ -/** + /** * @file * @internal Contains information for creating provenance * info and/or displaying provenance info. * * @author Dennis Heimbigner, Ward Fisher + */ /**************************************************/ /** From 3c9a141ee3ee09f5b5a982e8ae135ae76f972207 Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Tue, 11 Dec 2018 06:15:47 -0700 Subject: [PATCH 03/24] moved function detect_preserve_dimids and made it static --- include/hdf5internal.h | 1 - libhdf5/hdf5file.c | 80 +++++++++++++++++++++++++++++++++++++++++- libhdf5/nc4hdf.c | 78 ---------------------------------------- 3 files changed, 79 insertions(+), 80 deletions(-) diff --git a/include/hdf5internal.h b/include/hdf5internal.h index 4ed7db828d..aaa2a5ddb3 100644 --- a/include/hdf5internal.h +++ b/include/hdf5internal.h @@ -137,7 +137,6 @@ extern hid_t NC4_image_init(NC_FILE_INFO_T* h5); extern void NC4_image_finalize(void*); /* These functions are internal to the libhdf5 directory. */ -int nc4_detect_preserve_dimids(NC_GRP_INFO_T *grp, nc_bool_t *bad_coord_orderp); int nc4_get_fill_value(NC_FILE_INFO_T *h5, NC_VAR_INFO_T *var, void **fillp); /* Find file, group, var, and att info, doing lazy reads if needed. */ diff --git a/libhdf5/hdf5file.c b/libhdf5/hdf5file.c index 730417ec67..411ece277d 100644 --- a/libhdf5/hdf5file.c +++ b/libhdf5/hdf5file.c @@ -75,6 +75,84 @@ NC_findreserved(const char* name) return NULL; } +/** + * @internal Recursively determine if there is a mismatch between + * order of coordinate creation and associated dimensions in this + * group or any subgroups, to find out if we have to handle that + * situation. Also check if there are any multidimensional coordinate + * variables defined, which require the same treatment to fix a + * potential bug when such variables occur in subgroups. + * + * @param grp Pointer to group info struct. + * @param bad_coord_orderp Pointer that gets 1 if there is a bad + * coordinate order. + * + * @returns NC_NOERR No error. + * @returns NC_EHDFERR HDF5 returned an error. + * @author Ed Hartnett + */ +static int +detect_preserve_dimids(NC_GRP_INFO_T *grp, nc_bool_t *bad_coord_orderp) +{ + NC_VAR_INFO_T *var; + NC_GRP_INFO_T *child_grp; + int last_dimid = -1; + int retval; + int i; + + /* Iterate over variables in this group */ + for (i=0; i < ncindexsize(grp->vars); i++) + { + var = (NC_VAR_INFO_T*)ncindexith(grp->vars,i); + if (var == NULL) continue; + /* Only matters for dimension scale variables, with non-scalar dimensionality */ + if (var->dimscale && var->ndims) + { + /* If the user writes coord vars in a different order then he + * defined their dimensions, then, when the file is reopened, the + * order of the dimids will change to match the order of the coord + * vars. Detect if this is about to happen. */ + if (var->dimids[0] < last_dimid) + { + LOG((5, "%s: %s is out of order coord var", __func__, var->hdr.name)); + *bad_coord_orderp = NC_TRUE; + return NC_NOERR; + } + last_dimid = var->dimids[0]; + + /* If there are multidimensional coordinate variables defined, then + * it's also necessary to preserve dimension IDs when the file is + * reopened ... */ + if (var->ndims > 1) + { + LOG((5, "%s: %s is multidimensional coord var", __func__, var->hdr.name)); + *bad_coord_orderp = NC_TRUE; + return NC_NOERR; + } + + /* Did the user define a dimension, end define mode, reenter define + * mode, and then define a coordinate variable for that dimension? + * If so, dimensions will be out of order. */ + if (var->is_new_var || var->became_coord_var) + { + LOG((5, "%s: coord var defined after enddef/redef", __func__)); + *bad_coord_orderp = NC_TRUE; + return NC_NOERR; + } + } + } + + /* If there are any child groups, check them also for this condition. */ + for (i = 0; i < ncindexsize(grp->children); i++) + { + if (!(child_grp = (NC_GRP_INFO_T *)ncindexith(grp->children, i))) + continue; + if ((retval = detect_preserve_dimids(child_grp, bad_coord_orderp))) + return retval; + } + return NC_NOERR; +} + /** * @internal This function will write all changed metadata and flush * HDF5 file to disk. @@ -127,7 +205,7 @@ sync_netcdf4_file(NC_FILE_INFO_T *h5) /* Check to see if the coordinate order is messed up. If * detected, propagate to all groups to consistently store * dimids. */ - if ((retval = nc4_detect_preserve_dimids(h5->root_grp, &bad_coord_order))) + if ((retval = detect_preserve_dimids(h5->root_grp, &bad_coord_order))) return retval; /* Write all the metadata. */ diff --git a/libhdf5/nc4hdf.c b/libhdf5/nc4hdf.c index b61b6f8d2a..bdf715a138 100644 --- a/libhdf5/nc4hdf.c +++ b/libhdf5/nc4hdf.c @@ -1886,84 +1886,6 @@ write_dim(NC_DIM_INFO_T *dim, NC_GRP_INFO_T *grp, nc_bool_t write_dimid) return retval; } -/** - * @internal Recursively determine if there is a mismatch between - * order of coordinate creation and associated dimensions in this - * group or any subgroups, to find out if we have to handle that - * situation. Also check if there are any multidimensional coordinate - * variables defined, which require the same treatment to fix a - * potential bug when such variables occur in subgroups. - * - * @param grp Pointer to group info struct. - * @param bad_coord_orderp Pointer that gets 1 if there is a bad - * coordinate order. - * - * @returns NC_NOERR No error. - * @returns NC_EHDFERR HDF5 returned an error. - * @author Ed Hartnett - */ -int -nc4_detect_preserve_dimids(NC_GRP_INFO_T *grp, nc_bool_t *bad_coord_orderp) -{ - NC_VAR_INFO_T *var; - NC_GRP_INFO_T *child_grp; - int last_dimid = -1; - int retval; - int i; - - /* Iterate over variables in this group */ - for (i=0; i < ncindexsize(grp->vars); i++) - { - var = (NC_VAR_INFO_T*)ncindexith(grp->vars,i); - if (var == NULL) continue; - /* Only matters for dimension scale variables, with non-scalar dimensionality */ - if (var->dimscale && var->ndims) - { - /* If the user writes coord vars in a different order then he - * defined their dimensions, then, when the file is reopened, the - * order of the dimids will change to match the order of the coord - * vars. Detect if this is about to happen. */ - if (var->dimids[0] < last_dimid) - { - LOG((5, "%s: %s is out of order coord var", __func__, var->hdr.name)); - *bad_coord_orderp = NC_TRUE; - return NC_NOERR; - } - last_dimid = var->dimids[0]; - - /* If there are multidimensional coordinate variables defined, then - * it's also necessary to preserve dimension IDs when the file is - * reopened ... */ - if (var->ndims > 1) - { - LOG((5, "%s: %s is multidimensional coord var", __func__, var->hdr.name)); - *bad_coord_orderp = NC_TRUE; - return NC_NOERR; - } - - /* Did the user define a dimension, end define mode, reenter define - * mode, and then define a coordinate variable for that dimension? - * If so, dimensions will be out of order. */ - if (var->is_new_var || var->became_coord_var) - { - LOG((5, "%s: coord var defined after enddef/redef", __func__)); - *bad_coord_orderp = NC_TRUE; - return NC_NOERR; - } - } - } - - /* If there are any child groups, check them also for this condition. */ - for (i = 0; i < ncindexsize(grp->children); i++) - { - if (!(child_grp = (NC_GRP_INFO_T *)ncindexith(grp->children, i))) - continue; - if ((retval = nc4_detect_preserve_dimids(child_grp, bad_coord_orderp))) - return retval; - } - return NC_NOERR; -} - /** * @internal Recursively write all the metadata in a group. Groups and * types have all already been written. Propagate bad cooordinate From ef5a39e19afb0d2eaafcb2e9a35fc72927c2de7f Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Tue, 11 Dec 2018 06:22:48 -0700 Subject: [PATCH 04/24] cleaned up hdf5internal.c --- libhdf5/hdf5internal.c | 166 ++++++++++++++++++++++++++++++----------- 1 file changed, 121 insertions(+), 45 deletions(-) diff --git a/libhdf5/hdf5internal.c b/libhdf5/hdf5internal.c index 5752e9ea92..7a14e86d18 100644 --- a/libhdf5/hdf5internal.c +++ b/libhdf5/hdf5internal.c @@ -106,7 +106,8 @@ nc4_hdf5_finalize(void) * @author Ed Hartnett */ static int -find_var_dim_max_length(NC_GRP_INFO_T *grp, int varid, int dimid, size_t *maxlen) +find_var_dim_max_length(NC_GRP_INFO_T *grp, int varid, int dimid, + size_t *maxlen) { hid_t datasetid = 0, spaceid = 0; NC_VAR_INFO_T *var; @@ -230,30 +231,27 @@ nc4_rec_find_hdf_type(NC_FILE_INFO_T *h5, hid_t target_hdf_typeid) int nc4_find_dim_len(NC_GRP_INFO_T *grp, int dimid, size_t **len) { - NC_GRP_INFO_T *g; NC_VAR_INFO_T *var; int retval; int i; assert(grp && len); - LOG((3, "nc4_find_dim_len: grp->name %s dimid %d", grp->hdr.name, dimid)); + LOG((3, "%s: grp->name %s dimid %d", __func__, grp->hdr.name, dimid)); /* If there are any groups, call this function recursively on * them. */ - for(i=0;ichildren);i++) { - g = (NC_GRP_INFO_T*)ncindexith(grp->children,i); - if(g == NULL) continue; - if ((retval = nc4_find_dim_len(g, dimid, len))) + for (i = 0; i < ncindexsize(grp->children); i++) + if ((retval = nc4_find_dim_len((NC_GRP_INFO_T*)ncindexith(grp->children, i), + dimid, len))) return retval; - } /* For all variables in this group, find the ones that use this * dimension, and remember the max length. */ - for (i=0; i < ncindexsize(grp->vars); i++) + for (i = 0; i < ncindexsize(grp->vars); i++) { size_t mylen; - var = (NC_VAR_INFO_T*)ncindexith(grp->vars,i); - if (var == NULL) continue; + var = (NC_VAR_INFO_T *)ncindexith(grp->vars, i); + assert(var); /* Find max length of dim in this variable... */ if ((retval = find_var_dim_max_length(grp, var->hdr.id, dimid, &mylen))) @@ -283,7 +281,8 @@ nc4_find_dim_len(NC_GRP_INFO_T *grp, int dimid, size_t **len) * @author Quincey Koziol, Ed Hartnett */ int -nc4_break_coord_var(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *coord_var, NC_DIM_INFO_T *dim) +nc4_break_coord_var(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *coord_var, + NC_DIM_INFO_T *dim) { int retval; @@ -314,10 +313,6 @@ nc4_break_coord_var(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *coord_var, NC_DIM_INFO_T return NC_ENOMEM; } - /* Remove the atts that go with being a coordinate var. */ - /* if ((retval = remove_coord_atts(coord_var->hdf_datasetid))) */ - /* return retval; */ - /* Detach dimension from variable */ coord_var->dimscale = NC_FALSE; dim->coord_var = NULL; @@ -351,7 +346,8 @@ nc4_break_coord_var(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *coord_var, NC_DIM_INFO_T * @author Ed Hartnett */ int -delete_existing_dimscale_dataset(NC_GRP_INFO_T *grp, int dimid, NC_DIM_INFO_T *dim) +delete_existing_dimscale_dataset(NC_GRP_INFO_T *grp, int dimid, + NC_DIM_INFO_T *dim) { NC_HDF5_DIM_INFO_T *hdf5_dim; NC_HDF5_GRP_INFO_T *hdf5_grp; @@ -512,39 +508,20 @@ nc4_reform_coord_var(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var, NC_DIM_INFO_T *dim) } /** - * @internal Recursively free HDF5 objects for a group (and everything - * it contains). + * @internal Close HDF5 resources for global atts in a group. * * @param grp Pointer to group info struct. * * @return ::NC_NOERR No error. + * @return ::NC_EHDFERR HDF5 error. * @author Ed Hartnett */ -int -nc4_rec_grp_HDF5_del(NC_GRP_INFO_T *grp) +static int +close_gatts(NC_GRP_INFO_T *grp) { - NC_VAR_INFO_T *var; - NC_HDF5_VAR_INFO_T *hdf5_var; - NC_DIM_INFO_T *dim; NC_ATT_INFO_T *att; - NC_HDF5_GRP_INFO_T *hdf5_grp; int a; - int i; - int retval; - - assert(grp && grp->format_grp_info); - LOG((3, "%s: grp->name %s", __func__, grp->hdr.name)); - hdf5_grp = (NC_HDF5_GRP_INFO_T *)grp->format_grp_info; - - /* Recursively call this function for each child, if any, stopping - * if there is an error. */ - for (i = 0; i < ncindexsize(grp->children); i++) - if ((retval = nc4_rec_grp_HDF5_del((NC_GRP_INFO_T *)ncindexith(grp->children, - i)))) - return retval; - - /* Close HDF5 resources associated with global attributes. */ for (a = 0; a < ncindexsize(grp->att); a++) { NC_HDF5_ATT_INFO_T *hdf5_att; @@ -558,8 +535,26 @@ nc4_rec_grp_HDF5_del(NC_GRP_INFO_T *grp) H5Tclose(hdf5_att->native_hdf_typeid) < 0) return NC_EHDFERR; } + return NC_NOERR; +} + +/** + * @internal Close HDF5 resources for vars in a group. + * + * @param grp Pointer to group info struct. + * + * @return ::NC_NOERR No error. + * @return ::NC_EHDFERR HDF5 error. + * @author Ed Hartnett + */ +static int +close_vars(NC_GRP_INFO_T *grp) +{ + NC_VAR_INFO_T *var; + NC_HDF5_VAR_INFO_T *hdf5_var; + NC_ATT_INFO_T *att; + int a, i; - /* Close HDF5 resources associated with vars. */ for (i = 0; i < ncindexsize(grp->vars); i++) { var = (NC_VAR_INFO_T *)ncindexith(grp->vars, i); @@ -603,7 +598,24 @@ nc4_rec_grp_HDF5_del(NC_GRP_INFO_T *grp) } } - /* Close HDF5 resources associated with dims. */ + return NC_NOERR; +} + +/** + * @internal Close HDF5 resources for dims in a group. + * + * @param grp Pointer to group info struct. + * + * @return ::NC_NOERR No error. + * @return ::NC_EHDFERR HDF5 error. + * @author Ed Hartnett + */ +static int +close_dims(NC_GRP_INFO_T *grp) +{ + NC_DIM_INFO_T *dim; + int i; + for (i = 0; i < ncindexsize(grp->dim); i++) { NC_HDF5_DIM_INFO_T *hdf5_dim; @@ -619,9 +631,25 @@ nc4_rec_grp_HDF5_del(NC_GRP_INFO_T *grp) return NC_EHDFERR; } - /* Close HDF5 resources associated with types. Set values to 0 - * after closing types. Because of type reference counters, these - * closes can be called multiple times. */ + return NC_NOERR; +} + +/** + * @internal Close HDF5 resources for types in a group. Set values to + * 0 after closing types. Because of type reference counters, these + * closes can be called multiple times. + * + * @param grp Pointer to group info struct. + * + * @return ::NC_NOERR No error. + * @return ::NC_EHDFERR HDF5 error. + * @author Ed Hartnett, Dennis Heimbigner + */ +static int +close_types(NC_GRP_INFO_T *grp) +{ + int i; + for (i = 0; i < ncindexsize(grp->type); i++) { NC_TYPE_INFO_T *type; @@ -643,6 +671,54 @@ nc4_rec_grp_HDF5_del(NC_GRP_INFO_T *grp) hdf5_type->native_hdf_typeid = 0; } + return NC_NOERR; +} + +/** + * @internal Recursively free HDF5 objects for a group (and everything + * it contains). + * + * @param grp Pointer to group info struct. + * + * @return ::NC_NOERR No error. + * @return ::NC_EHDFERR HDF5 error. + * @author Ed Hartnett + */ +int +nc4_rec_grp_HDF5_del(NC_GRP_INFO_T *grp) +{ + NC_HDF5_GRP_INFO_T *hdf5_grp; + int i; + int retval; + + assert(grp && grp->format_grp_info); + LOG((3, "%s: grp->name %s", __func__, grp->hdr.name)); + + hdf5_grp = (NC_HDF5_GRP_INFO_T *)grp->format_grp_info; + + /* Recursively call this function for each child, if any, stopping + * if there is an error. */ + for (i = 0; i < ncindexsize(grp->children); i++) + if ((retval = nc4_rec_grp_HDF5_del((NC_GRP_INFO_T *)ncindexith(grp->children, + i)))) + return retval; + + /* Close HDF5 resources associated with global attributes. */ + if ((retval = close_gatts(grp))) + return retval; + + /* Close HDF5 resources associated with vars. */ + if ((retval = close_vars(grp))) + return retval; + + /* Close HDF5 resources associated with dims. */ + if ((retval = close_dims(grp))) + return retval; + + /* Close HDF5 resources associated with types. */ + if ((retval = close_types(grp))) + return retval; + /* Close the HDF5 group. */ LOG((4, "%s: closing group %s", __func__, grp->hdr.name)); if (hdf5_grp->hdf_grpid && H5Gclose(hdf5_grp->hdf_grpid) < 0) From 7d168f712f60276cc8766dcb040a36ec81288cda Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Tue, 11 Dec 2018 06:25:33 -0700 Subject: [PATCH 05/24] cleaned up nc4internal.c --- libsrc4/nc4internal.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libsrc4/nc4internal.c b/libsrc4/nc4internal.c index bb510da6b9..ddc3757dec 100644 --- a/libsrc4/nc4internal.c +++ b/libsrc4/nc4internal.c @@ -258,7 +258,7 @@ nc4_find_grp_h5_var(int ncid, int varid, NC_FILE_INFO_T **h5, NC_GRP_INFO_T **gr } /** - * @internal Find a dim in a grp (or its parents). + * @internal Find a dim in the file. * * @param grp Pointer to group info struct. * @param dimid Dimension ID to find. @@ -268,7 +268,7 @@ nc4_find_grp_h5_var(int ncid, int varid, NC_FILE_INFO_T **h5, NC_GRP_INFO_T **gr * * @return ::NC_NOERR No error. * @return ::NC_EBADDIM Dimension not found. - * @author Ed Hartnett + * @author Ed Hartnett, Dennis Heimbigner */ int nc4_find_dim(NC_GRP_INFO_T *grp, int dimid, NC_DIM_INFO_T **dim, @@ -565,7 +565,7 @@ nc4_var_set_ndims(NC_VAR_INFO_T *var, int ndims) return NC_ENOMEM; /* Initialize dimids to illegal values (-1). See the comment - in nc4hdf.c#nc4_rec_match_dimscales. */ + in nc4_rec_match_dimscales(). */ memset(var->dimids, -1, ndims * sizeof(int)); } From 89b2c48d4cfed72c52a64065716ca8f38d2f2696 Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Tue, 11 Dec 2018 06:32:25 -0700 Subject: [PATCH 06/24] added benchmark program tst_wrf_reads.c --- nc_test4/Makefile.am | 9 +- nc_test4/tst_wrf_reads.c | 9759 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 9764 insertions(+), 4 deletions(-) create mode 100644 nc_test4/tst_wrf_reads.c diff --git a/nc_test4/Makefile.am b/nc_test4/Makefile.am index 2b26fdff82..9adeac80bf 100644 --- a/nc_test4/Makefile.am +++ b/nc_test4/Makefile.am @@ -72,9 +72,9 @@ endif # BUILD_V2 # If benchmarks were turned on, build and run a bunch more tests. if BUILD_BENCHMARKS -check_PROGRAMS += tst_create_files bm_file tst_chunks3 tst_ar4 \ -tst_ar4_3d tst_ar4_4d bm_many_objs tst_h_many_atts bm_many_atts \ -tst_files2 tst_files3 tst_mem tst_knmi bm_netcdf4_recs +check_PROGRAMS += tst_create_files bm_file tst_chunks3 tst_ar4 \ +tst_ar4_3d tst_ar4_4d bm_many_objs tst_h_many_atts bm_many_atts \ +tst_files2 tst_files3 tst_mem tst_knmi bm_netcdf4_recs tst_wrf_reads bm_netcdf4_recs_SOURCES = bm_netcdf4_recs.c tst_utils.c bm_many_atts_SOURCES = bm_many_atts.c tst_utils.c @@ -86,10 +86,11 @@ tst_ar4_SOURCES = tst_ar4.c tst_utils.c tst_h_many_atts_SOURCES = tst_h_many_atts.c tst_utils.c bm_file_SOURCES = bm_file.c tst_utils.c tst_knmi_SOURCES = tst_knmi.c tst_utils.c +tst_wrf_reads_SOURCES = tst_wrf_reads.c tst_utils.c TESTS += tst_ar4_3d tst_create_files run_bm_test1.sh run_bm_elena.sh \ run_bm_test2.sh run_tst_chunks.sh tst_files2 tst_files3 tst_mem \ -run_knmi_bm.sh +run_knmi_bm.sh tst_wrf_reads # tst_create_files creates files for other tests. run_bm_test1.log: tst_create_files.log diff --git a/nc_test4/tst_wrf_reads.c b/nc_test4/tst_wrf_reads.c new file mode 100644 index 0000000000..4c8cab9852 --- /dev/null +++ b/nc_test4/tst_wrf_reads.c @@ -0,0 +1,9759 @@ +/* This is part of the netCDF package. Copyright 2005-2018 University + Corporation for Atmospheric Research/Unidata See COPYRIGHT file for + conditions of use. + + This is a benchmarking program that depends on some KNMI files from + the Unidata ftp site. The files are opened and read, and + performance is timed. + + Ed Hartnett +*/ + +#include +#include "err_macros.h" +#include +#include +#include + +#define FILE_NAME "tst_wrf_reads.nc" + +/* Prototype from tst_utils.c. */ +int nc4_timeval_subtract(struct timeval *result, struct timeval *x, + struct timeval *y); + +extern const char* nc_strerror(int ncerr); + +void +check_err(const int stat, const int line, const char *file) { + if (stat != NC_NOERR) { + (void)fprintf(stderr,"line %d of %s: %s\n", line, file, nc_strerror(stat)); + fflush(stderr); + exit(1); + } +} + +int +create_wrfbdy_file(char *file_name, int cmode) {/* create wrfbdy.nc */ + + int stat; /* return status */ + int ncid; /* netCDF id */ + + /* dimension ids */ + int Time_dim; + int DateStrLen_dim; + int south_north_dim; + int bottom_top_dim; + int bdy_width_dim; + int west_east_stag_dim; + int south_north_stag_dim; + int west_east_dim; + int bottom_top_stag_dim; + + /* dimension lengths */ + size_t Time_len = NC_UNLIMITED; + size_t DateStrLen_len = 19; + size_t south_north_len = 60; + size_t bottom_top_len = 32; + size_t bdy_width_len = 5; + size_t west_east_stag_len = 74; + size_t south_north_stag_len = 61; + size_t west_east_len = 73; + size_t bottom_top_stag_len = 33; + + /* variable ids */ + int Times_id; + int md___thisbdytimee_x_t_d_o_m_a_i_n_m_e_t_a_data__id; + int md___nextbdytimee_x_t_d_o_m_a_i_n_m_e_t_a_data__id; + int U_BXS_id; + int U_BXE_id; + int U_BYS_id; + int U_BYE_id; + int U_BTXS_id; + int U_BTXE_id; + int U_BTYS_id; + int U_BTYE_id; + int V_BXS_id; + int V_BXE_id; + int V_BYS_id; + int V_BYE_id; + int V_BTXS_id; + int V_BTXE_id; + int V_BTYS_id; + int V_BTYE_id; + int W_BXS_id; + int W_BXE_id; + int W_BYS_id; + int W_BYE_id; + int W_BTXS_id; + int W_BTXE_id; + int W_BTYS_id; + int W_BTYE_id; + int PH_BXS_id; + int PH_BXE_id; + int PH_BYS_id; + int PH_BYE_id; + int PH_BTXS_id; + int PH_BTXE_id; + int PH_BTYS_id; + int PH_BTYE_id; + int T_BXS_id; + int T_BXE_id; + int T_BYS_id; + int T_BYE_id; + int T_BTXS_id; + int T_BTXE_id; + int T_BTYS_id; + int T_BTYE_id; + int MU_BXS_id; + int MU_BXE_id; + int MU_BYS_id; + int MU_BYE_id; + int MU_BTXS_id; + int MU_BTXE_id; + int MU_BTYS_id; + int MU_BTYE_id; + int QVAPOR_BXS_id; + int QVAPOR_BXE_id; + int QVAPOR_BYS_id; + int QVAPOR_BYE_id; + int QCLOUD_BXS_id; + int QCLOUD_BXE_id; + int QCLOUD_BYS_id; + int QCLOUD_BYE_id; + int QRAIN_BXS_id; + int QRAIN_BXE_id; + int QRAIN_BYS_id; + int QRAIN_BYE_id; + int QICE_BXS_id; + int QICE_BXE_id; + int QICE_BYS_id; + int QICE_BYE_id; + int QSNOW_BXS_id; + int QSNOW_BXE_id; + int QSNOW_BYS_id; + int QSNOW_BYE_id; + int QGRAUP_BXS_id; + int QGRAUP_BXE_id; + int QGRAUP_BYS_id; + int QGRAUP_BYE_id; + int QVAPOR_BTXS_id; + int QVAPOR_BTXE_id; + int QVAPOR_BTYS_id; + int QVAPOR_BTYE_id; + int QCLOUD_BTXS_id; + int QCLOUD_BTXE_id; + int QCLOUD_BTYS_id; + int QCLOUD_BTYE_id; + int QRAIN_BTXS_id; + int QRAIN_BTXE_id; + int QRAIN_BTYS_id; + int QRAIN_BTYE_id; + int QICE_BTXS_id; + int QICE_BTXE_id; + int QICE_BTYS_id; + int QICE_BTYE_id; + int QSNOW_BTXS_id; + int QSNOW_BTXE_id; + int QSNOW_BTYS_id; + int QSNOW_BTYE_id; + int QGRAUP_BTXS_id; + int QGRAUP_BTXE_id; + int QGRAUP_BTYS_id; + int QGRAUP_BTYE_id; + int QNICE_BXS_id; + int QNICE_BXE_id; + int QNICE_BYS_id; + int QNICE_BYE_id; + int QNRAIN_BXS_id; + int QNRAIN_BXE_id; + int QNRAIN_BYS_id; + int QNRAIN_BYE_id; + int QNICE_BTXS_id; + int QNICE_BTXE_id; + int QNICE_BTYS_id; + int QNICE_BTYE_id; + int QNRAIN_BTXS_id; + int QNRAIN_BTXE_id; + int QNRAIN_BTYS_id; + int QNRAIN_BTYE_id; + int HT_SHAD_BXS_id; + int HT_SHAD_BXE_id; + int HT_SHAD_BYS_id; + int HT_SHAD_BYE_id; + int HT_SHAD_BTXS_id; + int HT_SHAD_BTXE_id; + int HT_SHAD_BTYS_id; + int HT_SHAD_BTYE_id; + int PC_BXS_id; + int PC_BXE_id; + int PC_BYS_id; + int PC_BYE_id; + int PC_BTXS_id; + int PC_BTXE_id; + int PC_BTYS_id; + int PC_BTYE_id; + + /* rank (number of dimensions) for each variable */ +# define RANK_Times 2 +# define RANK_md___thisbdytimee_x_t_d_o_m_a_i_n_m_e_t_a_data_ 2 +# define RANK_md___nextbdytimee_x_t_d_o_m_a_i_n_m_e_t_a_data_ 2 +# define RANK_U_BXS 4 +# define RANK_U_BXE 4 +# define RANK_U_BYS 4 +# define RANK_U_BYE 4 +# define RANK_U_BTXS 4 +# define RANK_U_BTXE 4 +# define RANK_U_BTYS 4 +# define RANK_U_BTYE 4 +# define RANK_V_BXS 4 +# define RANK_V_BXE 4 +# define RANK_V_BYS 4 +# define RANK_V_BYE 4 +# define RANK_V_BTXS 4 +# define RANK_V_BTXE 4 +# define RANK_V_BTYS 4 +# define RANK_V_BTYE 4 +# define RANK_W_BXS 4 +# define RANK_W_BXE 4 +# define RANK_W_BYS 4 +# define RANK_W_BYE 4 +# define RANK_W_BTXS 4 +# define RANK_W_BTXE 4 +# define RANK_W_BTYS 4 +# define RANK_W_BTYE 4 +# define RANK_PH_BXS 4 +# define RANK_PH_BXE 4 +# define RANK_PH_BYS 4 +# define RANK_PH_BYE 4 +# define RANK_PH_BTXS 4 +# define RANK_PH_BTXE 4 +# define RANK_PH_BTYS 4 +# define RANK_PH_BTYE 4 +# define RANK_T_BXS 4 +# define RANK_T_BXE 4 +# define RANK_T_BYS 4 +# define RANK_T_BYE 4 +# define RANK_T_BTXS 4 +# define RANK_T_BTXE 4 +# define RANK_T_BTYS 4 +# define RANK_T_BTYE 4 +# define RANK_MU_BXS 3 +# define RANK_MU_BXE 3 +# define RANK_MU_BYS 3 +# define RANK_MU_BYE 3 +# define RANK_MU_BTXS 3 +# define RANK_MU_BTXE 3 +# define RANK_MU_BTYS 3 +# define RANK_MU_BTYE 3 +# define RANK_QVAPOR_BXS 4 +# define RANK_QVAPOR_BXE 4 +# define RANK_QVAPOR_BYS 4 +# define RANK_QVAPOR_BYE 4 +# define RANK_QCLOUD_BXS 4 +# define RANK_QCLOUD_BXE 4 +# define RANK_QCLOUD_BYS 4 +# define RANK_QCLOUD_BYE 4 +# define RANK_QRAIN_BXS 4 +# define RANK_QRAIN_BXE 4 +# define RANK_QRAIN_BYS 4 +# define RANK_QRAIN_BYE 4 +# define RANK_QICE_BXS 4 +# define RANK_QICE_BXE 4 +# define RANK_QICE_BYS 4 +# define RANK_QICE_BYE 4 +# define RANK_QSNOW_BXS 4 +# define RANK_QSNOW_BXE 4 +# define RANK_QSNOW_BYS 4 +# define RANK_QSNOW_BYE 4 +# define RANK_QGRAUP_BXS 4 +# define RANK_QGRAUP_BXE 4 +# define RANK_QGRAUP_BYS 4 +# define RANK_QGRAUP_BYE 4 +# define RANK_QVAPOR_BTXS 4 +# define RANK_QVAPOR_BTXE 4 +# define RANK_QVAPOR_BTYS 4 +# define RANK_QVAPOR_BTYE 4 +# define RANK_QCLOUD_BTXS 4 +# define RANK_QCLOUD_BTXE 4 +# define RANK_QCLOUD_BTYS 4 +# define RANK_QCLOUD_BTYE 4 +# define RANK_QRAIN_BTXS 4 +# define RANK_QRAIN_BTXE 4 +# define RANK_QRAIN_BTYS 4 +# define RANK_QRAIN_BTYE 4 +# define RANK_QICE_BTXS 4 +# define RANK_QICE_BTXE 4 +# define RANK_QICE_BTYS 4 +# define RANK_QICE_BTYE 4 +# define RANK_QSNOW_BTXS 4 +# define RANK_QSNOW_BTXE 4 +# define RANK_QSNOW_BTYS 4 +# define RANK_QSNOW_BTYE 4 +# define RANK_QGRAUP_BTXS 4 +# define RANK_QGRAUP_BTXE 4 +# define RANK_QGRAUP_BTYS 4 +# define RANK_QGRAUP_BTYE 4 +# define RANK_QNICE_BXS 4 +# define RANK_QNICE_BXE 4 +# define RANK_QNICE_BYS 4 +# define RANK_QNICE_BYE 4 +# define RANK_QNRAIN_BXS 4 +# define RANK_QNRAIN_BXE 4 +# define RANK_QNRAIN_BYS 4 +# define RANK_QNRAIN_BYE 4 +# define RANK_QNICE_BTXS 4 +# define RANK_QNICE_BTXE 4 +# define RANK_QNICE_BTYS 4 +# define RANK_QNICE_BTYE 4 +# define RANK_QNRAIN_BTXS 4 +# define RANK_QNRAIN_BTXE 4 +# define RANK_QNRAIN_BTYS 4 +# define RANK_QNRAIN_BTYE 4 +# define RANK_HT_SHAD_BXS 3 +# define RANK_HT_SHAD_BXE 3 +# define RANK_HT_SHAD_BYS 3 +# define RANK_HT_SHAD_BYE 3 +# define RANK_HT_SHAD_BTXS 3 +# define RANK_HT_SHAD_BTXE 3 +# define RANK_HT_SHAD_BTYS 3 +# define RANK_HT_SHAD_BTYE 3 +# define RANK_PC_BXS 3 +# define RANK_PC_BXE 3 +# define RANK_PC_BYS 3 +# define RANK_PC_BYE 3 +# define RANK_PC_BTXS 3 +# define RANK_PC_BTXE 3 +# define RANK_PC_BTYS 3 +# define RANK_PC_BTYE 3 + + /* variable shapes */ + int Times_dims[RANK_Times]; + int md___thisbdytimee_x_t_d_o_m_a_i_n_m_e_t_a_data__dims[RANK_md___thisbdytimee_x_t_d_o_m_a_i_n_m_e_t_a_data_]; + int md___nextbdytimee_x_t_d_o_m_a_i_n_m_e_t_a_data__dims[RANK_md___nextbdytimee_x_t_d_o_m_a_i_n_m_e_t_a_data_]; + int U_BXS_dims[RANK_U_BXS]; + int U_BXE_dims[RANK_U_BXE]; + int U_BYS_dims[RANK_U_BYS]; + int U_BYE_dims[RANK_U_BYE]; + int U_BTXS_dims[RANK_U_BTXS]; + int U_BTXE_dims[RANK_U_BTXE]; + int U_BTYS_dims[RANK_U_BTYS]; + int U_BTYE_dims[RANK_U_BTYE]; + int V_BXS_dims[RANK_V_BXS]; + int V_BXE_dims[RANK_V_BXE]; + int V_BYS_dims[RANK_V_BYS]; + int V_BYE_dims[RANK_V_BYE]; + int V_BTXS_dims[RANK_V_BTXS]; + int V_BTXE_dims[RANK_V_BTXE]; + int V_BTYS_dims[RANK_V_BTYS]; + int V_BTYE_dims[RANK_V_BTYE]; + int W_BXS_dims[RANK_W_BXS]; + int W_BXE_dims[RANK_W_BXE]; + int W_BYS_dims[RANK_W_BYS]; + int W_BYE_dims[RANK_W_BYE]; + int W_BTXS_dims[RANK_W_BTXS]; + int W_BTXE_dims[RANK_W_BTXE]; + int W_BTYS_dims[RANK_W_BTYS]; + int W_BTYE_dims[RANK_W_BTYE]; + int PH_BXS_dims[RANK_PH_BXS]; + int PH_BXE_dims[RANK_PH_BXE]; + int PH_BYS_dims[RANK_PH_BYS]; + int PH_BYE_dims[RANK_PH_BYE]; + int PH_BTXS_dims[RANK_PH_BTXS]; + int PH_BTXE_dims[RANK_PH_BTXE]; + int PH_BTYS_dims[RANK_PH_BTYS]; + int PH_BTYE_dims[RANK_PH_BTYE]; + int T_BXS_dims[RANK_T_BXS]; + int T_BXE_dims[RANK_T_BXE]; + int T_BYS_dims[RANK_T_BYS]; + int T_BYE_dims[RANK_T_BYE]; + int T_BTXS_dims[RANK_T_BTXS]; + int T_BTXE_dims[RANK_T_BTXE]; + int T_BTYS_dims[RANK_T_BTYS]; + int T_BTYE_dims[RANK_T_BTYE]; + int MU_BXS_dims[RANK_MU_BXS]; + int MU_BXE_dims[RANK_MU_BXE]; + int MU_BYS_dims[RANK_MU_BYS]; + int MU_BYE_dims[RANK_MU_BYE]; + int MU_BTXS_dims[RANK_MU_BTXS]; + int MU_BTXE_dims[RANK_MU_BTXE]; + int MU_BTYS_dims[RANK_MU_BTYS]; + int MU_BTYE_dims[RANK_MU_BTYE]; + int QVAPOR_BXS_dims[RANK_QVAPOR_BXS]; + int QVAPOR_BXE_dims[RANK_QVAPOR_BXE]; + int QVAPOR_BYS_dims[RANK_QVAPOR_BYS]; + int QVAPOR_BYE_dims[RANK_QVAPOR_BYE]; + int QCLOUD_BXS_dims[RANK_QCLOUD_BXS]; + int QCLOUD_BXE_dims[RANK_QCLOUD_BXE]; + int QCLOUD_BYS_dims[RANK_QCLOUD_BYS]; + int QCLOUD_BYE_dims[RANK_QCLOUD_BYE]; + int QRAIN_BXS_dims[RANK_QRAIN_BXS]; + int QRAIN_BXE_dims[RANK_QRAIN_BXE]; + int QRAIN_BYS_dims[RANK_QRAIN_BYS]; + int QRAIN_BYE_dims[RANK_QRAIN_BYE]; + int QICE_BXS_dims[RANK_QICE_BXS]; + int QICE_BXE_dims[RANK_QICE_BXE]; + int QICE_BYS_dims[RANK_QICE_BYS]; + int QICE_BYE_dims[RANK_QICE_BYE]; + int QSNOW_BXS_dims[RANK_QSNOW_BXS]; + int QSNOW_BXE_dims[RANK_QSNOW_BXE]; + int QSNOW_BYS_dims[RANK_QSNOW_BYS]; + int QSNOW_BYE_dims[RANK_QSNOW_BYE]; + int QGRAUP_BXS_dims[RANK_QGRAUP_BXS]; + int QGRAUP_BXE_dims[RANK_QGRAUP_BXE]; + int QGRAUP_BYS_dims[RANK_QGRAUP_BYS]; + int QGRAUP_BYE_dims[RANK_QGRAUP_BYE]; + int QVAPOR_BTXS_dims[RANK_QVAPOR_BTXS]; + int QVAPOR_BTXE_dims[RANK_QVAPOR_BTXE]; + int QVAPOR_BTYS_dims[RANK_QVAPOR_BTYS]; + int QVAPOR_BTYE_dims[RANK_QVAPOR_BTYE]; + int QCLOUD_BTXS_dims[RANK_QCLOUD_BTXS]; + int QCLOUD_BTXE_dims[RANK_QCLOUD_BTXE]; + int QCLOUD_BTYS_dims[RANK_QCLOUD_BTYS]; + int QCLOUD_BTYE_dims[RANK_QCLOUD_BTYE]; + int QRAIN_BTXS_dims[RANK_QRAIN_BTXS]; + int QRAIN_BTXE_dims[RANK_QRAIN_BTXE]; + int QRAIN_BTYS_dims[RANK_QRAIN_BTYS]; + int QRAIN_BTYE_dims[RANK_QRAIN_BTYE]; + int QICE_BTXS_dims[RANK_QICE_BTXS]; + int QICE_BTXE_dims[RANK_QICE_BTXE]; + int QICE_BTYS_dims[RANK_QICE_BTYS]; + int QICE_BTYE_dims[RANK_QICE_BTYE]; + int QSNOW_BTXS_dims[RANK_QSNOW_BTXS]; + int QSNOW_BTXE_dims[RANK_QSNOW_BTXE]; + int QSNOW_BTYS_dims[RANK_QSNOW_BTYS]; + int QSNOW_BTYE_dims[RANK_QSNOW_BTYE]; + int QGRAUP_BTXS_dims[RANK_QGRAUP_BTXS]; + int QGRAUP_BTXE_dims[RANK_QGRAUP_BTXE]; + int QGRAUP_BTYS_dims[RANK_QGRAUP_BTYS]; + int QGRAUP_BTYE_dims[RANK_QGRAUP_BTYE]; + int QNICE_BXS_dims[RANK_QNICE_BXS]; + int QNICE_BXE_dims[RANK_QNICE_BXE]; + int QNICE_BYS_dims[RANK_QNICE_BYS]; + int QNICE_BYE_dims[RANK_QNICE_BYE]; + int QNRAIN_BXS_dims[RANK_QNRAIN_BXS]; + int QNRAIN_BXE_dims[RANK_QNRAIN_BXE]; + int QNRAIN_BYS_dims[RANK_QNRAIN_BYS]; + int QNRAIN_BYE_dims[RANK_QNRAIN_BYE]; + int QNICE_BTXS_dims[RANK_QNICE_BTXS]; + int QNICE_BTXE_dims[RANK_QNICE_BTXE]; + int QNICE_BTYS_dims[RANK_QNICE_BTYS]; + int QNICE_BTYE_dims[RANK_QNICE_BTYE]; + int QNRAIN_BTXS_dims[RANK_QNRAIN_BTXS]; + int QNRAIN_BTXE_dims[RANK_QNRAIN_BTXE]; + int QNRAIN_BTYS_dims[RANK_QNRAIN_BTYS]; + int QNRAIN_BTYE_dims[RANK_QNRAIN_BTYE]; + int HT_SHAD_BXS_dims[RANK_HT_SHAD_BXS]; + int HT_SHAD_BXE_dims[RANK_HT_SHAD_BXE]; + int HT_SHAD_BYS_dims[RANK_HT_SHAD_BYS]; + int HT_SHAD_BYE_dims[RANK_HT_SHAD_BYE]; + int HT_SHAD_BTXS_dims[RANK_HT_SHAD_BTXS]; + int HT_SHAD_BTXE_dims[RANK_HT_SHAD_BTXE]; + int HT_SHAD_BTYS_dims[RANK_HT_SHAD_BTYS]; + int HT_SHAD_BTYE_dims[RANK_HT_SHAD_BTYE]; + int PC_BXS_dims[RANK_PC_BXS]; + int PC_BXE_dims[RANK_PC_BXE]; + int PC_BYS_dims[RANK_PC_BYS]; + int PC_BYE_dims[RANK_PC_BYE]; + int PC_BTXS_dims[RANK_PC_BTXS]; + int PC_BTXE_dims[RANK_PC_BTXE]; + int PC_BTYS_dims[RANK_PC_BTYS]; + int PC_BTYE_dims[RANK_PC_BTYE]; + + /* enter define mode */ + stat = nc_create(file_name, cmode|NC_CLOBBER, &ncid); + check_err(stat,__LINE__,__FILE__); + + /* define dimensions */ + stat = nc_def_dim(ncid, "Time", Time_len, &Time_dim); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_dim(ncid, "DateStrLen", DateStrLen_len, &DateStrLen_dim); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_dim(ncid, "south_north", south_north_len, &south_north_dim); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_dim(ncid, "bottom_top", bottom_top_len, &bottom_top_dim); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_dim(ncid, "bdy_width", bdy_width_len, &bdy_width_dim); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_dim(ncid, "west_east_stag", west_east_stag_len, &west_east_stag_dim); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_dim(ncid, "south_north_stag", south_north_stag_len, &south_north_stag_dim); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_dim(ncid, "west_east", west_east_len, &west_east_dim); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_dim(ncid, "bottom_top_stag", bottom_top_stag_len, &bottom_top_stag_dim); + check_err(stat,__LINE__,__FILE__); + + /* define variables */ + + Times_dims[0] = Time_dim; + Times_dims[1] = DateStrLen_dim; + stat = nc_def_var(ncid, "Times", NC_CHAR, RANK_Times, Times_dims, &Times_id); + check_err(stat,__LINE__,__FILE__); + + md___thisbdytimee_x_t_d_o_m_a_i_n_m_e_t_a_data__dims[0] = Time_dim; + md___thisbdytimee_x_t_d_o_m_a_i_n_m_e_t_a_data__dims[1] = DateStrLen_dim; + stat = nc_def_var(ncid, "md___thisbdytimee_x_t_d_o_m_a_i_n_m_e_t_a_data_", NC_CHAR, RANK_md___thisbdytimee_x_t_d_o_m_a_i_n_m_e_t_a_data_, md___thisbdytimee_x_t_d_o_m_a_i_n_m_e_t_a_data__dims, &md___thisbdytimee_x_t_d_o_m_a_i_n_m_e_t_a_data__id); + check_err(stat,__LINE__,__FILE__); + + md___nextbdytimee_x_t_d_o_m_a_i_n_m_e_t_a_data__dims[0] = Time_dim; + md___nextbdytimee_x_t_d_o_m_a_i_n_m_e_t_a_data__dims[1] = DateStrLen_dim; + stat = nc_def_var(ncid, "md___nextbdytimee_x_t_d_o_m_a_i_n_m_e_t_a_data_", NC_CHAR, RANK_md___nextbdytimee_x_t_d_o_m_a_i_n_m_e_t_a_data_, md___nextbdytimee_x_t_d_o_m_a_i_n_m_e_t_a_data__dims, &md___nextbdytimee_x_t_d_o_m_a_i_n_m_e_t_a_data__id); + check_err(stat,__LINE__,__FILE__); + + U_BXS_dims[0] = Time_dim; + U_BXS_dims[1] = bdy_width_dim; + U_BXS_dims[2] = bottom_top_dim; + U_BXS_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "U_BXS", NC_FLOAT, RANK_U_BXS, U_BXS_dims, &U_BXS_id); + check_err(stat,__LINE__,__FILE__); + + U_BXE_dims[0] = Time_dim; + U_BXE_dims[1] = bdy_width_dim; + U_BXE_dims[2] = bottom_top_dim; + U_BXE_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "U_BXE", NC_FLOAT, RANK_U_BXE, U_BXE_dims, &U_BXE_id); + check_err(stat,__LINE__,__FILE__); + + U_BYS_dims[0] = Time_dim; + U_BYS_dims[1] = bdy_width_dim; + U_BYS_dims[2] = bottom_top_dim; + U_BYS_dims[3] = west_east_stag_dim; + stat = nc_def_var(ncid, "U_BYS", NC_FLOAT, RANK_U_BYS, U_BYS_dims, &U_BYS_id); + check_err(stat,__LINE__,__FILE__); + + U_BYE_dims[0] = Time_dim; + U_BYE_dims[1] = bdy_width_dim; + U_BYE_dims[2] = bottom_top_dim; + U_BYE_dims[3] = west_east_stag_dim; + stat = nc_def_var(ncid, "U_BYE", NC_FLOAT, RANK_U_BYE, U_BYE_dims, &U_BYE_id); + check_err(stat,__LINE__,__FILE__); + + U_BTXS_dims[0] = Time_dim; + U_BTXS_dims[1] = bdy_width_dim; + U_BTXS_dims[2] = bottom_top_dim; + U_BTXS_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "U_BTXS", NC_FLOAT, RANK_U_BTXS, U_BTXS_dims, &U_BTXS_id); + check_err(stat,__LINE__,__FILE__); + + U_BTXE_dims[0] = Time_dim; + U_BTXE_dims[1] = bdy_width_dim; + U_BTXE_dims[2] = bottom_top_dim; + U_BTXE_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "U_BTXE", NC_FLOAT, RANK_U_BTXE, U_BTXE_dims, &U_BTXE_id); + check_err(stat,__LINE__,__FILE__); + + U_BTYS_dims[0] = Time_dim; + U_BTYS_dims[1] = bdy_width_dim; + U_BTYS_dims[2] = bottom_top_dim; + U_BTYS_dims[3] = west_east_stag_dim; + stat = nc_def_var(ncid, "U_BTYS", NC_FLOAT, RANK_U_BTYS, U_BTYS_dims, &U_BTYS_id); + check_err(stat,__LINE__,__FILE__); + + U_BTYE_dims[0] = Time_dim; + U_BTYE_dims[1] = bdy_width_dim; + U_BTYE_dims[2] = bottom_top_dim; + U_BTYE_dims[3] = west_east_stag_dim; + stat = nc_def_var(ncid, "U_BTYE", NC_FLOAT, RANK_U_BTYE, U_BTYE_dims, &U_BTYE_id); + check_err(stat,__LINE__,__FILE__); + + V_BXS_dims[0] = Time_dim; + V_BXS_dims[1] = bdy_width_dim; + V_BXS_dims[2] = bottom_top_dim; + V_BXS_dims[3] = south_north_stag_dim; + stat = nc_def_var(ncid, "V_BXS", NC_FLOAT, RANK_V_BXS, V_BXS_dims, &V_BXS_id); + check_err(stat,__LINE__,__FILE__); + + V_BXE_dims[0] = Time_dim; + V_BXE_dims[1] = bdy_width_dim; + V_BXE_dims[2] = bottom_top_dim; + V_BXE_dims[3] = south_north_stag_dim; + stat = nc_def_var(ncid, "V_BXE", NC_FLOAT, RANK_V_BXE, V_BXE_dims, &V_BXE_id); + check_err(stat,__LINE__,__FILE__); + + V_BYS_dims[0] = Time_dim; + V_BYS_dims[1] = bdy_width_dim; + V_BYS_dims[2] = bottom_top_dim; + V_BYS_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "V_BYS", NC_FLOAT, RANK_V_BYS, V_BYS_dims, &V_BYS_id); + check_err(stat,__LINE__,__FILE__); + + V_BYE_dims[0] = Time_dim; + V_BYE_dims[1] = bdy_width_dim; + V_BYE_dims[2] = bottom_top_dim; + V_BYE_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "V_BYE", NC_FLOAT, RANK_V_BYE, V_BYE_dims, &V_BYE_id); + check_err(stat,__LINE__,__FILE__); + + V_BTXS_dims[0] = Time_dim; + V_BTXS_dims[1] = bdy_width_dim; + V_BTXS_dims[2] = bottom_top_dim; + V_BTXS_dims[3] = south_north_stag_dim; + stat = nc_def_var(ncid, "V_BTXS", NC_FLOAT, RANK_V_BTXS, V_BTXS_dims, &V_BTXS_id); + check_err(stat,__LINE__,__FILE__); + + V_BTXE_dims[0] = Time_dim; + V_BTXE_dims[1] = bdy_width_dim; + V_BTXE_dims[2] = bottom_top_dim; + V_BTXE_dims[3] = south_north_stag_dim; + stat = nc_def_var(ncid, "V_BTXE", NC_FLOAT, RANK_V_BTXE, V_BTXE_dims, &V_BTXE_id); + check_err(stat,__LINE__,__FILE__); + + V_BTYS_dims[0] = Time_dim; + V_BTYS_dims[1] = bdy_width_dim; + V_BTYS_dims[2] = bottom_top_dim; + V_BTYS_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "V_BTYS", NC_FLOAT, RANK_V_BTYS, V_BTYS_dims, &V_BTYS_id); + check_err(stat,__LINE__,__FILE__); + + V_BTYE_dims[0] = Time_dim; + V_BTYE_dims[1] = bdy_width_dim; + V_BTYE_dims[2] = bottom_top_dim; + V_BTYE_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "V_BTYE", NC_FLOAT, RANK_V_BTYE, V_BTYE_dims, &V_BTYE_id); + check_err(stat,__LINE__,__FILE__); + + W_BXS_dims[0] = Time_dim; + W_BXS_dims[1] = bdy_width_dim; + W_BXS_dims[2] = bottom_top_stag_dim; + W_BXS_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "W_BXS", NC_FLOAT, RANK_W_BXS, W_BXS_dims, &W_BXS_id); + check_err(stat,__LINE__,__FILE__); + + W_BXE_dims[0] = Time_dim; + W_BXE_dims[1] = bdy_width_dim; + W_BXE_dims[2] = bottom_top_stag_dim; + W_BXE_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "W_BXE", NC_FLOAT, RANK_W_BXE, W_BXE_dims, &W_BXE_id); + check_err(stat,__LINE__,__FILE__); + + W_BYS_dims[0] = Time_dim; + W_BYS_dims[1] = bdy_width_dim; + W_BYS_dims[2] = bottom_top_stag_dim; + W_BYS_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "W_BYS", NC_FLOAT, RANK_W_BYS, W_BYS_dims, &W_BYS_id); + check_err(stat,__LINE__,__FILE__); + + W_BYE_dims[0] = Time_dim; + W_BYE_dims[1] = bdy_width_dim; + W_BYE_dims[2] = bottom_top_stag_dim; + W_BYE_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "W_BYE", NC_FLOAT, RANK_W_BYE, W_BYE_dims, &W_BYE_id); + check_err(stat,__LINE__,__FILE__); + + W_BTXS_dims[0] = Time_dim; + W_BTXS_dims[1] = bdy_width_dim; + W_BTXS_dims[2] = bottom_top_stag_dim; + W_BTXS_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "W_BTXS", NC_FLOAT, RANK_W_BTXS, W_BTXS_dims, &W_BTXS_id); + check_err(stat,__LINE__,__FILE__); + + W_BTXE_dims[0] = Time_dim; + W_BTXE_dims[1] = bdy_width_dim; + W_BTXE_dims[2] = bottom_top_stag_dim; + W_BTXE_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "W_BTXE", NC_FLOAT, RANK_W_BTXE, W_BTXE_dims, &W_BTXE_id); + check_err(stat,__LINE__,__FILE__); + + W_BTYS_dims[0] = Time_dim; + W_BTYS_dims[1] = bdy_width_dim; + W_BTYS_dims[2] = bottom_top_stag_dim; + W_BTYS_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "W_BTYS", NC_FLOAT, RANK_W_BTYS, W_BTYS_dims, &W_BTYS_id); + check_err(stat,__LINE__,__FILE__); + + W_BTYE_dims[0] = Time_dim; + W_BTYE_dims[1] = bdy_width_dim; + W_BTYE_dims[2] = bottom_top_stag_dim; + W_BTYE_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "W_BTYE", NC_FLOAT, RANK_W_BTYE, W_BTYE_dims, &W_BTYE_id); + check_err(stat,__LINE__,__FILE__); + + PH_BXS_dims[0] = Time_dim; + PH_BXS_dims[1] = bdy_width_dim; + PH_BXS_dims[2] = bottom_top_stag_dim; + PH_BXS_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "PH_BXS", NC_FLOAT, RANK_PH_BXS, PH_BXS_dims, &PH_BXS_id); + check_err(stat,__LINE__,__FILE__); + + PH_BXE_dims[0] = Time_dim; + PH_BXE_dims[1] = bdy_width_dim; + PH_BXE_dims[2] = bottom_top_stag_dim; + PH_BXE_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "PH_BXE", NC_FLOAT, RANK_PH_BXE, PH_BXE_dims, &PH_BXE_id); + check_err(stat,__LINE__,__FILE__); + + PH_BYS_dims[0] = Time_dim; + PH_BYS_dims[1] = bdy_width_dim; + PH_BYS_dims[2] = bottom_top_stag_dim; + PH_BYS_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "PH_BYS", NC_FLOAT, RANK_PH_BYS, PH_BYS_dims, &PH_BYS_id); + check_err(stat,__LINE__,__FILE__); + + PH_BYE_dims[0] = Time_dim; + PH_BYE_dims[1] = bdy_width_dim; + PH_BYE_dims[2] = bottom_top_stag_dim; + PH_BYE_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "PH_BYE", NC_FLOAT, RANK_PH_BYE, PH_BYE_dims, &PH_BYE_id); + check_err(stat,__LINE__,__FILE__); + + PH_BTXS_dims[0] = Time_dim; + PH_BTXS_dims[1] = bdy_width_dim; + PH_BTXS_dims[2] = bottom_top_stag_dim; + PH_BTXS_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "PH_BTXS", NC_FLOAT, RANK_PH_BTXS, PH_BTXS_dims, &PH_BTXS_id); + check_err(stat,__LINE__,__FILE__); + + PH_BTXE_dims[0] = Time_dim; + PH_BTXE_dims[1] = bdy_width_dim; + PH_BTXE_dims[2] = bottom_top_stag_dim; + PH_BTXE_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "PH_BTXE", NC_FLOAT, RANK_PH_BTXE, PH_BTXE_dims, &PH_BTXE_id); + check_err(stat,__LINE__,__FILE__); + + PH_BTYS_dims[0] = Time_dim; + PH_BTYS_dims[1] = bdy_width_dim; + PH_BTYS_dims[2] = bottom_top_stag_dim; + PH_BTYS_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "PH_BTYS", NC_FLOAT, RANK_PH_BTYS, PH_BTYS_dims, &PH_BTYS_id); + check_err(stat,__LINE__,__FILE__); + + PH_BTYE_dims[0] = Time_dim; + PH_BTYE_dims[1] = bdy_width_dim; + PH_BTYE_dims[2] = bottom_top_stag_dim; + PH_BTYE_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "PH_BTYE", NC_FLOAT, RANK_PH_BTYE, PH_BTYE_dims, &PH_BTYE_id); + check_err(stat,__LINE__,__FILE__); + + T_BXS_dims[0] = Time_dim; + T_BXS_dims[1] = bdy_width_dim; + T_BXS_dims[2] = bottom_top_dim; + T_BXS_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "T_BXS", NC_FLOAT, RANK_T_BXS, T_BXS_dims, &T_BXS_id); + check_err(stat,__LINE__,__FILE__); + + T_BXE_dims[0] = Time_dim; + T_BXE_dims[1] = bdy_width_dim; + T_BXE_dims[2] = bottom_top_dim; + T_BXE_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "T_BXE", NC_FLOAT, RANK_T_BXE, T_BXE_dims, &T_BXE_id); + check_err(stat,__LINE__,__FILE__); + + T_BYS_dims[0] = Time_dim; + T_BYS_dims[1] = bdy_width_dim; + T_BYS_dims[2] = bottom_top_dim; + T_BYS_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "T_BYS", NC_FLOAT, RANK_T_BYS, T_BYS_dims, &T_BYS_id); + check_err(stat,__LINE__,__FILE__); + + T_BYE_dims[0] = Time_dim; + T_BYE_dims[1] = bdy_width_dim; + T_BYE_dims[2] = bottom_top_dim; + T_BYE_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "T_BYE", NC_FLOAT, RANK_T_BYE, T_BYE_dims, &T_BYE_id); + check_err(stat,__LINE__,__FILE__); + + T_BTXS_dims[0] = Time_dim; + T_BTXS_dims[1] = bdy_width_dim; + T_BTXS_dims[2] = bottom_top_dim; + T_BTXS_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "T_BTXS", NC_FLOAT, RANK_T_BTXS, T_BTXS_dims, &T_BTXS_id); + check_err(stat,__LINE__,__FILE__); + + T_BTXE_dims[0] = Time_dim; + T_BTXE_dims[1] = bdy_width_dim; + T_BTXE_dims[2] = bottom_top_dim; + T_BTXE_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "T_BTXE", NC_FLOAT, RANK_T_BTXE, T_BTXE_dims, &T_BTXE_id); + check_err(stat,__LINE__,__FILE__); + + T_BTYS_dims[0] = Time_dim; + T_BTYS_dims[1] = bdy_width_dim; + T_BTYS_dims[2] = bottom_top_dim; + T_BTYS_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "T_BTYS", NC_FLOAT, RANK_T_BTYS, T_BTYS_dims, &T_BTYS_id); + check_err(stat,__LINE__,__FILE__); + + T_BTYE_dims[0] = Time_dim; + T_BTYE_dims[1] = bdy_width_dim; + T_BTYE_dims[2] = bottom_top_dim; + T_BTYE_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "T_BTYE", NC_FLOAT, RANK_T_BTYE, T_BTYE_dims, &T_BTYE_id); + check_err(stat,__LINE__,__FILE__); + + MU_BXS_dims[0] = Time_dim; + MU_BXS_dims[1] = bdy_width_dim; + MU_BXS_dims[2] = south_north_dim; + stat = nc_def_var(ncid, "MU_BXS", NC_FLOAT, RANK_MU_BXS, MU_BXS_dims, &MU_BXS_id); + check_err(stat,__LINE__,__FILE__); + + MU_BXE_dims[0] = Time_dim; + MU_BXE_dims[1] = bdy_width_dim; + MU_BXE_dims[2] = south_north_dim; + stat = nc_def_var(ncid, "MU_BXE", NC_FLOAT, RANK_MU_BXE, MU_BXE_dims, &MU_BXE_id); + check_err(stat,__LINE__,__FILE__); + + MU_BYS_dims[0] = Time_dim; + MU_BYS_dims[1] = bdy_width_dim; + MU_BYS_dims[2] = west_east_dim; + stat = nc_def_var(ncid, "MU_BYS", NC_FLOAT, RANK_MU_BYS, MU_BYS_dims, &MU_BYS_id); + check_err(stat,__LINE__,__FILE__); + + MU_BYE_dims[0] = Time_dim; + MU_BYE_dims[1] = bdy_width_dim; + MU_BYE_dims[2] = west_east_dim; + stat = nc_def_var(ncid, "MU_BYE", NC_FLOAT, RANK_MU_BYE, MU_BYE_dims, &MU_BYE_id); + check_err(stat,__LINE__,__FILE__); + + MU_BTXS_dims[0] = Time_dim; + MU_BTXS_dims[1] = bdy_width_dim; + MU_BTXS_dims[2] = south_north_dim; + stat = nc_def_var(ncid, "MU_BTXS", NC_FLOAT, RANK_MU_BTXS, MU_BTXS_dims, &MU_BTXS_id); + check_err(stat,__LINE__,__FILE__); + + MU_BTXE_dims[0] = Time_dim; + MU_BTXE_dims[1] = bdy_width_dim; + MU_BTXE_dims[2] = south_north_dim; + stat = nc_def_var(ncid, "MU_BTXE", NC_FLOAT, RANK_MU_BTXE, MU_BTXE_dims, &MU_BTXE_id); + check_err(stat,__LINE__,__FILE__); + + MU_BTYS_dims[0] = Time_dim; + MU_BTYS_dims[1] = bdy_width_dim; + MU_BTYS_dims[2] = west_east_dim; + stat = nc_def_var(ncid, "MU_BTYS", NC_FLOAT, RANK_MU_BTYS, MU_BTYS_dims, &MU_BTYS_id); + check_err(stat,__LINE__,__FILE__); + + MU_BTYE_dims[0] = Time_dim; + MU_BTYE_dims[1] = bdy_width_dim; + MU_BTYE_dims[2] = west_east_dim; + stat = nc_def_var(ncid, "MU_BTYE", NC_FLOAT, RANK_MU_BTYE, MU_BTYE_dims, &MU_BTYE_id); + check_err(stat,__LINE__,__FILE__); + + QVAPOR_BXS_dims[0] = Time_dim; + QVAPOR_BXS_dims[1] = bdy_width_dim; + QVAPOR_BXS_dims[2] = bottom_top_dim; + QVAPOR_BXS_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "QVAPOR_BXS", NC_FLOAT, RANK_QVAPOR_BXS, QVAPOR_BXS_dims, &QVAPOR_BXS_id); + check_err(stat,__LINE__,__FILE__); + + QVAPOR_BXE_dims[0] = Time_dim; + QVAPOR_BXE_dims[1] = bdy_width_dim; + QVAPOR_BXE_dims[2] = bottom_top_dim; + QVAPOR_BXE_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "QVAPOR_BXE", NC_FLOAT, RANK_QVAPOR_BXE, QVAPOR_BXE_dims, &QVAPOR_BXE_id); + check_err(stat,__LINE__,__FILE__); + + QVAPOR_BYS_dims[0] = Time_dim; + QVAPOR_BYS_dims[1] = bdy_width_dim; + QVAPOR_BYS_dims[2] = bottom_top_dim; + QVAPOR_BYS_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "QVAPOR_BYS", NC_FLOAT, RANK_QVAPOR_BYS, QVAPOR_BYS_dims, &QVAPOR_BYS_id); + check_err(stat,__LINE__,__FILE__); + + QVAPOR_BYE_dims[0] = Time_dim; + QVAPOR_BYE_dims[1] = bdy_width_dim; + QVAPOR_BYE_dims[2] = bottom_top_dim; + QVAPOR_BYE_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "QVAPOR_BYE", NC_FLOAT, RANK_QVAPOR_BYE, QVAPOR_BYE_dims, &QVAPOR_BYE_id); + check_err(stat,__LINE__,__FILE__); + + QCLOUD_BXS_dims[0] = Time_dim; + QCLOUD_BXS_dims[1] = bdy_width_dim; + QCLOUD_BXS_dims[2] = bottom_top_dim; + QCLOUD_BXS_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "QCLOUD_BXS", NC_FLOAT, RANK_QCLOUD_BXS, QCLOUD_BXS_dims, &QCLOUD_BXS_id); + check_err(stat,__LINE__,__FILE__); + + QCLOUD_BXE_dims[0] = Time_dim; + QCLOUD_BXE_dims[1] = bdy_width_dim; + QCLOUD_BXE_dims[2] = bottom_top_dim; + QCLOUD_BXE_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "QCLOUD_BXE", NC_FLOAT, RANK_QCLOUD_BXE, QCLOUD_BXE_dims, &QCLOUD_BXE_id); + check_err(stat,__LINE__,__FILE__); + + QCLOUD_BYS_dims[0] = Time_dim; + QCLOUD_BYS_dims[1] = bdy_width_dim; + QCLOUD_BYS_dims[2] = bottom_top_dim; + QCLOUD_BYS_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "QCLOUD_BYS", NC_FLOAT, RANK_QCLOUD_BYS, QCLOUD_BYS_dims, &QCLOUD_BYS_id); + check_err(stat,__LINE__,__FILE__); + + QCLOUD_BYE_dims[0] = Time_dim; + QCLOUD_BYE_dims[1] = bdy_width_dim; + QCLOUD_BYE_dims[2] = bottom_top_dim; + QCLOUD_BYE_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "QCLOUD_BYE", NC_FLOAT, RANK_QCLOUD_BYE, QCLOUD_BYE_dims, &QCLOUD_BYE_id); + check_err(stat,__LINE__,__FILE__); + + QRAIN_BXS_dims[0] = Time_dim; + QRAIN_BXS_dims[1] = bdy_width_dim; + QRAIN_BXS_dims[2] = bottom_top_dim; + QRAIN_BXS_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "QRAIN_BXS", NC_FLOAT, RANK_QRAIN_BXS, QRAIN_BXS_dims, &QRAIN_BXS_id); + check_err(stat,__LINE__,__FILE__); + + QRAIN_BXE_dims[0] = Time_dim; + QRAIN_BXE_dims[1] = bdy_width_dim; + QRAIN_BXE_dims[2] = bottom_top_dim; + QRAIN_BXE_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "QRAIN_BXE", NC_FLOAT, RANK_QRAIN_BXE, QRAIN_BXE_dims, &QRAIN_BXE_id); + check_err(stat,__LINE__,__FILE__); + + QRAIN_BYS_dims[0] = Time_dim; + QRAIN_BYS_dims[1] = bdy_width_dim; + QRAIN_BYS_dims[2] = bottom_top_dim; + QRAIN_BYS_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "QRAIN_BYS", NC_FLOAT, RANK_QRAIN_BYS, QRAIN_BYS_dims, &QRAIN_BYS_id); + check_err(stat,__LINE__,__FILE__); + + QRAIN_BYE_dims[0] = Time_dim; + QRAIN_BYE_dims[1] = bdy_width_dim; + QRAIN_BYE_dims[2] = bottom_top_dim; + QRAIN_BYE_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "QRAIN_BYE", NC_FLOAT, RANK_QRAIN_BYE, QRAIN_BYE_dims, &QRAIN_BYE_id); + check_err(stat,__LINE__,__FILE__); + + QICE_BXS_dims[0] = Time_dim; + QICE_BXS_dims[1] = bdy_width_dim; + QICE_BXS_dims[2] = bottom_top_dim; + QICE_BXS_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "QICE_BXS", NC_FLOAT, RANK_QICE_BXS, QICE_BXS_dims, &QICE_BXS_id); + check_err(stat,__LINE__,__FILE__); + + QICE_BXE_dims[0] = Time_dim; + QICE_BXE_dims[1] = bdy_width_dim; + QICE_BXE_dims[2] = bottom_top_dim; + QICE_BXE_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "QICE_BXE", NC_FLOAT, RANK_QICE_BXE, QICE_BXE_dims, &QICE_BXE_id); + check_err(stat,__LINE__,__FILE__); + + QICE_BYS_dims[0] = Time_dim; + QICE_BYS_dims[1] = bdy_width_dim; + QICE_BYS_dims[2] = bottom_top_dim; + QICE_BYS_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "QICE_BYS", NC_FLOAT, RANK_QICE_BYS, QICE_BYS_dims, &QICE_BYS_id); + check_err(stat,__LINE__,__FILE__); + + QICE_BYE_dims[0] = Time_dim; + QICE_BYE_dims[1] = bdy_width_dim; + QICE_BYE_dims[2] = bottom_top_dim; + QICE_BYE_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "QICE_BYE", NC_FLOAT, RANK_QICE_BYE, QICE_BYE_dims, &QICE_BYE_id); + check_err(stat,__LINE__,__FILE__); + + QSNOW_BXS_dims[0] = Time_dim; + QSNOW_BXS_dims[1] = bdy_width_dim; + QSNOW_BXS_dims[2] = bottom_top_dim; + QSNOW_BXS_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "QSNOW_BXS", NC_FLOAT, RANK_QSNOW_BXS, QSNOW_BXS_dims, &QSNOW_BXS_id); + check_err(stat,__LINE__,__FILE__); + + QSNOW_BXE_dims[0] = Time_dim; + QSNOW_BXE_dims[1] = bdy_width_dim; + QSNOW_BXE_dims[2] = bottom_top_dim; + QSNOW_BXE_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "QSNOW_BXE", NC_FLOAT, RANK_QSNOW_BXE, QSNOW_BXE_dims, &QSNOW_BXE_id); + check_err(stat,__LINE__,__FILE__); + + QSNOW_BYS_dims[0] = Time_dim; + QSNOW_BYS_dims[1] = bdy_width_dim; + QSNOW_BYS_dims[2] = bottom_top_dim; + QSNOW_BYS_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "QSNOW_BYS", NC_FLOAT, RANK_QSNOW_BYS, QSNOW_BYS_dims, &QSNOW_BYS_id); + check_err(stat,__LINE__,__FILE__); + + QSNOW_BYE_dims[0] = Time_dim; + QSNOW_BYE_dims[1] = bdy_width_dim; + QSNOW_BYE_dims[2] = bottom_top_dim; + QSNOW_BYE_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "QSNOW_BYE", NC_FLOAT, RANK_QSNOW_BYE, QSNOW_BYE_dims, &QSNOW_BYE_id); + check_err(stat,__LINE__,__FILE__); + + QGRAUP_BXS_dims[0] = Time_dim; + QGRAUP_BXS_dims[1] = bdy_width_dim; + QGRAUP_BXS_dims[2] = bottom_top_dim; + QGRAUP_BXS_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "QGRAUP_BXS", NC_FLOAT, RANK_QGRAUP_BXS, QGRAUP_BXS_dims, &QGRAUP_BXS_id); + check_err(stat,__LINE__,__FILE__); + + QGRAUP_BXE_dims[0] = Time_dim; + QGRAUP_BXE_dims[1] = bdy_width_dim; + QGRAUP_BXE_dims[2] = bottom_top_dim; + QGRAUP_BXE_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "QGRAUP_BXE", NC_FLOAT, RANK_QGRAUP_BXE, QGRAUP_BXE_dims, &QGRAUP_BXE_id); + check_err(stat,__LINE__,__FILE__); + + QGRAUP_BYS_dims[0] = Time_dim; + QGRAUP_BYS_dims[1] = bdy_width_dim; + QGRAUP_BYS_dims[2] = bottom_top_dim; + QGRAUP_BYS_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "QGRAUP_BYS", NC_FLOAT, RANK_QGRAUP_BYS, QGRAUP_BYS_dims, &QGRAUP_BYS_id); + check_err(stat,__LINE__,__FILE__); + + QGRAUP_BYE_dims[0] = Time_dim; + QGRAUP_BYE_dims[1] = bdy_width_dim; + QGRAUP_BYE_dims[2] = bottom_top_dim; + QGRAUP_BYE_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "QGRAUP_BYE", NC_FLOAT, RANK_QGRAUP_BYE, QGRAUP_BYE_dims, &QGRAUP_BYE_id); + check_err(stat,__LINE__,__FILE__); + + QVAPOR_BTXS_dims[0] = Time_dim; + QVAPOR_BTXS_dims[1] = bdy_width_dim; + QVAPOR_BTXS_dims[2] = bottom_top_dim; + QVAPOR_BTXS_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "QVAPOR_BTXS", NC_FLOAT, RANK_QVAPOR_BTXS, QVAPOR_BTXS_dims, &QVAPOR_BTXS_id); + check_err(stat,__LINE__,__FILE__); + + QVAPOR_BTXE_dims[0] = Time_dim; + QVAPOR_BTXE_dims[1] = bdy_width_dim; + QVAPOR_BTXE_dims[2] = bottom_top_dim; + QVAPOR_BTXE_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "QVAPOR_BTXE", NC_FLOAT, RANK_QVAPOR_BTXE, QVAPOR_BTXE_dims, &QVAPOR_BTXE_id); + check_err(stat,__LINE__,__FILE__); + + QVAPOR_BTYS_dims[0] = Time_dim; + QVAPOR_BTYS_dims[1] = bdy_width_dim; + QVAPOR_BTYS_dims[2] = bottom_top_dim; + QVAPOR_BTYS_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "QVAPOR_BTYS", NC_FLOAT, RANK_QVAPOR_BTYS, QVAPOR_BTYS_dims, &QVAPOR_BTYS_id); + check_err(stat,__LINE__,__FILE__); + + QVAPOR_BTYE_dims[0] = Time_dim; + QVAPOR_BTYE_dims[1] = bdy_width_dim; + QVAPOR_BTYE_dims[2] = bottom_top_dim; + QVAPOR_BTYE_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "QVAPOR_BTYE", NC_FLOAT, RANK_QVAPOR_BTYE, QVAPOR_BTYE_dims, &QVAPOR_BTYE_id); + check_err(stat,__LINE__,__FILE__); + + QCLOUD_BTXS_dims[0] = Time_dim; + QCLOUD_BTXS_dims[1] = bdy_width_dim; + QCLOUD_BTXS_dims[2] = bottom_top_dim; + QCLOUD_BTXS_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "QCLOUD_BTXS", NC_FLOAT, RANK_QCLOUD_BTXS, QCLOUD_BTXS_dims, &QCLOUD_BTXS_id); + check_err(stat,__LINE__,__FILE__); + + QCLOUD_BTXE_dims[0] = Time_dim; + QCLOUD_BTXE_dims[1] = bdy_width_dim; + QCLOUD_BTXE_dims[2] = bottom_top_dim; + QCLOUD_BTXE_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "QCLOUD_BTXE", NC_FLOAT, RANK_QCLOUD_BTXE, QCLOUD_BTXE_dims, &QCLOUD_BTXE_id); + check_err(stat,__LINE__,__FILE__); + + QCLOUD_BTYS_dims[0] = Time_dim; + QCLOUD_BTYS_dims[1] = bdy_width_dim; + QCLOUD_BTYS_dims[2] = bottom_top_dim; + QCLOUD_BTYS_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "QCLOUD_BTYS", NC_FLOAT, RANK_QCLOUD_BTYS, QCLOUD_BTYS_dims, &QCLOUD_BTYS_id); + check_err(stat,__LINE__,__FILE__); + + QCLOUD_BTYE_dims[0] = Time_dim; + QCLOUD_BTYE_dims[1] = bdy_width_dim; + QCLOUD_BTYE_dims[2] = bottom_top_dim; + QCLOUD_BTYE_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "QCLOUD_BTYE", NC_FLOAT, RANK_QCLOUD_BTYE, QCLOUD_BTYE_dims, &QCLOUD_BTYE_id); + check_err(stat,__LINE__,__FILE__); + + QRAIN_BTXS_dims[0] = Time_dim; + QRAIN_BTXS_dims[1] = bdy_width_dim; + QRAIN_BTXS_dims[2] = bottom_top_dim; + QRAIN_BTXS_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "QRAIN_BTXS", NC_FLOAT, RANK_QRAIN_BTXS, QRAIN_BTXS_dims, &QRAIN_BTXS_id); + check_err(stat,__LINE__,__FILE__); + + QRAIN_BTXE_dims[0] = Time_dim; + QRAIN_BTXE_dims[1] = bdy_width_dim; + QRAIN_BTXE_dims[2] = bottom_top_dim; + QRAIN_BTXE_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "QRAIN_BTXE", NC_FLOAT, RANK_QRAIN_BTXE, QRAIN_BTXE_dims, &QRAIN_BTXE_id); + check_err(stat,__LINE__,__FILE__); + + QRAIN_BTYS_dims[0] = Time_dim; + QRAIN_BTYS_dims[1] = bdy_width_dim; + QRAIN_BTYS_dims[2] = bottom_top_dim; + QRAIN_BTYS_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "QRAIN_BTYS", NC_FLOAT, RANK_QRAIN_BTYS, QRAIN_BTYS_dims, &QRAIN_BTYS_id); + check_err(stat,__LINE__,__FILE__); + + QRAIN_BTYE_dims[0] = Time_dim; + QRAIN_BTYE_dims[1] = bdy_width_dim; + QRAIN_BTYE_dims[2] = bottom_top_dim; + QRAIN_BTYE_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "QRAIN_BTYE", NC_FLOAT, RANK_QRAIN_BTYE, QRAIN_BTYE_dims, &QRAIN_BTYE_id); + check_err(stat,__LINE__,__FILE__); + + QICE_BTXS_dims[0] = Time_dim; + QICE_BTXS_dims[1] = bdy_width_dim; + QICE_BTXS_dims[2] = bottom_top_dim; + QICE_BTXS_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "QICE_BTXS", NC_FLOAT, RANK_QICE_BTXS, QICE_BTXS_dims, &QICE_BTXS_id); + check_err(stat,__LINE__,__FILE__); + + QICE_BTXE_dims[0] = Time_dim; + QICE_BTXE_dims[1] = bdy_width_dim; + QICE_BTXE_dims[2] = bottom_top_dim; + QICE_BTXE_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "QICE_BTXE", NC_FLOAT, RANK_QICE_BTXE, QICE_BTXE_dims, &QICE_BTXE_id); + check_err(stat,__LINE__,__FILE__); + + QICE_BTYS_dims[0] = Time_dim; + QICE_BTYS_dims[1] = bdy_width_dim; + QICE_BTYS_dims[2] = bottom_top_dim; + QICE_BTYS_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "QICE_BTYS", NC_FLOAT, RANK_QICE_BTYS, QICE_BTYS_dims, &QICE_BTYS_id); + check_err(stat,__LINE__,__FILE__); + + QICE_BTYE_dims[0] = Time_dim; + QICE_BTYE_dims[1] = bdy_width_dim; + QICE_BTYE_dims[2] = bottom_top_dim; + QICE_BTYE_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "QICE_BTYE", NC_FLOAT, RANK_QICE_BTYE, QICE_BTYE_dims, &QICE_BTYE_id); + check_err(stat,__LINE__,__FILE__); + + QSNOW_BTXS_dims[0] = Time_dim; + QSNOW_BTXS_dims[1] = bdy_width_dim; + QSNOW_BTXS_dims[2] = bottom_top_dim; + QSNOW_BTXS_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "QSNOW_BTXS", NC_FLOAT, RANK_QSNOW_BTXS, QSNOW_BTXS_dims, &QSNOW_BTXS_id); + check_err(stat,__LINE__,__FILE__); + + QSNOW_BTXE_dims[0] = Time_dim; + QSNOW_BTXE_dims[1] = bdy_width_dim; + QSNOW_BTXE_dims[2] = bottom_top_dim; + QSNOW_BTXE_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "QSNOW_BTXE", NC_FLOAT, RANK_QSNOW_BTXE, QSNOW_BTXE_dims, &QSNOW_BTXE_id); + check_err(stat,__LINE__,__FILE__); + + QSNOW_BTYS_dims[0] = Time_dim; + QSNOW_BTYS_dims[1] = bdy_width_dim; + QSNOW_BTYS_dims[2] = bottom_top_dim; + QSNOW_BTYS_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "QSNOW_BTYS", NC_FLOAT, RANK_QSNOW_BTYS, QSNOW_BTYS_dims, &QSNOW_BTYS_id); + check_err(stat,__LINE__,__FILE__); + + QSNOW_BTYE_dims[0] = Time_dim; + QSNOW_BTYE_dims[1] = bdy_width_dim; + QSNOW_BTYE_dims[2] = bottom_top_dim; + QSNOW_BTYE_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "QSNOW_BTYE", NC_FLOAT, RANK_QSNOW_BTYE, QSNOW_BTYE_dims, &QSNOW_BTYE_id); + check_err(stat,__LINE__,__FILE__); + + QGRAUP_BTXS_dims[0] = Time_dim; + QGRAUP_BTXS_dims[1] = bdy_width_dim; + QGRAUP_BTXS_dims[2] = bottom_top_dim; + QGRAUP_BTXS_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "QGRAUP_BTXS", NC_FLOAT, RANK_QGRAUP_BTXS, QGRAUP_BTXS_dims, &QGRAUP_BTXS_id); + check_err(stat,__LINE__,__FILE__); + + QGRAUP_BTXE_dims[0] = Time_dim; + QGRAUP_BTXE_dims[1] = bdy_width_dim; + QGRAUP_BTXE_dims[2] = bottom_top_dim; + QGRAUP_BTXE_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "QGRAUP_BTXE", NC_FLOAT, RANK_QGRAUP_BTXE, QGRAUP_BTXE_dims, &QGRAUP_BTXE_id); + check_err(stat,__LINE__,__FILE__); + + QGRAUP_BTYS_dims[0] = Time_dim; + QGRAUP_BTYS_dims[1] = bdy_width_dim; + QGRAUP_BTYS_dims[2] = bottom_top_dim; + QGRAUP_BTYS_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "QGRAUP_BTYS", NC_FLOAT, RANK_QGRAUP_BTYS, QGRAUP_BTYS_dims, &QGRAUP_BTYS_id); + check_err(stat,__LINE__,__FILE__); + + QGRAUP_BTYE_dims[0] = Time_dim; + QGRAUP_BTYE_dims[1] = bdy_width_dim; + QGRAUP_BTYE_dims[2] = bottom_top_dim; + QGRAUP_BTYE_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "QGRAUP_BTYE", NC_FLOAT, RANK_QGRAUP_BTYE, QGRAUP_BTYE_dims, &QGRAUP_BTYE_id); + check_err(stat,__LINE__,__FILE__); + + QNICE_BXS_dims[0] = Time_dim; + QNICE_BXS_dims[1] = bdy_width_dim; + QNICE_BXS_dims[2] = bottom_top_dim; + QNICE_BXS_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "QNICE_BXS", NC_FLOAT, RANK_QNICE_BXS, QNICE_BXS_dims, &QNICE_BXS_id); + check_err(stat,__LINE__,__FILE__); + + QNICE_BXE_dims[0] = Time_dim; + QNICE_BXE_dims[1] = bdy_width_dim; + QNICE_BXE_dims[2] = bottom_top_dim; + QNICE_BXE_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "QNICE_BXE", NC_FLOAT, RANK_QNICE_BXE, QNICE_BXE_dims, &QNICE_BXE_id); + check_err(stat,__LINE__,__FILE__); + + QNICE_BYS_dims[0] = Time_dim; + QNICE_BYS_dims[1] = bdy_width_dim; + QNICE_BYS_dims[2] = bottom_top_dim; + QNICE_BYS_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "QNICE_BYS", NC_FLOAT, RANK_QNICE_BYS, QNICE_BYS_dims, &QNICE_BYS_id); + check_err(stat,__LINE__,__FILE__); + + QNICE_BYE_dims[0] = Time_dim; + QNICE_BYE_dims[1] = bdy_width_dim; + QNICE_BYE_dims[2] = bottom_top_dim; + QNICE_BYE_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "QNICE_BYE", NC_FLOAT, RANK_QNICE_BYE, QNICE_BYE_dims, &QNICE_BYE_id); + check_err(stat,__LINE__,__FILE__); + + QNRAIN_BXS_dims[0] = Time_dim; + QNRAIN_BXS_dims[1] = bdy_width_dim; + QNRAIN_BXS_dims[2] = bottom_top_dim; + QNRAIN_BXS_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "QNRAIN_BXS", NC_FLOAT, RANK_QNRAIN_BXS, QNRAIN_BXS_dims, &QNRAIN_BXS_id); + check_err(stat,__LINE__,__FILE__); + + QNRAIN_BXE_dims[0] = Time_dim; + QNRAIN_BXE_dims[1] = bdy_width_dim; + QNRAIN_BXE_dims[2] = bottom_top_dim; + QNRAIN_BXE_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "QNRAIN_BXE", NC_FLOAT, RANK_QNRAIN_BXE, QNRAIN_BXE_dims, &QNRAIN_BXE_id); + check_err(stat,__LINE__,__FILE__); + + QNRAIN_BYS_dims[0] = Time_dim; + QNRAIN_BYS_dims[1] = bdy_width_dim; + QNRAIN_BYS_dims[2] = bottom_top_dim; + QNRAIN_BYS_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "QNRAIN_BYS", NC_FLOAT, RANK_QNRAIN_BYS, QNRAIN_BYS_dims, &QNRAIN_BYS_id); + check_err(stat,__LINE__,__FILE__); + + QNRAIN_BYE_dims[0] = Time_dim; + QNRAIN_BYE_dims[1] = bdy_width_dim; + QNRAIN_BYE_dims[2] = bottom_top_dim; + QNRAIN_BYE_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "QNRAIN_BYE", NC_FLOAT, RANK_QNRAIN_BYE, QNRAIN_BYE_dims, &QNRAIN_BYE_id); + check_err(stat,__LINE__,__FILE__); + + QNICE_BTXS_dims[0] = Time_dim; + QNICE_BTXS_dims[1] = bdy_width_dim; + QNICE_BTXS_dims[2] = bottom_top_dim; + QNICE_BTXS_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "QNICE_BTXS", NC_FLOAT, RANK_QNICE_BTXS, QNICE_BTXS_dims, &QNICE_BTXS_id); + check_err(stat,__LINE__,__FILE__); + + QNICE_BTXE_dims[0] = Time_dim; + QNICE_BTXE_dims[1] = bdy_width_dim; + QNICE_BTXE_dims[2] = bottom_top_dim; + QNICE_BTXE_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "QNICE_BTXE", NC_FLOAT, RANK_QNICE_BTXE, QNICE_BTXE_dims, &QNICE_BTXE_id); + check_err(stat,__LINE__,__FILE__); + + QNICE_BTYS_dims[0] = Time_dim; + QNICE_BTYS_dims[1] = bdy_width_dim; + QNICE_BTYS_dims[2] = bottom_top_dim; + QNICE_BTYS_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "QNICE_BTYS", NC_FLOAT, RANK_QNICE_BTYS, QNICE_BTYS_dims, &QNICE_BTYS_id); + check_err(stat,__LINE__,__FILE__); + + QNICE_BTYE_dims[0] = Time_dim; + QNICE_BTYE_dims[1] = bdy_width_dim; + QNICE_BTYE_dims[2] = bottom_top_dim; + QNICE_BTYE_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "QNICE_BTYE", NC_FLOAT, RANK_QNICE_BTYE, QNICE_BTYE_dims, &QNICE_BTYE_id); + check_err(stat,__LINE__,__FILE__); + + QNRAIN_BTXS_dims[0] = Time_dim; + QNRAIN_BTXS_dims[1] = bdy_width_dim; + QNRAIN_BTXS_dims[2] = bottom_top_dim; + QNRAIN_BTXS_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "QNRAIN_BTXS", NC_FLOAT, RANK_QNRAIN_BTXS, QNRAIN_BTXS_dims, &QNRAIN_BTXS_id); + check_err(stat,__LINE__,__FILE__); + + QNRAIN_BTXE_dims[0] = Time_dim; + QNRAIN_BTXE_dims[1] = bdy_width_dim; + QNRAIN_BTXE_dims[2] = bottom_top_dim; + QNRAIN_BTXE_dims[3] = south_north_dim; + stat = nc_def_var(ncid, "QNRAIN_BTXE", NC_FLOAT, RANK_QNRAIN_BTXE, QNRAIN_BTXE_dims, &QNRAIN_BTXE_id); + check_err(stat,__LINE__,__FILE__); + + QNRAIN_BTYS_dims[0] = Time_dim; + QNRAIN_BTYS_dims[1] = bdy_width_dim; + QNRAIN_BTYS_dims[2] = bottom_top_dim; + QNRAIN_BTYS_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "QNRAIN_BTYS", NC_FLOAT, RANK_QNRAIN_BTYS, QNRAIN_BTYS_dims, &QNRAIN_BTYS_id); + check_err(stat,__LINE__,__FILE__); + + QNRAIN_BTYE_dims[0] = Time_dim; + QNRAIN_BTYE_dims[1] = bdy_width_dim; + QNRAIN_BTYE_dims[2] = bottom_top_dim; + QNRAIN_BTYE_dims[3] = west_east_dim; + stat = nc_def_var(ncid, "QNRAIN_BTYE", NC_FLOAT, RANK_QNRAIN_BTYE, QNRAIN_BTYE_dims, &QNRAIN_BTYE_id); + check_err(stat,__LINE__,__FILE__); + + HT_SHAD_BXS_dims[0] = Time_dim; + HT_SHAD_BXS_dims[1] = bdy_width_dim; + HT_SHAD_BXS_dims[2] = south_north_dim; + stat = nc_def_var(ncid, "HT_SHAD_BXS", NC_FLOAT, RANK_HT_SHAD_BXS, HT_SHAD_BXS_dims, &HT_SHAD_BXS_id); + check_err(stat,__LINE__,__FILE__); + + HT_SHAD_BXE_dims[0] = Time_dim; + HT_SHAD_BXE_dims[1] = bdy_width_dim; + HT_SHAD_BXE_dims[2] = south_north_dim; + stat = nc_def_var(ncid, "HT_SHAD_BXE", NC_FLOAT, RANK_HT_SHAD_BXE, HT_SHAD_BXE_dims, &HT_SHAD_BXE_id); + check_err(stat,__LINE__,__FILE__); + + HT_SHAD_BYS_dims[0] = Time_dim; + HT_SHAD_BYS_dims[1] = bdy_width_dim; + HT_SHAD_BYS_dims[2] = west_east_dim; + stat = nc_def_var(ncid, "HT_SHAD_BYS", NC_FLOAT, RANK_HT_SHAD_BYS, HT_SHAD_BYS_dims, &HT_SHAD_BYS_id); + check_err(stat,__LINE__,__FILE__); + + HT_SHAD_BYE_dims[0] = Time_dim; + HT_SHAD_BYE_dims[1] = bdy_width_dim; + HT_SHAD_BYE_dims[2] = west_east_dim; + stat = nc_def_var(ncid, "HT_SHAD_BYE", NC_FLOAT, RANK_HT_SHAD_BYE, HT_SHAD_BYE_dims, &HT_SHAD_BYE_id); + check_err(stat,__LINE__,__FILE__); + + HT_SHAD_BTXS_dims[0] = Time_dim; + HT_SHAD_BTXS_dims[1] = bdy_width_dim; + HT_SHAD_BTXS_dims[2] = south_north_dim; + stat = nc_def_var(ncid, "HT_SHAD_BTXS", NC_FLOAT, RANK_HT_SHAD_BTXS, HT_SHAD_BTXS_dims, &HT_SHAD_BTXS_id); + check_err(stat,__LINE__,__FILE__); + + HT_SHAD_BTXE_dims[0] = Time_dim; + HT_SHAD_BTXE_dims[1] = bdy_width_dim; + HT_SHAD_BTXE_dims[2] = south_north_dim; + stat = nc_def_var(ncid, "HT_SHAD_BTXE", NC_FLOAT, RANK_HT_SHAD_BTXE, HT_SHAD_BTXE_dims, &HT_SHAD_BTXE_id); + check_err(stat,__LINE__,__FILE__); + + HT_SHAD_BTYS_dims[0] = Time_dim; + HT_SHAD_BTYS_dims[1] = bdy_width_dim; + HT_SHAD_BTYS_dims[2] = west_east_dim; + stat = nc_def_var(ncid, "HT_SHAD_BTYS", NC_FLOAT, RANK_HT_SHAD_BTYS, HT_SHAD_BTYS_dims, &HT_SHAD_BTYS_id); + check_err(stat,__LINE__,__FILE__); + + HT_SHAD_BTYE_dims[0] = Time_dim; + HT_SHAD_BTYE_dims[1] = bdy_width_dim; + HT_SHAD_BTYE_dims[2] = west_east_dim; + stat = nc_def_var(ncid, "HT_SHAD_BTYE", NC_FLOAT, RANK_HT_SHAD_BTYE, HT_SHAD_BTYE_dims, &HT_SHAD_BTYE_id); + check_err(stat,__LINE__,__FILE__); + + PC_BXS_dims[0] = Time_dim; + PC_BXS_dims[1] = bdy_width_dim; + PC_BXS_dims[2] = south_north_dim; + stat = nc_def_var(ncid, "PC_BXS", NC_FLOAT, RANK_PC_BXS, PC_BXS_dims, &PC_BXS_id); + check_err(stat,__LINE__,__FILE__); + + PC_BXE_dims[0] = Time_dim; + PC_BXE_dims[1] = bdy_width_dim; + PC_BXE_dims[2] = south_north_dim; + stat = nc_def_var(ncid, "PC_BXE", NC_FLOAT, RANK_PC_BXE, PC_BXE_dims, &PC_BXE_id); + check_err(stat,__LINE__,__FILE__); + + PC_BYS_dims[0] = Time_dim; + PC_BYS_dims[1] = bdy_width_dim; + PC_BYS_dims[2] = west_east_dim; + stat = nc_def_var(ncid, "PC_BYS", NC_FLOAT, RANK_PC_BYS, PC_BYS_dims, &PC_BYS_id); + check_err(stat,__LINE__,__FILE__); + + PC_BYE_dims[0] = Time_dim; + PC_BYE_dims[1] = bdy_width_dim; + PC_BYE_dims[2] = west_east_dim; + stat = nc_def_var(ncid, "PC_BYE", NC_FLOAT, RANK_PC_BYE, PC_BYE_dims, &PC_BYE_id); + check_err(stat,__LINE__,__FILE__); + + PC_BTXS_dims[0] = Time_dim; + PC_BTXS_dims[1] = bdy_width_dim; + PC_BTXS_dims[2] = south_north_dim; + stat = nc_def_var(ncid, "PC_BTXS", NC_FLOAT, RANK_PC_BTXS, PC_BTXS_dims, &PC_BTXS_id); + check_err(stat,__LINE__,__FILE__); + + PC_BTXE_dims[0] = Time_dim; + PC_BTXE_dims[1] = bdy_width_dim; + PC_BTXE_dims[2] = south_north_dim; + stat = nc_def_var(ncid, "PC_BTXE", NC_FLOAT, RANK_PC_BTXE, PC_BTXE_dims, &PC_BTXE_id); + check_err(stat,__LINE__,__FILE__); + + PC_BTYS_dims[0] = Time_dim; + PC_BTYS_dims[1] = bdy_width_dim; + PC_BTYS_dims[2] = west_east_dim; + stat = nc_def_var(ncid, "PC_BTYS", NC_FLOAT, RANK_PC_BTYS, PC_BTYS_dims, &PC_BTYS_id); + check_err(stat,__LINE__,__FILE__); + + PC_BTYE_dims[0] = Time_dim; + PC_BTYE_dims[1] = bdy_width_dim; + PC_BTYE_dims[2] = west_east_dim; + stat = nc_def_var(ncid, "PC_BTYE", NC_FLOAT, RANK_PC_BTYE, PC_BTYE_dims, &PC_BTYE_id); + check_err(stat,__LINE__,__FILE__); + + /* assign global attributes */ + + { + stat = nc_put_att_text(ncid, NC_GLOBAL, "TITLE", 38, " OUTPUT FROM REAL_EM V4.0 PREPROCESSOR"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, NC_GLOBAL, "START_DATE", 19, "2018-01-01_00:00:00"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_WEST_MINUS_EAST_GRID_DIMENSION_att[1] = {74} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "WEST-EAST_GRID_DIMENSION", NC_INT, 1, wrfbdy_d01_WEST_MINUS_EAST_GRID_DIMENSION_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_SOUTH_MINUS_NORTH_GRID_DIMENSION_att[1] = {61} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "SOUTH-NORTH_GRID_DIMENSION", NC_INT, 1, wrfbdy_d01_SOUTH_MINUS_NORTH_GRID_DIMENSION_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_BOTTOM_MINUS_TOP_GRID_DIMENSION_att[1] = {33} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "BOTTOM-TOP_GRID_DIMENSION", NC_INT, 1, wrfbdy_d01_BOTTOM_MINUS_TOP_GRID_DIMENSION_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float wrfbdy_d01_DX_att[1] = {((float)30000)} ; + stat = nc_put_att_float(ncid, NC_GLOBAL, "DX", NC_FLOAT, 1, wrfbdy_d01_DX_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float wrfbdy_d01_DY_att[1] = {((float)30000)} ; + stat = nc_put_att_float(ncid, NC_GLOBAL, "DY", NC_FLOAT, 1, wrfbdy_d01_DY_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_AERCU_OPT_att[1] = {0} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "AERCU_OPT", NC_INT, 1, wrfbdy_d01_AERCU_OPT_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float wrfbdy_d01_AERCU_FCT_att[1] = {((float)1)} ; + stat = nc_put_att_float(ncid, NC_GLOBAL, "AERCU_FCT", NC_FLOAT, 1, wrfbdy_d01_AERCU_FCT_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_IDEAL_CASE_att[1] = {0} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "IDEAL_CASE", NC_INT, 1, wrfbdy_d01_IDEAL_CASE_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_DIFF_6TH_SLOPEOPT_att[1] = {0} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "DIFF_6TH_SLOPEOPT", NC_INT, 1, wrfbdy_d01_DIFF_6TH_SLOPEOPT_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_AUTO_LEVELS_OPT_att[1] = {2} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "AUTO_LEVELS_OPT", NC_INT, 1, wrfbdy_d01_AUTO_LEVELS_OPT_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float wrfbdy_d01_DIFF_6TH_THRESH_att[1] = {((float)0.1)} ; + stat = nc_put_att_float(ncid, NC_GLOBAL, "DIFF_6TH_THRESH", NC_FLOAT, 1, wrfbdy_d01_DIFF_6TH_THRESH_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float wrfbdy_d01_DZBOT_att[1] = {((float)50)} ; + stat = nc_put_att_float(ncid, NC_GLOBAL, "DZBOT", NC_FLOAT, 1, wrfbdy_d01_DZBOT_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float wrfbdy_d01_DZSTRETCH_S_att[1] = {((float)1.3)} ; + stat = nc_put_att_float(ncid, NC_GLOBAL, "DZSTRETCH_S", NC_FLOAT, 1, wrfbdy_d01_DZSTRETCH_S_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float wrfbdy_d01_DZSTRETCH_U_att[1] = {((float)1.1)} ; + stat = nc_put_att_float(ncid, NC_GLOBAL, "DZSTRETCH_U", NC_FLOAT, 1, wrfbdy_d01_DZSTRETCH_U_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, NC_GLOBAL, "GRIDTYPE", 1, "C"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_DIFF_OPT_att[1] = {1} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "DIFF_OPT", NC_INT, 1, wrfbdy_d01_DIFF_OPT_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_KM_OPT_att[1] = {4} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "KM_OPT", NC_INT, 1, wrfbdy_d01_KM_OPT_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_DAMP_OPT_att[1] = {3} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "DAMP_OPT", NC_INT, 1, wrfbdy_d01_DAMP_OPT_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float wrfbdy_d01_DAMPCOEF_att[1] = {((float)0.2)} ; + stat = nc_put_att_float(ncid, NC_GLOBAL, "DAMPCOEF", NC_FLOAT, 1, wrfbdy_d01_DAMPCOEF_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float wrfbdy_d01_KHDIF_att[1] = {((float)0)} ; + stat = nc_put_att_float(ncid, NC_GLOBAL, "KHDIF", NC_FLOAT, 1, wrfbdy_d01_KHDIF_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float wrfbdy_d01_KVDIF_att[1] = {((float)0)} ; + stat = nc_put_att_float(ncid, NC_GLOBAL, "KVDIF", NC_FLOAT, 1, wrfbdy_d01_KVDIF_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_MP_PHYSICS_att[1] = {8} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "MP_PHYSICS", NC_INT, 1, wrfbdy_d01_MP_PHYSICS_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_RA_LW_PHYSICS_att[1] = {4} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "RA_LW_PHYSICS", NC_INT, 1, wrfbdy_d01_RA_LW_PHYSICS_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_RA_SW_PHYSICS_att[1] = {4} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "RA_SW_PHYSICS", NC_INT, 1, wrfbdy_d01_RA_SW_PHYSICS_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_SF_SFCLAY_PHYSICS_att[1] = {2} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "SF_SFCLAY_PHYSICS", NC_INT, 1, wrfbdy_d01_SF_SFCLAY_PHYSICS_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_SF_SURFACE_PHYSICS_att[1] = {2} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "SF_SURFACE_PHYSICS", NC_INT, 1, wrfbdy_d01_SF_SURFACE_PHYSICS_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_BL_PBL_PHYSICS_att[1] = {2} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "BL_PBL_PHYSICS", NC_INT, 1, wrfbdy_d01_BL_PBL_PHYSICS_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_CU_PHYSICS_att[1] = {6} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "CU_PHYSICS", NC_INT, 1, wrfbdy_d01_CU_PHYSICS_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_SF_LAKE_PHYSICS_att[1] = {0} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "SF_LAKE_PHYSICS", NC_INT, 1, wrfbdy_d01_SF_LAKE_PHYSICS_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_SURFACE_INPUT_SOURCE_att[1] = {3} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "SURFACE_INPUT_SOURCE", NC_INT, 1, wrfbdy_d01_SURFACE_INPUT_SOURCE_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_SST_UPDATE_att[1] = {0} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "SST_UPDATE", NC_INT, 1, wrfbdy_d01_SST_UPDATE_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_GRID_FDDA_att[1] = {0} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "GRID_FDDA", NC_INT, 1, wrfbdy_d01_GRID_FDDA_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_GFDDA_INTERVAL_M_att[1] = {0} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "GFDDA_INTERVAL_M", NC_INT, 1, wrfbdy_d01_GFDDA_INTERVAL_M_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_GFDDA_END_H_att[1] = {0} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "GFDDA_END_H", NC_INT, 1, wrfbdy_d01_GFDDA_END_H_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_GRID_SFDDA_att[1] = {0} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "GRID_SFDDA", NC_INT, 1, wrfbdy_d01_GRID_SFDDA_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_SGFDDA_INTERVAL_M_att[1] = {0} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "SGFDDA_INTERVAL_M", NC_INT, 1, wrfbdy_d01_SGFDDA_INTERVAL_M_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_SGFDDA_END_H_att[1] = {0} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "SGFDDA_END_H", NC_INT, 1, wrfbdy_d01_SGFDDA_END_H_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_HYPSOMETRIC_OPT_att[1] = {2} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "HYPSOMETRIC_OPT", NC_INT, 1, wrfbdy_d01_HYPSOMETRIC_OPT_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_USE_THETA_M_att[1] = {1} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "USE_THETA_M", NC_INT, 1, wrfbdy_d01_USE_THETA_M_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_GWD_OPT_att[1] = {1} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "GWD_OPT", NC_INT, 1, wrfbdy_d01_GWD_OPT_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_SF_URBAN_PHYSICS_att[1] = {0} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "SF_URBAN_PHYSICS", NC_INT, 1, wrfbdy_d01_SF_URBAN_PHYSICS_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_SF_SURFACE_MOSAIC_att[1] = {0} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "SF_SURFACE_MOSAIC", NC_INT, 1, wrfbdy_d01_SF_SURFACE_MOSAIC_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_SF_OCEAN_PHYSICS_att[1] = {0} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "SF_OCEAN_PHYSICS", NC_INT, 1, wrfbdy_d01_SF_OCEAN_PHYSICS_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_WEST_MINUS_EAST_PATCH_START_UNSTAG_att[1] = {1} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "WEST-EAST_PATCH_START_UNSTAG", NC_INT, 1, wrfbdy_d01_WEST_MINUS_EAST_PATCH_START_UNSTAG_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_WEST_MINUS_EAST_PATCH_END_UNSTAG_att[1] = {73} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "WEST-EAST_PATCH_END_UNSTAG", NC_INT, 1, wrfbdy_d01_WEST_MINUS_EAST_PATCH_END_UNSTAG_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_WEST_MINUS_EAST_PATCH_START_STAG_att[1] = {1} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "WEST-EAST_PATCH_START_STAG", NC_INT, 1, wrfbdy_d01_WEST_MINUS_EAST_PATCH_START_STAG_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_WEST_MINUS_EAST_PATCH_END_STAG_att[1] = {74} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "WEST-EAST_PATCH_END_STAG", NC_INT, 1, wrfbdy_d01_WEST_MINUS_EAST_PATCH_END_STAG_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_SOUTH_MINUS_NORTH_PATCH_START_UNSTAG_att[1] = {1} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "SOUTH-NORTH_PATCH_START_UNSTAG", NC_INT, 1, wrfbdy_d01_SOUTH_MINUS_NORTH_PATCH_START_UNSTAG_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_SOUTH_MINUS_NORTH_PATCH_END_UNSTAG_att[1] = {60} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "SOUTH-NORTH_PATCH_END_UNSTAG", NC_INT, 1, wrfbdy_d01_SOUTH_MINUS_NORTH_PATCH_END_UNSTAG_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_SOUTH_MINUS_NORTH_PATCH_START_STAG_att[1] = {1} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "SOUTH-NORTH_PATCH_START_STAG", NC_INT, 1, wrfbdy_d01_SOUTH_MINUS_NORTH_PATCH_START_STAG_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_SOUTH_MINUS_NORTH_PATCH_END_STAG_att[1] = {61} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "SOUTH-NORTH_PATCH_END_STAG", NC_INT, 1, wrfbdy_d01_SOUTH_MINUS_NORTH_PATCH_END_STAG_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_BOTTOM_MINUS_TOP_PATCH_START_UNSTAG_att[1] = {1} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "BOTTOM-TOP_PATCH_START_UNSTAG", NC_INT, 1, wrfbdy_d01_BOTTOM_MINUS_TOP_PATCH_START_UNSTAG_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_BOTTOM_MINUS_TOP_PATCH_END_UNSTAG_att[1] = {32} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "BOTTOM-TOP_PATCH_END_UNSTAG", NC_INT, 1, wrfbdy_d01_BOTTOM_MINUS_TOP_PATCH_END_UNSTAG_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_BOTTOM_MINUS_TOP_PATCH_START_STAG_att[1] = {1} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "BOTTOM-TOP_PATCH_START_STAG", NC_INT, 1, wrfbdy_d01_BOTTOM_MINUS_TOP_PATCH_START_STAG_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_BOTTOM_MINUS_TOP_PATCH_END_STAG_att[1] = {33} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "BOTTOM-TOP_PATCH_END_STAG", NC_INT, 1, wrfbdy_d01_BOTTOM_MINUS_TOP_PATCH_END_STAG_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_GRID_ID_att[1] = {1} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "GRID_ID", NC_INT, 1, wrfbdy_d01_GRID_ID_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_PARENT_ID_att[1] = {0} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "PARENT_ID", NC_INT, 1, wrfbdy_d01_PARENT_ID_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_I_PARENT_START_att[1] = {1} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "I_PARENT_START", NC_INT, 1, wrfbdy_d01_I_PARENT_START_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_J_PARENT_START_att[1] = {1} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "J_PARENT_START", NC_INT, 1, wrfbdy_d01_J_PARENT_START_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_PARENT_GRID_RATIO_att[1] = {1} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "PARENT_GRID_RATIO", NC_INT, 1, wrfbdy_d01_PARENT_GRID_RATIO_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float wrfbdy_d01_DT_att[1] = {((float)180)} ; + stat = nc_put_att_float(ncid, NC_GLOBAL, "DT", NC_FLOAT, 1, wrfbdy_d01_DT_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float wrfbdy_d01_CEN_LAT_att[1] = {((float)34.830021)} ; + stat = nc_put_att_float(ncid, NC_GLOBAL, "CEN_LAT", NC_FLOAT, 1, wrfbdy_d01_CEN_LAT_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float wrfbdy_d01_CEN_LON_att[1] = {((float)-81.029999)} ; + stat = nc_put_att_float(ncid, NC_GLOBAL, "CEN_LON", NC_FLOAT, 1, wrfbdy_d01_CEN_LON_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float wrfbdy_d01_TRUELAT1_att[1] = {((float)30)} ; + stat = nc_put_att_float(ncid, NC_GLOBAL, "TRUELAT1", NC_FLOAT, 1, wrfbdy_d01_TRUELAT1_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float wrfbdy_d01_TRUELAT2_att[1] = {((float)60)} ; + stat = nc_put_att_float(ncid, NC_GLOBAL, "TRUELAT2", NC_FLOAT, 1, wrfbdy_d01_TRUELAT2_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float wrfbdy_d01_MOAD_CEN_LAT_att[1] = {((float)34.830021)} ; + stat = nc_put_att_float(ncid, NC_GLOBAL, "MOAD_CEN_LAT", NC_FLOAT, 1, wrfbdy_d01_MOAD_CEN_LAT_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float wrfbdy_d01_STAND_LON_att[1] = {((float)-98)} ; + stat = nc_put_att_float(ncid, NC_GLOBAL, "STAND_LON", NC_FLOAT, 1, wrfbdy_d01_STAND_LON_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float wrfbdy_d01_POLE_LAT_att[1] = {((float)90)} ; + stat = nc_put_att_float(ncid, NC_GLOBAL, "POLE_LAT", NC_FLOAT, 1, wrfbdy_d01_POLE_LAT_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float wrfbdy_d01_POLE_LON_att[1] = {((float)0)} ; + stat = nc_put_att_float(ncid, NC_GLOBAL, "POLE_LON", NC_FLOAT, 1, wrfbdy_d01_POLE_LON_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_MAP_PROJ_att[1] = {1} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "MAP_PROJ", NC_INT, 1, wrfbdy_d01_MAP_PROJ_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, NC_GLOBAL, "MAP_PROJ_CHAR", 17, "Lambert Conformal"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, NC_GLOBAL, "MMINLU", 24, "MODIFIED_IGBP_MODIS_NOAH"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_NUM_LAND_CAT_att[1] = {21} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "NUM_LAND_CAT", NC_INT, 1, wrfbdy_d01_NUM_LAND_CAT_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_ISWATER_att[1] = {17} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "ISWATER", NC_INT, 1, wrfbdy_d01_ISWATER_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_ISLAKE_att[1] = {21} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "ISLAKE", NC_INT, 1, wrfbdy_d01_ISLAKE_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_ISICE_att[1] = {15} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "ISICE", NC_INT, 1, wrfbdy_d01_ISICE_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_ISURBAN_att[1] = {13} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "ISURBAN", NC_INT, 1, wrfbdy_d01_ISURBAN_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_ISOILWATER_att[1] = {14} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "ISOILWATER", NC_INT, 1, wrfbdy_d01_ISOILWATER_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_HYBRID_OPT_att[1] = {2} ; + stat = nc_put_att_int(ncid, NC_GLOBAL, "HYBRID_OPT", NC_INT, 1, wrfbdy_d01_HYBRID_OPT_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float wrfbdy_d01_ETAC_att[1] = {((float)0.2)} ; + stat = nc_put_att_float(ncid, NC_GLOBAL, "ETAC", NC_FLOAT, 1, wrfbdy_d01_ETAC_att); + check_err(stat,__LINE__,__FILE__); + } + + + /* assign per-variable attributes */ + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, U_BXS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, U_BXS_id, "MemoryOrder", 3, "XSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, U_BXS_id, "description", 20, "bdy x-wind component"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, U_BXS_id, "units", 5, "m s-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, U_BXS_id, "stagger", 1, "X"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, U_BXE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, U_BXE_id, "MemoryOrder", 3, "XEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, U_BXE_id, "description", 20, "bdy x-wind component"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, U_BXE_id, "units", 5, "m s-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, U_BXE_id, "stagger", 1, "X"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, U_BYS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, U_BYS_id, "MemoryOrder", 3, "YSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, U_BYS_id, "description", 20, "bdy x-wind component"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, U_BYS_id, "units", 5, "m s-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, U_BYS_id, "stagger", 1, "X"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, U_BYE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, U_BYE_id, "MemoryOrder", 3, "YEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, U_BYE_id, "description", 20, "bdy x-wind component"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, U_BYE_id, "units", 5, "m s-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, U_BYE_id, "stagger", 1, "X"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, U_BTXS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, U_BTXS_id, "MemoryOrder", 3, "XSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, U_BTXS_id, "description", 25, "bdy tend x-wind component"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, U_BTXS_id, "units", 10, "(m s-1)/dt"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, U_BTXS_id, "stagger", 1, "X"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, U_BTXE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, U_BTXE_id, "MemoryOrder", 3, "XEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, U_BTXE_id, "description", 25, "bdy tend x-wind component"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, U_BTXE_id, "units", 10, "(m s-1)/dt"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, U_BTXE_id, "stagger", 1, "X"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, U_BTYS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, U_BTYS_id, "MemoryOrder", 3, "YSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, U_BTYS_id, "description", 25, "bdy tend x-wind component"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, U_BTYS_id, "units", 10, "(m s-1)/dt"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, U_BTYS_id, "stagger", 1, "X"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, U_BTYE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, U_BTYE_id, "MemoryOrder", 3, "YEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, U_BTYE_id, "description", 25, "bdy tend x-wind component"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, U_BTYE_id, "units", 10, "(m s-1)/dt"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, U_BTYE_id, "stagger", 1, "X"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, V_BXS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, V_BXS_id, "MemoryOrder", 3, "XSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, V_BXS_id, "description", 20, "bdy y-wind component"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, V_BXS_id, "units", 5, "m s-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, V_BXS_id, "stagger", 1, "Y"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, V_BXE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, V_BXE_id, "MemoryOrder", 3, "XEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, V_BXE_id, "description", 20, "bdy y-wind component"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, V_BXE_id, "units", 5, "m s-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, V_BXE_id, "stagger", 1, "Y"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, V_BYS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, V_BYS_id, "MemoryOrder", 3, "YSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, V_BYS_id, "description", 20, "bdy y-wind component"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, V_BYS_id, "units", 5, "m s-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, V_BYS_id, "stagger", 1, "Y"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, V_BYE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, V_BYE_id, "MemoryOrder", 3, "YEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, V_BYE_id, "description", 20, "bdy y-wind component"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, V_BYE_id, "units", 5, "m s-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, V_BYE_id, "stagger", 1, "Y"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, V_BTXS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, V_BTXS_id, "MemoryOrder", 3, "XSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, V_BTXS_id, "description", 25, "bdy tend y-wind component"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, V_BTXS_id, "units", 10, "(m s-1)/dt"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, V_BTXS_id, "stagger", 1, "Y"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, V_BTXE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, V_BTXE_id, "MemoryOrder", 3, "XEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, V_BTXE_id, "description", 25, "bdy tend y-wind component"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, V_BTXE_id, "units", 10, "(m s-1)/dt"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, V_BTXE_id, "stagger", 1, "Y"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, V_BTYS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, V_BTYS_id, "MemoryOrder", 3, "YSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, V_BTYS_id, "description", 25, "bdy tend y-wind component"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, V_BTYS_id, "units", 10, "(m s-1)/dt"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, V_BTYS_id, "stagger", 1, "Y"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, V_BTYE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, V_BTYE_id, "MemoryOrder", 3, "YEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, V_BTYE_id, "description", 25, "bdy tend y-wind component"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, V_BTYE_id, "units", 10, "(m s-1)/dt"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, V_BTYE_id, "stagger", 1, "Y"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, W_BXS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, W_BXS_id, "MemoryOrder", 3, "XSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, W_BXS_id, "description", 20, "bdy z-wind component"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, W_BXS_id, "units", 5, "m s-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, W_BXS_id, "stagger", 1, "Z"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, W_BXE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, W_BXE_id, "MemoryOrder", 3, "XEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, W_BXE_id, "description", 20, "bdy z-wind component"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, W_BXE_id, "units", 5, "m s-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, W_BXE_id, "stagger", 1, "Z"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, W_BYS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, W_BYS_id, "MemoryOrder", 3, "YSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, W_BYS_id, "description", 20, "bdy z-wind component"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, W_BYS_id, "units", 5, "m s-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, W_BYS_id, "stagger", 1, "Z"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, W_BYE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, W_BYE_id, "MemoryOrder", 3, "YEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, W_BYE_id, "description", 20, "bdy z-wind component"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, W_BYE_id, "units", 5, "m s-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, W_BYE_id, "stagger", 1, "Z"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, W_BTXS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, W_BTXS_id, "MemoryOrder", 3, "XSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, W_BTXS_id, "description", 25, "bdy tend z-wind component"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, W_BTXS_id, "units", 10, "(m s-1)/dt"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, W_BTXS_id, "stagger", 1, "Z"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, W_BTXE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, W_BTXE_id, "MemoryOrder", 3, "XEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, W_BTXE_id, "description", 25, "bdy tend z-wind component"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, W_BTXE_id, "units", 10, "(m s-1)/dt"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, W_BTXE_id, "stagger", 1, "Z"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, W_BTYS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, W_BTYS_id, "MemoryOrder", 3, "YSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, W_BTYS_id, "description", 25, "bdy tend z-wind component"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, W_BTYS_id, "units", 10, "(m s-1)/dt"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, W_BTYS_id, "stagger", 1, "Z"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, W_BTYE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, W_BTYE_id, "MemoryOrder", 3, "YEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, W_BTYE_id, "description", 25, "bdy tend z-wind component"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, W_BTYE_id, "units", 10, "(m s-1)/dt"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, W_BTYE_id, "stagger", 1, "Z"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, PH_BXS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PH_BXS_id, "MemoryOrder", 3, "XSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PH_BXS_id, "description", 29, "bdy perturbation geopotential"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PH_BXS_id, "units", 6, "m2 s-2"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PH_BXS_id, "stagger", 1, "Z"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, PH_BXE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PH_BXE_id, "MemoryOrder", 3, "XEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PH_BXE_id, "description", 29, "bdy perturbation geopotential"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PH_BXE_id, "units", 6, "m2 s-2"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PH_BXE_id, "stagger", 1, "Z"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, PH_BYS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PH_BYS_id, "MemoryOrder", 3, "YSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PH_BYS_id, "description", 29, "bdy perturbation geopotential"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PH_BYS_id, "units", 6, "m2 s-2"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PH_BYS_id, "stagger", 1, "Z"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, PH_BYE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PH_BYE_id, "MemoryOrder", 3, "YEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PH_BYE_id, "description", 29, "bdy perturbation geopotential"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PH_BYE_id, "units", 6, "m2 s-2"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PH_BYE_id, "stagger", 1, "Z"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, PH_BTXS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PH_BTXS_id, "MemoryOrder", 3, "XSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PH_BTXS_id, "description", 34, "bdy tend perturbation geopotential"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PH_BTXS_id, "units", 11, "(m2 s-2)/dt"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PH_BTXS_id, "stagger", 1, "Z"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, PH_BTXE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PH_BTXE_id, "MemoryOrder", 3, "XEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PH_BTXE_id, "description", 34, "bdy tend perturbation geopotential"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PH_BTXE_id, "units", 11, "(m2 s-2)/dt"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PH_BTXE_id, "stagger", 1, "Z"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, PH_BTYS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PH_BTYS_id, "MemoryOrder", 3, "YSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PH_BTYS_id, "description", 34, "bdy tend perturbation geopotential"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PH_BTYS_id, "units", 11, "(m2 s-2)/dt"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PH_BTYS_id, "stagger", 1, "Z"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, PH_BTYE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PH_BTYE_id, "MemoryOrder", 3, "YEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PH_BTYE_id, "description", 34, "bdy tend perturbation geopotential"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PH_BTYE_id, "units", 11, "(m2 s-2)/dt"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PH_BTYE_id, "stagger", 1, "Z"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, T_BXS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, T_BXS_id, "MemoryOrder", 3, "XSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, T_BXS_id, "description", 121, "bdy either 1) pert moist pot temp=(1+Rv/Rd Qv)*(theta)-T0, or 2) pert dry pot temp=theta-T0; based on use_theta_m setting"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, T_BXS_id, "units", 1, "K"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, T_BXS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, T_BXE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, T_BXE_id, "MemoryOrder", 3, "XEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, T_BXE_id, "description", 121, "bdy either 1) pert moist pot temp=(1+Rv/Rd Qv)*(theta)-T0, or 2) pert dry pot temp=theta-T0; based on use_theta_m setting"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, T_BXE_id, "units", 1, "K"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, T_BXE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, T_BYS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, T_BYS_id, "MemoryOrder", 3, "YSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, T_BYS_id, "description", 121, "bdy either 1) pert moist pot temp=(1+Rv/Rd Qv)*(theta)-T0, or 2) pert dry pot temp=theta-T0; based on use_theta_m setting"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, T_BYS_id, "units", 1, "K"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, T_BYS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, T_BYE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, T_BYE_id, "MemoryOrder", 3, "YEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, T_BYE_id, "description", 121, "bdy either 1) pert moist pot temp=(1+Rv/Rd Qv)*(theta)-T0, or 2) pert dry pot temp=theta-T0; based on use_theta_m setting"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, T_BYE_id, "units", 1, "K"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, T_BYE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, T_BTXS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, T_BTXS_id, "MemoryOrder", 3, "XSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, T_BTXS_id, "description", 126, "bdy tend either 1) pert moist pot temp=(1+Rv/Rd Qv)*(theta)-T0, or 2) pert dry pot temp=theta-T0; based on use_theta_m setting"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, T_BTXS_id, "units", 6, "(K)/dt"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, T_BTXS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, T_BTXE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, T_BTXE_id, "MemoryOrder", 3, "XEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, T_BTXE_id, "description", 126, "bdy tend either 1) pert moist pot temp=(1+Rv/Rd Qv)*(theta)-T0, or 2) pert dry pot temp=theta-T0; based on use_theta_m setting"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, T_BTXE_id, "units", 6, "(K)/dt"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, T_BTXE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, T_BTYS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, T_BTYS_id, "MemoryOrder", 3, "YSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, T_BTYS_id, "description", 126, "bdy tend either 1) pert moist pot temp=(1+Rv/Rd Qv)*(theta)-T0, or 2) pert dry pot temp=theta-T0; based on use_theta_m setting"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, T_BTYS_id, "units", 6, "(K)/dt"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, T_BTYS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, T_BTYE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, T_BTYE_id, "MemoryOrder", 3, "YEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, T_BTYE_id, "description", 126, "bdy tend either 1) pert moist pot temp=(1+Rv/Rd Qv)*(theta)-T0, or 2) pert dry pot temp=theta-T0; based on use_theta_m setting"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, T_BTYE_id, "units", 6, "(K)/dt"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, T_BTYE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, MU_BXS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, MU_BXS_id, "MemoryOrder", 3, "XS "); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, MU_BXS_id, "description", 39, "bdy perturbation dry air mass in column"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, MU_BXS_id, "units", 2, "Pa"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, MU_BXS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, MU_BXE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, MU_BXE_id, "MemoryOrder", 3, "XE "); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, MU_BXE_id, "description", 39, "bdy perturbation dry air mass in column"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, MU_BXE_id, "units", 2, "Pa"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, MU_BXE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, MU_BYS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, MU_BYS_id, "MemoryOrder", 3, "YS "); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, MU_BYS_id, "description", 39, "bdy perturbation dry air mass in column"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, MU_BYS_id, "units", 2, "Pa"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, MU_BYS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, MU_BYE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, MU_BYE_id, "MemoryOrder", 3, "YE "); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, MU_BYE_id, "description", 39, "bdy perturbation dry air mass in column"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, MU_BYE_id, "units", 2, "Pa"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, MU_BYE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, MU_BTXS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, MU_BTXS_id, "MemoryOrder", 3, "XS "); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, MU_BTXS_id, "description", 44, "bdy tend perturbation dry air mass in column"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, MU_BTXS_id, "units", 7, "(Pa)/dt"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, MU_BTXS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, MU_BTXE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, MU_BTXE_id, "MemoryOrder", 3, "XE "); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, MU_BTXE_id, "description", 44, "bdy tend perturbation dry air mass in column"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, MU_BTXE_id, "units", 7, "(Pa)/dt"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, MU_BTXE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, MU_BTYS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, MU_BTYS_id, "MemoryOrder", 3, "YS "); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, MU_BTYS_id, "description", 44, "bdy tend perturbation dry air mass in column"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, MU_BTYS_id, "units", 7, "(Pa)/dt"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, MU_BTYS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, MU_BTYE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, MU_BTYE_id, "MemoryOrder", 3, "YE "); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, MU_BTYE_id, "description", 44, "bdy tend perturbation dry air mass in column"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, MU_BTYE_id, "units", 7, "(Pa)/dt"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, MU_BTYE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QVAPOR_BXS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QVAPOR_BXS_id, "MemoryOrder", 3, "XSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QVAPOR_BXS_id, "description", 24, "Water vapor mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QVAPOR_BXS_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QVAPOR_BXS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QVAPOR_BXE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QVAPOR_BXE_id, "MemoryOrder", 3, "XEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QVAPOR_BXE_id, "description", 24, "Water vapor mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QVAPOR_BXE_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QVAPOR_BXE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QVAPOR_BYS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QVAPOR_BYS_id, "MemoryOrder", 3, "YSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QVAPOR_BYS_id, "description", 24, "Water vapor mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QVAPOR_BYS_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QVAPOR_BYS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QVAPOR_BYE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QVAPOR_BYE_id, "MemoryOrder", 3, "YEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QVAPOR_BYE_id, "description", 24, "Water vapor mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QVAPOR_BYE_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QVAPOR_BYE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QCLOUD_BXS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QCLOUD_BXS_id, "MemoryOrder", 3, "XSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QCLOUD_BXS_id, "description", 24, "Cloud water mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QCLOUD_BXS_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QCLOUD_BXS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QCLOUD_BXE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QCLOUD_BXE_id, "MemoryOrder", 3, "XEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QCLOUD_BXE_id, "description", 24, "Cloud water mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QCLOUD_BXE_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QCLOUD_BXE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QCLOUD_BYS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QCLOUD_BYS_id, "MemoryOrder", 3, "YSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QCLOUD_BYS_id, "description", 24, "Cloud water mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QCLOUD_BYS_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QCLOUD_BYS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QCLOUD_BYE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QCLOUD_BYE_id, "MemoryOrder", 3, "YEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QCLOUD_BYE_id, "description", 24, "Cloud water mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QCLOUD_BYE_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QCLOUD_BYE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QRAIN_BXS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QRAIN_BXS_id, "MemoryOrder", 3, "XSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QRAIN_BXS_id, "description", 23, "Rain water mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QRAIN_BXS_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QRAIN_BXS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QRAIN_BXE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QRAIN_BXE_id, "MemoryOrder", 3, "XEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QRAIN_BXE_id, "description", 23, "Rain water mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QRAIN_BXE_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QRAIN_BXE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QRAIN_BYS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QRAIN_BYS_id, "MemoryOrder", 3, "YSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QRAIN_BYS_id, "description", 23, "Rain water mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QRAIN_BYS_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QRAIN_BYS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QRAIN_BYE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QRAIN_BYE_id, "MemoryOrder", 3, "YEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QRAIN_BYE_id, "description", 23, "Rain water mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QRAIN_BYE_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QRAIN_BYE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QICE_BXS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QICE_BXS_id, "MemoryOrder", 3, "XSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QICE_BXS_id, "description", 16, "Ice mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QICE_BXS_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QICE_BXS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QICE_BXE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QICE_BXE_id, "MemoryOrder", 3, "XEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QICE_BXE_id, "description", 16, "Ice mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QICE_BXE_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QICE_BXE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QICE_BYS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QICE_BYS_id, "MemoryOrder", 3, "YSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QICE_BYS_id, "description", 16, "Ice mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QICE_BYS_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QICE_BYS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QICE_BYE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QICE_BYE_id, "MemoryOrder", 3, "YEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QICE_BYE_id, "description", 16, "Ice mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QICE_BYE_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QICE_BYE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QSNOW_BXS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QSNOW_BXS_id, "MemoryOrder", 3, "XSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QSNOW_BXS_id, "description", 17, "Snow mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QSNOW_BXS_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QSNOW_BXS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QSNOW_BXE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QSNOW_BXE_id, "MemoryOrder", 3, "XEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QSNOW_BXE_id, "description", 17, "Snow mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QSNOW_BXE_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QSNOW_BXE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QSNOW_BYS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QSNOW_BYS_id, "MemoryOrder", 3, "YSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QSNOW_BYS_id, "description", 17, "Snow mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QSNOW_BYS_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QSNOW_BYS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QSNOW_BYE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QSNOW_BYE_id, "MemoryOrder", 3, "YEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QSNOW_BYE_id, "description", 17, "Snow mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QSNOW_BYE_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QSNOW_BYE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QGRAUP_BXS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QGRAUP_BXS_id, "MemoryOrder", 3, "XSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QGRAUP_BXS_id, "description", 20, "Graupel mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QGRAUP_BXS_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QGRAUP_BXS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QGRAUP_BXE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QGRAUP_BXE_id, "MemoryOrder", 3, "XEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QGRAUP_BXE_id, "description", 20, "Graupel mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QGRAUP_BXE_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QGRAUP_BXE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QGRAUP_BYS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QGRAUP_BYS_id, "MemoryOrder", 3, "YSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QGRAUP_BYS_id, "description", 20, "Graupel mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QGRAUP_BYS_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QGRAUP_BYS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QGRAUP_BYE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QGRAUP_BYE_id, "MemoryOrder", 3, "YEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QGRAUP_BYE_id, "description", 20, "Graupel mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QGRAUP_BYE_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QGRAUP_BYE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QVAPOR_BTXS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QVAPOR_BTXS_id, "MemoryOrder", 3, "XSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QVAPOR_BTXS_id, "description", 24, "Water vapor mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QVAPOR_BTXS_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QVAPOR_BTXS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QVAPOR_BTXE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QVAPOR_BTXE_id, "MemoryOrder", 3, "XEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QVAPOR_BTXE_id, "description", 24, "Water vapor mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QVAPOR_BTXE_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QVAPOR_BTXE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QVAPOR_BTYS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QVAPOR_BTYS_id, "MemoryOrder", 3, "YSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QVAPOR_BTYS_id, "description", 24, "Water vapor mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QVAPOR_BTYS_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QVAPOR_BTYS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QVAPOR_BTYE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QVAPOR_BTYE_id, "MemoryOrder", 3, "YEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QVAPOR_BTYE_id, "description", 24, "Water vapor mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QVAPOR_BTYE_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QVAPOR_BTYE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QCLOUD_BTXS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QCLOUD_BTXS_id, "MemoryOrder", 3, "XSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QCLOUD_BTXS_id, "description", 24, "Cloud water mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QCLOUD_BTXS_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QCLOUD_BTXS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QCLOUD_BTXE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QCLOUD_BTXE_id, "MemoryOrder", 3, "XEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QCLOUD_BTXE_id, "description", 24, "Cloud water mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QCLOUD_BTXE_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QCLOUD_BTXE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QCLOUD_BTYS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QCLOUD_BTYS_id, "MemoryOrder", 3, "YSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QCLOUD_BTYS_id, "description", 24, "Cloud water mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QCLOUD_BTYS_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QCLOUD_BTYS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QCLOUD_BTYE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QCLOUD_BTYE_id, "MemoryOrder", 3, "YEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QCLOUD_BTYE_id, "description", 24, "Cloud water mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QCLOUD_BTYE_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QCLOUD_BTYE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QRAIN_BTXS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QRAIN_BTXS_id, "MemoryOrder", 3, "XSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QRAIN_BTXS_id, "description", 23, "Rain water mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QRAIN_BTXS_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QRAIN_BTXS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QRAIN_BTXE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QRAIN_BTXE_id, "MemoryOrder", 3, "XEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QRAIN_BTXE_id, "description", 23, "Rain water mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QRAIN_BTXE_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QRAIN_BTXE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QRAIN_BTYS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QRAIN_BTYS_id, "MemoryOrder", 3, "YSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QRAIN_BTYS_id, "description", 23, "Rain water mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QRAIN_BTYS_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QRAIN_BTYS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QRAIN_BTYE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QRAIN_BTYE_id, "MemoryOrder", 3, "YEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QRAIN_BTYE_id, "description", 23, "Rain water mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QRAIN_BTYE_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QRAIN_BTYE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QICE_BTXS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QICE_BTXS_id, "MemoryOrder", 3, "XSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QICE_BTXS_id, "description", 16, "Ice mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QICE_BTXS_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QICE_BTXS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QICE_BTXE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QICE_BTXE_id, "MemoryOrder", 3, "XEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QICE_BTXE_id, "description", 16, "Ice mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QICE_BTXE_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QICE_BTXE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QICE_BTYS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QICE_BTYS_id, "MemoryOrder", 3, "YSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QICE_BTYS_id, "description", 16, "Ice mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QICE_BTYS_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QICE_BTYS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QICE_BTYE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QICE_BTYE_id, "MemoryOrder", 3, "YEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QICE_BTYE_id, "description", 16, "Ice mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QICE_BTYE_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QICE_BTYE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QSNOW_BTXS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QSNOW_BTXS_id, "MemoryOrder", 3, "XSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QSNOW_BTXS_id, "description", 17, "Snow mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QSNOW_BTXS_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QSNOW_BTXS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QSNOW_BTXE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QSNOW_BTXE_id, "MemoryOrder", 3, "XEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QSNOW_BTXE_id, "description", 17, "Snow mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QSNOW_BTXE_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QSNOW_BTXE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QSNOW_BTYS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QSNOW_BTYS_id, "MemoryOrder", 3, "YSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QSNOW_BTYS_id, "description", 17, "Snow mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QSNOW_BTYS_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QSNOW_BTYS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QSNOW_BTYE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QSNOW_BTYE_id, "MemoryOrder", 3, "YEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QSNOW_BTYE_id, "description", 17, "Snow mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QSNOW_BTYE_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QSNOW_BTYE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QGRAUP_BTXS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QGRAUP_BTXS_id, "MemoryOrder", 3, "XSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QGRAUP_BTXS_id, "description", 20, "Graupel mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QGRAUP_BTXS_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QGRAUP_BTXS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QGRAUP_BTXE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QGRAUP_BTXE_id, "MemoryOrder", 3, "XEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QGRAUP_BTXE_id, "description", 20, "Graupel mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QGRAUP_BTXE_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QGRAUP_BTXE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QGRAUP_BTYS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QGRAUP_BTYS_id, "MemoryOrder", 3, "YSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QGRAUP_BTYS_id, "description", 20, "Graupel mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QGRAUP_BTYS_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QGRAUP_BTYS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QGRAUP_BTYE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QGRAUP_BTYE_id, "MemoryOrder", 3, "YEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QGRAUP_BTYE_id, "description", 20, "Graupel mixing ratio"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QGRAUP_BTYE_id, "units", 7, "kg kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QGRAUP_BTYE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QNICE_BXS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNICE_BXS_id, "MemoryOrder", 3, "XSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNICE_BXS_id, "description", 24, "Ice Number concentration"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNICE_BXS_id, "units", 6, " kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNICE_BXS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QNICE_BXE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNICE_BXE_id, "MemoryOrder", 3, "XEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNICE_BXE_id, "description", 24, "Ice Number concentration"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNICE_BXE_id, "units", 6, " kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNICE_BXE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QNICE_BYS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNICE_BYS_id, "MemoryOrder", 3, "YSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNICE_BYS_id, "description", 24, "Ice Number concentration"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNICE_BYS_id, "units", 6, " kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNICE_BYS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QNICE_BYE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNICE_BYE_id, "MemoryOrder", 3, "YEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNICE_BYE_id, "description", 24, "Ice Number concentration"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNICE_BYE_id, "units", 6, " kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNICE_BYE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QNRAIN_BXS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNRAIN_BXS_id, "MemoryOrder", 3, "XSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNRAIN_BXS_id, "description", 25, "Rain Number concentration"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNRAIN_BXS_id, "units", 8, " kg(-1)"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNRAIN_BXS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QNRAIN_BXE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNRAIN_BXE_id, "MemoryOrder", 3, "XEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNRAIN_BXE_id, "description", 25, "Rain Number concentration"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNRAIN_BXE_id, "units", 8, " kg(-1)"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNRAIN_BXE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QNRAIN_BYS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNRAIN_BYS_id, "MemoryOrder", 3, "YSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNRAIN_BYS_id, "description", 25, "Rain Number concentration"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNRAIN_BYS_id, "units", 8, " kg(-1)"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNRAIN_BYS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QNRAIN_BYE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNRAIN_BYE_id, "MemoryOrder", 3, "YEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNRAIN_BYE_id, "description", 25, "Rain Number concentration"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNRAIN_BYE_id, "units", 8, " kg(-1)"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNRAIN_BYE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QNICE_BTXS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNICE_BTXS_id, "MemoryOrder", 3, "XSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNICE_BTXS_id, "description", 24, "Ice Number concentration"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNICE_BTXS_id, "units", 6, " kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNICE_BTXS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QNICE_BTXE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNICE_BTXE_id, "MemoryOrder", 3, "XEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNICE_BTXE_id, "description", 24, "Ice Number concentration"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNICE_BTXE_id, "units", 6, " kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNICE_BTXE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QNICE_BTYS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNICE_BTYS_id, "MemoryOrder", 3, "YSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNICE_BTYS_id, "description", 24, "Ice Number concentration"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNICE_BTYS_id, "units", 6, " kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNICE_BTYS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QNICE_BTYE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNICE_BTYE_id, "MemoryOrder", 3, "YEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNICE_BTYE_id, "description", 24, "Ice Number concentration"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNICE_BTYE_id, "units", 6, " kg-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNICE_BTYE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QNRAIN_BTXS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNRAIN_BTXS_id, "MemoryOrder", 3, "XSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNRAIN_BTXS_id, "description", 25, "Rain Number concentration"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNRAIN_BTXS_id, "units", 8, " kg(-1)"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNRAIN_BTXS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QNRAIN_BTXE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNRAIN_BTXE_id, "MemoryOrder", 3, "XEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNRAIN_BTXE_id, "description", 25, "Rain Number concentration"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNRAIN_BTXE_id, "units", 8, " kg(-1)"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNRAIN_BTXE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QNRAIN_BTYS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNRAIN_BTYS_id, "MemoryOrder", 3, "YSZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNRAIN_BTYS_id, "description", 25, "Rain Number concentration"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNRAIN_BTYS_id, "units", 8, " kg(-1)"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNRAIN_BTYS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, QNRAIN_BTYE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNRAIN_BTYE_id, "MemoryOrder", 3, "YEZ"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNRAIN_BTYE_id, "description", 25, "Rain Number concentration"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNRAIN_BTYE_id, "units", 8, " kg(-1)"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, QNRAIN_BTYE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, HT_SHAD_BXS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, HT_SHAD_BXS_id, "MemoryOrder", 3, "XS "); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, HT_SHAD_BXS_id, "description", 31, "bdy Height of orographic shadow"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, HT_SHAD_BXS_id, "units", 1, "m"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, HT_SHAD_BXS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, HT_SHAD_BXE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, HT_SHAD_BXE_id, "MemoryOrder", 3, "XE "); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, HT_SHAD_BXE_id, "description", 31, "bdy Height of orographic shadow"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, HT_SHAD_BXE_id, "units", 1, "m"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, HT_SHAD_BXE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, HT_SHAD_BYS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, HT_SHAD_BYS_id, "MemoryOrder", 3, "YS "); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, HT_SHAD_BYS_id, "description", 31, "bdy Height of orographic shadow"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, HT_SHAD_BYS_id, "units", 1, "m"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, HT_SHAD_BYS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, HT_SHAD_BYE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, HT_SHAD_BYE_id, "MemoryOrder", 3, "YE "); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, HT_SHAD_BYE_id, "description", 31, "bdy Height of orographic shadow"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, HT_SHAD_BYE_id, "units", 1, "m"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, HT_SHAD_BYE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, HT_SHAD_BTXS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, HT_SHAD_BTXS_id, "MemoryOrder", 3, "XS "); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, HT_SHAD_BTXS_id, "description", 36, "bdy tend Height of orographic shadow"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, HT_SHAD_BTXS_id, "units", 6, "(m)/dt"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, HT_SHAD_BTXS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, HT_SHAD_BTXE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, HT_SHAD_BTXE_id, "MemoryOrder", 3, "XE "); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, HT_SHAD_BTXE_id, "description", 36, "bdy tend Height of orographic shadow"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, HT_SHAD_BTXE_id, "units", 6, "(m)/dt"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, HT_SHAD_BTXE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, HT_SHAD_BTYS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, HT_SHAD_BTYS_id, "MemoryOrder", 3, "YS "); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, HT_SHAD_BTYS_id, "description", 36, "bdy tend Height of orographic shadow"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, HT_SHAD_BTYS_id, "units", 6, "(m)/dt"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, HT_SHAD_BTYS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, HT_SHAD_BTYE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, HT_SHAD_BTYE_id, "MemoryOrder", 3, "YE "); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, HT_SHAD_BTYE_id, "description", 36, "bdy tend Height of orographic shadow"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, HT_SHAD_BTYE_id, "units", 6, "(m)/dt"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, HT_SHAD_BTYE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, PC_BXS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PC_BXS_id, "MemoryOrder", 3, "XS "); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PC_BXS_id, "description", 39, "bdy perturbation dry air mass in column"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PC_BXS_id, "units", 2, "Pa"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PC_BXS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, PC_BXE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PC_BXE_id, "MemoryOrder", 3, "XE "); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PC_BXE_id, "description", 39, "bdy perturbation dry air mass in column"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PC_BXE_id, "units", 2, "Pa"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PC_BXE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, PC_BYS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PC_BYS_id, "MemoryOrder", 3, "YS "); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PC_BYS_id, "description", 39, "bdy perturbation dry air mass in column"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PC_BYS_id, "units", 2, "Pa"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PC_BYS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, PC_BYE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PC_BYE_id, "MemoryOrder", 3, "YE "); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PC_BYE_id, "description", 39, "bdy perturbation dry air mass in column"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PC_BYE_id, "units", 2, "Pa"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PC_BYE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, PC_BTXS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PC_BTXS_id, "MemoryOrder", 3, "XS "); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PC_BTXS_id, "description", 44, "bdy tend perturbation dry air mass in column"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PC_BTXS_id, "units", 7, "(Pa)/dt"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PC_BTXS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, PC_BTXE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PC_BTXE_id, "MemoryOrder", 3, "XE "); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PC_BTXE_id, "description", 44, "bdy tend perturbation dry air mass in column"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PC_BTXE_id, "units", 7, "(Pa)/dt"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PC_BTXE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, PC_BTYS_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PC_BTYS_id, "MemoryOrder", 3, "YS "); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PC_BTYS_id, "description", 44, "bdy tend perturbation dry air mass in column"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PC_BTYS_id, "units", 7, "(Pa)/dt"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PC_BTYS_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int wrfbdy_d01_FieldType_att[1] = {104} ; + stat = nc_put_att_int(ncid, PC_BTYE_id, "FieldType", NC_INT, 1, wrfbdy_d01_FieldType_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PC_BTYE_id, "MemoryOrder", 3, "YE "); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PC_BTYE_id, "description", 44, "bdy tend perturbation dry air mass in column"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PC_BTYE_id, "units", 7, "(Pa)/dt"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(ncid, PC_BTYE_id, "stagger", 1, ""); + check_err(stat,__LINE__,__FILE__); + } + + + /* leave define mode */ + stat = nc_enddef (ncid); + check_err(stat,__LINE__,__FILE__); + + /* assign variable data */ + + stat = nc_close(ncid); + check_err(stat,__LINE__,__FILE__); + + return 0; +} + +static size_t BASEFLOW_chunksizes[3] = {1, 91, 144} ; +static size_t ECHANGE_chunksizes[3] = {1, 91, 144} ; +static size_t EVLAND_chunksizes[3] = {1, 91, 144} ; +static size_t EVPINTR_chunksizes[3] = {1, 91, 144} ; +static size_t EVPSBLN_chunksizes[3] = {1, 91, 144} ; +static size_t EVPSOIL_chunksizes[3] = {1, 91, 144} ; +static size_t EVPTRNS_chunksizes[3] = {1, 91, 144} ; +static size_t FRSAT_chunksizes[3] = {1, 91, 144} ; +static size_t FRSNO_chunksizes[3] = {1, 91, 144} ; +static size_t FRUNST_chunksizes[3] = {1, 91, 144} ; +static size_t FRWLT_chunksizes[3] = {1, 91, 144} ; +static size_t GHLAND_chunksizes[3] = {1, 91, 144} ; +static size_t GRN_chunksizes[3] = {1, 91, 144} ; +static size_t GWETPROF_chunksizes[3] = {1, 91, 144} ; +static size_t GWETROOT_chunksizes[3] = {1, 91, 144} ; +static size_t GWETTOP_chunksizes[3] = {1, 91, 144} ; +static size_t LAI_chunksizes[3] = {1, 91, 144} ; +static size_t LHLAND_chunksizes[3] = {1, 91, 144} ; +static size_t LWLAND_chunksizes[3] = {1, 91, 144} ; +static size_t PARDFLAND_chunksizes[3] = {1, 91, 144} ; +static size_t PARDRLAND_chunksizes[3] = {1, 91, 144} ; +static size_t PRECSNOLAND_chunksizes[3] = {1, 91, 144} ; +static size_t PRECTOTLAND_chunksizes[3] = {1, 91, 144} ; +static size_t PRMC_chunksizes[3] = {1, 91, 144} ; +static size_t QINFIL_chunksizes[3] = {1, 91, 144} ; +static size_t RUNOFF_chunksizes[3] = {1, 91, 144} ; +static size_t RZMC_chunksizes[3] = {1, 91, 144} ; +static size_t SFMC_chunksizes[3] = {1, 91, 144} ; +static size_t SHLAND_chunksizes[3] = {1, 91, 144} ; +static size_t SMLAND_chunksizes[3] = {1, 91, 144} ; +static size_t SNODP_chunksizes[3] = {1, 91, 144} ; +static size_t SNOMAS_chunksizes[3] = {1, 91, 144} ; +static size_t SPLAND_chunksizes[3] = {1, 91, 144} ; +static size_t SPSNOW_chunksizes[3] = {1, 91, 144} ; +static size_t SPWATR_chunksizes[3] = {1, 91, 144} ; +static size_t SWLAND_chunksizes[3] = {1, 91, 144} ; +static size_t TELAND_chunksizes[3] = {1, 91, 144} ; +static size_t TPSNOW_chunksizes[3] = {1, 91, 144} ; +static size_t TSAT_chunksizes[3] = {1, 91, 144} ; +static size_t TSOIL1_chunksizes[3] = {1, 91, 144} ; +static size_t TSOIL2_chunksizes[3] = {1, 91, 144} ; +static size_t TSOIL3_chunksizes[3] = {1, 91, 144} ; +static size_t TSOIL4_chunksizes[3] = {1, 91, 144} ; +static size_t TSOIL5_chunksizes[3] = {1, 91, 144} ; +static size_t TSOIL6_chunksizes[3] = {1, 91, 144} ; +static size_t TSURF_chunksizes[3] = {1, 91, 144} ; +static size_t TUNST_chunksizes[3] = {1, 91, 144} ; +static size_t TWLAND_chunksizes[3] = {1, 91, 144} ; +static size_t TWLT_chunksizes[3] = {1, 91, 144} ; +static size_t WCHANGE_chunksizes[3] = {1, 91, 144} ; +static size_t time_chunksizes[1] = {1} ; + +int +create_merr_file(char *file_name, int cmode) {/* create MERR.nc4.ncdumphs.nc */ + + int stat; /* return status */ + int ncid; /* netCDF id */ + + /* group ids */ + int MERR_grp; + + /* dimension ids */ + int time_dim; + int lat_dim; + int lon_dim; + + /* dimension lengths */ + size_t time_len = NC_UNLIMITED; + size_t lat_len = 361; + size_t lon_len = 576; + + /* variable ids */ + int BASEFLOW_id; + int ECHANGE_id; + int EVLAND_id; + int EVPINTR_id; + int EVPSBLN_id; + int EVPSOIL_id; + int EVPTRNS_id; + int FRSAT_id; + int FRSNO_id; + int FRUNST_id; + int FRWLT_id; + int GHLAND_id; + int GRN_id; + int GWETPROF_id; + int GWETROOT_id; + int GWETTOP_id; + int LAI_id; + int LHLAND_id; + int LWLAND_id; + int PARDFLAND_id; + int PARDRLAND_id; + int PRECSNOLAND_id; + int PRECTOTLAND_id; + int PRMC_id; + int QINFIL_id; + int RUNOFF_id; + int RZMC_id; + int SFMC_id; + int SHLAND_id; + int SMLAND_id; + int SNODP_id; + int SNOMAS_id; + int SPLAND_id; + int SPSNOW_id; + int SPWATR_id; + int SWLAND_id; + int TELAND_id; + int TPSNOW_id; + int TSAT_id; + int TSOIL1_id; + int TSOIL2_id; + int TSOIL3_id; + int TSOIL4_id; + int TSOIL5_id; + int TSOIL6_id; + int TSURF_id; + int TUNST_id; + int TWLAND_id; + int TWLT_id; + int WCHANGE_id; + int lat_id; + int lon_id; + int time_id; + + /* rank (number of dimensions) for each variable */ +# define RANK_BASEFLOW 3 +# define RANK_ECHANGE 3 +# define RANK_EVLAND 3 +# define RANK_EVPINTR 3 +# define RANK_EVPSBLN 3 +# define RANK_EVPSOIL 3 +# define RANK_EVPTRNS 3 +# define RANK_FRSAT 3 +# define RANK_FRSNO 3 +# define RANK_FRUNST 3 +# define RANK_FRWLT 3 +# define RANK_GHLAND 3 +# define RANK_GRN 3 +# define RANK_GWETPROF 3 +# define RANK_GWETROOT 3 +# define RANK_GWETTOP 3 +# define RANK_LAI 3 +# define RANK_LHLAND 3 +# define RANK_LWLAND 3 +# define RANK_PARDFLAND 3 +# define RANK_PARDRLAND 3 +# define RANK_PRECSNOLAND 3 +# define RANK_PRECTOTLAND 3 +# define RANK_PRMC 3 +# define RANK_QINFIL 3 +# define RANK_RUNOFF 3 +# define RANK_RZMC 3 +# define RANK_SFMC 3 +# define RANK_SHLAND 3 +# define RANK_SMLAND 3 +# define RANK_SNODP 3 +# define RANK_SNOMAS 3 +# define RANK_SPLAND 3 +# define RANK_SPSNOW 3 +# define RANK_SPWATR 3 +# define RANK_SWLAND 3 +# define RANK_TELAND 3 +# define RANK_TPSNOW 3 +# define RANK_TSAT 3 +# define RANK_TSOIL1 3 +# define RANK_TSOIL2 3 +# define RANK_TSOIL3 3 +# define RANK_TSOIL4 3 +# define RANK_TSOIL5 3 +# define RANK_TSOIL6 3 +# define RANK_TSURF 3 +# define RANK_TUNST 3 +# define RANK_TWLAND 3 +# define RANK_TWLT 3 +# define RANK_WCHANGE 3 +# define RANK_lat 1 +# define RANK_lon 1 +# define RANK_time 1 + + /* variable shapes */ + int BASEFLOW_dims[RANK_BASEFLOW]; + int ECHANGE_dims[RANK_ECHANGE]; + int EVLAND_dims[RANK_EVLAND]; + int EVPINTR_dims[RANK_EVPINTR]; + int EVPSBLN_dims[RANK_EVPSBLN]; + int EVPSOIL_dims[RANK_EVPSOIL]; + int EVPTRNS_dims[RANK_EVPTRNS]; + int FRSAT_dims[RANK_FRSAT]; + int FRSNO_dims[RANK_FRSNO]; + int FRUNST_dims[RANK_FRUNST]; + int FRWLT_dims[RANK_FRWLT]; + int GHLAND_dims[RANK_GHLAND]; + int GRN_dims[RANK_GRN]; + int GWETPROF_dims[RANK_GWETPROF]; + int GWETROOT_dims[RANK_GWETROOT]; + int GWETTOP_dims[RANK_GWETTOP]; + int LAI_dims[RANK_LAI]; + int LHLAND_dims[RANK_LHLAND]; + int LWLAND_dims[RANK_LWLAND]; + int PARDFLAND_dims[RANK_PARDFLAND]; + int PARDRLAND_dims[RANK_PARDRLAND]; + int PRECSNOLAND_dims[RANK_PRECSNOLAND]; + int PRECTOTLAND_dims[RANK_PRECTOTLAND]; + int PRMC_dims[RANK_PRMC]; + int QINFIL_dims[RANK_QINFIL]; + int RUNOFF_dims[RANK_RUNOFF]; + int RZMC_dims[RANK_RZMC]; + int SFMC_dims[RANK_SFMC]; + int SHLAND_dims[RANK_SHLAND]; + int SMLAND_dims[RANK_SMLAND]; + int SNODP_dims[RANK_SNODP]; + int SNOMAS_dims[RANK_SNOMAS]; + int SPLAND_dims[RANK_SPLAND]; + int SPSNOW_dims[RANK_SPSNOW]; + int SPWATR_dims[RANK_SPWATR]; + int SWLAND_dims[RANK_SWLAND]; + int TELAND_dims[RANK_TELAND]; + int TPSNOW_dims[RANK_TPSNOW]; + int TSAT_dims[RANK_TSAT]; + int TSOIL1_dims[RANK_TSOIL1]; + int TSOIL2_dims[RANK_TSOIL2]; + int TSOIL3_dims[RANK_TSOIL3]; + int TSOIL4_dims[RANK_TSOIL4]; + int TSOIL5_dims[RANK_TSOIL5]; + int TSOIL6_dims[RANK_TSOIL6]; + int TSURF_dims[RANK_TSURF]; + int TUNST_dims[RANK_TUNST]; + int TWLAND_dims[RANK_TWLAND]; + int TWLT_dims[RANK_TWLT]; + int WCHANGE_dims[RANK_WCHANGE]; + int lat_dims[RANK_lat]; + int lon_dims[RANK_lon]; + int time_dims[RANK_time]; + + /* enter define mode */ + stat = nc_create(file_name, NC_CLOBBER|cmode, &ncid); + check_err(stat,__LINE__,__FILE__); + /* stat = nc_put_att_text(ncid, NC_GLOBAL, "_Format", 1, "netCDF-4"); */ + /* check_err(stat,__LINE__,__FILE__); */ + MERR_grp = ncid; + + /* define dimensions */ + stat = nc_def_dim(MERR_grp, "time", time_len, &time_dim); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_dim(MERR_grp, "lat", lat_len, &lat_dim); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_dim(MERR_grp, "lon", lon_len, &lon_dim); + check_err(stat,__LINE__,__FILE__); + + /* define variables */ + + BASEFLOW_dims[0] = time_dim; + BASEFLOW_dims[1] = lat_dim; + BASEFLOW_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "BASEFLOW", NC_FLOAT, RANK_BASEFLOW, BASEFLOW_dims, &BASEFLOW_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, BASEFLOW_id, NC_CHUNKED, BASEFLOW_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, BASEFLOW_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, BASEFLOW_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + ECHANGE_dims[0] = time_dim; + ECHANGE_dims[1] = lat_dim; + ECHANGE_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "ECHANGE", NC_FLOAT, RANK_ECHANGE, ECHANGE_dims, &ECHANGE_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, ECHANGE_id, NC_CHUNKED, ECHANGE_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, ECHANGE_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, ECHANGE_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + EVLAND_dims[0] = time_dim; + EVLAND_dims[1] = lat_dim; + EVLAND_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "EVLAND", NC_FLOAT, RANK_EVLAND, EVLAND_dims, &EVLAND_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, EVLAND_id, NC_CHUNKED, EVLAND_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, EVLAND_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, EVLAND_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + EVPINTR_dims[0] = time_dim; + EVPINTR_dims[1] = lat_dim; + EVPINTR_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "EVPINTR", NC_FLOAT, RANK_EVPINTR, EVPINTR_dims, &EVPINTR_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, EVPINTR_id, NC_CHUNKED, EVPINTR_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, EVPINTR_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, EVPINTR_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + EVPSBLN_dims[0] = time_dim; + EVPSBLN_dims[1] = lat_dim; + EVPSBLN_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "EVPSBLN", NC_FLOAT, RANK_EVPSBLN, EVPSBLN_dims, &EVPSBLN_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, EVPSBLN_id, NC_CHUNKED, EVPSBLN_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, EVPSBLN_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, EVPSBLN_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + EVPSOIL_dims[0] = time_dim; + EVPSOIL_dims[1] = lat_dim; + EVPSOIL_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "EVPSOIL", NC_FLOAT, RANK_EVPSOIL, EVPSOIL_dims, &EVPSOIL_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, EVPSOIL_id, NC_CHUNKED, EVPSOIL_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, EVPSOIL_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, EVPSOIL_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + EVPTRNS_dims[0] = time_dim; + EVPTRNS_dims[1] = lat_dim; + EVPTRNS_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "EVPTRNS", NC_FLOAT, RANK_EVPTRNS, EVPTRNS_dims, &EVPTRNS_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, EVPTRNS_id, NC_CHUNKED, EVPTRNS_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, EVPTRNS_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, EVPTRNS_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + FRSAT_dims[0] = time_dim; + FRSAT_dims[1] = lat_dim; + FRSAT_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "FRSAT", NC_FLOAT, RANK_FRSAT, FRSAT_dims, &FRSAT_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, FRSAT_id, NC_CHUNKED, FRSAT_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, FRSAT_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, FRSAT_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + FRSNO_dims[0] = time_dim; + FRSNO_dims[1] = lat_dim; + FRSNO_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "FRSNO", NC_FLOAT, RANK_FRSNO, FRSNO_dims, &FRSNO_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, FRSNO_id, NC_CHUNKED, FRSNO_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, FRSNO_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, FRSNO_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + FRUNST_dims[0] = time_dim; + FRUNST_dims[1] = lat_dim; + FRUNST_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "FRUNST", NC_FLOAT, RANK_FRUNST, FRUNST_dims, &FRUNST_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, FRUNST_id, NC_CHUNKED, FRUNST_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, FRUNST_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, FRUNST_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + FRWLT_dims[0] = time_dim; + FRWLT_dims[1] = lat_dim; + FRWLT_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "FRWLT", NC_FLOAT, RANK_FRWLT, FRWLT_dims, &FRWLT_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, FRWLT_id, NC_CHUNKED, FRWLT_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, FRWLT_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, FRWLT_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + GHLAND_dims[0] = time_dim; + GHLAND_dims[1] = lat_dim; + GHLAND_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "GHLAND", NC_FLOAT, RANK_GHLAND, GHLAND_dims, &GHLAND_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, GHLAND_id, NC_CHUNKED, GHLAND_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, GHLAND_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, GHLAND_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + GRN_dims[0] = time_dim; + GRN_dims[1] = lat_dim; + GRN_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "GRN", NC_FLOAT, RANK_GRN, GRN_dims, &GRN_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, GRN_id, NC_CHUNKED, GRN_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, GRN_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, GRN_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + GWETPROF_dims[0] = time_dim; + GWETPROF_dims[1] = lat_dim; + GWETPROF_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "GWETPROF", NC_FLOAT, RANK_GWETPROF, GWETPROF_dims, &GWETPROF_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, GWETPROF_id, NC_CHUNKED, GWETPROF_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, GWETPROF_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, GWETPROF_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + GWETROOT_dims[0] = time_dim; + GWETROOT_dims[1] = lat_dim; + GWETROOT_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "GWETROOT", NC_FLOAT, RANK_GWETROOT, GWETROOT_dims, &GWETROOT_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, GWETROOT_id, NC_CHUNKED, GWETROOT_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, GWETROOT_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, GWETROOT_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + GWETTOP_dims[0] = time_dim; + GWETTOP_dims[1] = lat_dim; + GWETTOP_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "GWETTOP", NC_FLOAT, RANK_GWETTOP, GWETTOP_dims, &GWETTOP_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, GWETTOP_id, NC_CHUNKED, GWETTOP_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, GWETTOP_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, GWETTOP_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + LAI_dims[0] = time_dim; + LAI_dims[1] = lat_dim; + LAI_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "LAI", NC_FLOAT, RANK_LAI, LAI_dims, &LAI_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, LAI_id, NC_CHUNKED, LAI_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, LAI_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, LAI_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + LHLAND_dims[0] = time_dim; + LHLAND_dims[1] = lat_dim; + LHLAND_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "LHLAND", NC_FLOAT, RANK_LHLAND, LHLAND_dims, &LHLAND_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, LHLAND_id, NC_CHUNKED, LHLAND_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, LHLAND_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, LHLAND_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + LWLAND_dims[0] = time_dim; + LWLAND_dims[1] = lat_dim; + LWLAND_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "LWLAND", NC_FLOAT, RANK_LWLAND, LWLAND_dims, &LWLAND_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, LWLAND_id, NC_CHUNKED, LWLAND_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, LWLAND_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, LWLAND_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + PARDFLAND_dims[0] = time_dim; + PARDFLAND_dims[1] = lat_dim; + PARDFLAND_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "PARDFLAND", NC_FLOAT, RANK_PARDFLAND, PARDFLAND_dims, &PARDFLAND_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, PARDFLAND_id, NC_CHUNKED, PARDFLAND_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, PARDFLAND_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, PARDFLAND_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + PARDRLAND_dims[0] = time_dim; + PARDRLAND_dims[1] = lat_dim; + PARDRLAND_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "PARDRLAND", NC_FLOAT, RANK_PARDRLAND, PARDRLAND_dims, &PARDRLAND_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, PARDRLAND_id, NC_CHUNKED, PARDRLAND_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, PARDRLAND_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, PARDRLAND_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + PRECSNOLAND_dims[0] = time_dim; + PRECSNOLAND_dims[1] = lat_dim; + PRECSNOLAND_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "PRECSNOLAND", NC_FLOAT, RANK_PRECSNOLAND, PRECSNOLAND_dims, &PRECSNOLAND_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, PRECSNOLAND_id, NC_CHUNKED, PRECSNOLAND_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, PRECSNOLAND_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, PRECSNOLAND_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + PRECTOTLAND_dims[0] = time_dim; + PRECTOTLAND_dims[1] = lat_dim; + PRECTOTLAND_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "PRECTOTLAND", NC_FLOAT, RANK_PRECTOTLAND, PRECTOTLAND_dims, &PRECTOTLAND_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, PRECTOTLAND_id, NC_CHUNKED, PRECTOTLAND_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, PRECTOTLAND_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, PRECTOTLAND_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + PRMC_dims[0] = time_dim; + PRMC_dims[1] = lat_dim; + PRMC_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "PRMC", NC_FLOAT, RANK_PRMC, PRMC_dims, &PRMC_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, PRMC_id, NC_CHUNKED, PRMC_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, PRMC_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, PRMC_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + QINFIL_dims[0] = time_dim; + QINFIL_dims[1] = lat_dim; + QINFIL_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "QINFIL", NC_FLOAT, RANK_QINFIL, QINFIL_dims, &QINFIL_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, QINFIL_id, NC_CHUNKED, QINFIL_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, QINFIL_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, QINFIL_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + RUNOFF_dims[0] = time_dim; + RUNOFF_dims[1] = lat_dim; + RUNOFF_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "RUNOFF", NC_FLOAT, RANK_RUNOFF, RUNOFF_dims, &RUNOFF_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, RUNOFF_id, NC_CHUNKED, RUNOFF_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, RUNOFF_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, RUNOFF_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + RZMC_dims[0] = time_dim; + RZMC_dims[1] = lat_dim; + RZMC_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "RZMC", NC_FLOAT, RANK_RZMC, RZMC_dims, &RZMC_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, RZMC_id, NC_CHUNKED, RZMC_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, RZMC_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, RZMC_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + SFMC_dims[0] = time_dim; + SFMC_dims[1] = lat_dim; + SFMC_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "SFMC", NC_FLOAT, RANK_SFMC, SFMC_dims, &SFMC_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, SFMC_id, NC_CHUNKED, SFMC_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, SFMC_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, SFMC_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + SHLAND_dims[0] = time_dim; + SHLAND_dims[1] = lat_dim; + SHLAND_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "SHLAND", NC_FLOAT, RANK_SHLAND, SHLAND_dims, &SHLAND_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, SHLAND_id, NC_CHUNKED, SHLAND_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, SHLAND_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, SHLAND_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + SMLAND_dims[0] = time_dim; + SMLAND_dims[1] = lat_dim; + SMLAND_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "SMLAND", NC_FLOAT, RANK_SMLAND, SMLAND_dims, &SMLAND_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, SMLAND_id, NC_CHUNKED, SMLAND_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, SMLAND_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, SMLAND_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + SNODP_dims[0] = time_dim; + SNODP_dims[1] = lat_dim; + SNODP_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "SNODP", NC_FLOAT, RANK_SNODP, SNODP_dims, &SNODP_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, SNODP_id, NC_CHUNKED, SNODP_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, SNODP_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, SNODP_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + SNOMAS_dims[0] = time_dim; + SNOMAS_dims[1] = lat_dim; + SNOMAS_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "SNOMAS", NC_FLOAT, RANK_SNOMAS, SNOMAS_dims, &SNOMAS_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, SNOMAS_id, NC_CHUNKED, SNOMAS_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, SNOMAS_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, SNOMAS_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + SPLAND_dims[0] = time_dim; + SPLAND_dims[1] = lat_dim; + SPLAND_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "SPLAND", NC_FLOAT, RANK_SPLAND, SPLAND_dims, &SPLAND_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, SPLAND_id, NC_CHUNKED, SPLAND_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, SPLAND_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, SPLAND_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + SPSNOW_dims[0] = time_dim; + SPSNOW_dims[1] = lat_dim; + SPSNOW_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "SPSNOW", NC_FLOAT, RANK_SPSNOW, SPSNOW_dims, &SPSNOW_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, SPSNOW_id, NC_CHUNKED, SPSNOW_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, SPSNOW_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, SPSNOW_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + SPWATR_dims[0] = time_dim; + SPWATR_dims[1] = lat_dim; + SPWATR_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "SPWATR", NC_FLOAT, RANK_SPWATR, SPWATR_dims, &SPWATR_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, SPWATR_id, NC_CHUNKED, SPWATR_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, SPWATR_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, SPWATR_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + SWLAND_dims[0] = time_dim; + SWLAND_dims[1] = lat_dim; + SWLAND_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "SWLAND", NC_FLOAT, RANK_SWLAND, SWLAND_dims, &SWLAND_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, SWLAND_id, NC_CHUNKED, SWLAND_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, SWLAND_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, SWLAND_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + TELAND_dims[0] = time_dim; + TELAND_dims[1] = lat_dim; + TELAND_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "TELAND", NC_FLOAT, RANK_TELAND, TELAND_dims, &TELAND_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, TELAND_id, NC_CHUNKED, TELAND_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, TELAND_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, TELAND_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + TPSNOW_dims[0] = time_dim; + TPSNOW_dims[1] = lat_dim; + TPSNOW_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "TPSNOW", NC_FLOAT, RANK_TPSNOW, TPSNOW_dims, &TPSNOW_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, TPSNOW_id, NC_CHUNKED, TPSNOW_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, TPSNOW_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, TPSNOW_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + TSAT_dims[0] = time_dim; + TSAT_dims[1] = lat_dim; + TSAT_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "TSAT", NC_FLOAT, RANK_TSAT, TSAT_dims, &TSAT_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, TSAT_id, NC_CHUNKED, TSAT_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, TSAT_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, TSAT_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + TSOIL1_dims[0] = time_dim; + TSOIL1_dims[1] = lat_dim; + TSOIL1_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "TSOIL1", NC_FLOAT, RANK_TSOIL1, TSOIL1_dims, &TSOIL1_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, TSOIL1_id, NC_CHUNKED, TSOIL1_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, TSOIL1_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, TSOIL1_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + TSOIL2_dims[0] = time_dim; + TSOIL2_dims[1] = lat_dim; + TSOIL2_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "TSOIL2", NC_FLOAT, RANK_TSOIL2, TSOIL2_dims, &TSOIL2_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, TSOIL2_id, NC_CHUNKED, TSOIL2_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, TSOIL2_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, TSOIL2_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + TSOIL3_dims[0] = time_dim; + TSOIL3_dims[1] = lat_dim; + TSOIL3_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "TSOIL3", NC_FLOAT, RANK_TSOIL3, TSOIL3_dims, &TSOIL3_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, TSOIL3_id, NC_CHUNKED, TSOIL3_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, TSOIL3_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, TSOIL3_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + TSOIL4_dims[0] = time_dim; + TSOIL4_dims[1] = lat_dim; + TSOIL4_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "TSOIL4", NC_FLOAT, RANK_TSOIL4, TSOIL4_dims, &TSOIL4_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, TSOIL4_id, NC_CHUNKED, TSOIL4_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, TSOIL4_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, TSOIL4_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + TSOIL5_dims[0] = time_dim; + TSOIL5_dims[1] = lat_dim; + TSOIL5_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "TSOIL5", NC_FLOAT, RANK_TSOIL5, TSOIL5_dims, &TSOIL5_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, TSOIL5_id, NC_CHUNKED, TSOIL5_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, TSOIL5_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, TSOIL5_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + TSOIL6_dims[0] = time_dim; + TSOIL6_dims[1] = lat_dim; + TSOIL6_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "TSOIL6", NC_FLOAT, RANK_TSOIL6, TSOIL6_dims, &TSOIL6_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, TSOIL6_id, NC_CHUNKED, TSOIL6_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, TSOIL6_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, TSOIL6_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + TSURF_dims[0] = time_dim; + TSURF_dims[1] = lat_dim; + TSURF_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "TSURF", NC_FLOAT, RANK_TSURF, TSURF_dims, &TSURF_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, TSURF_id, NC_CHUNKED, TSURF_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, TSURF_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, TSURF_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + TUNST_dims[0] = time_dim; + TUNST_dims[1] = lat_dim; + TUNST_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "TUNST", NC_FLOAT, RANK_TUNST, TUNST_dims, &TUNST_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, TUNST_id, NC_CHUNKED, TUNST_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, TUNST_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, TUNST_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + TWLAND_dims[0] = time_dim; + TWLAND_dims[1] = lat_dim; + TWLAND_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "TWLAND", NC_FLOAT, RANK_TWLAND, TWLAND_dims, &TWLAND_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, TWLAND_id, NC_CHUNKED, TWLAND_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, TWLAND_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, TWLAND_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + TWLT_dims[0] = time_dim; + TWLT_dims[1] = lat_dim; + TWLT_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "TWLT", NC_FLOAT, RANK_TWLT, TWLT_dims, &TWLT_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, TWLT_id, NC_CHUNKED, TWLT_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, TWLT_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, TWLT_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + WCHANGE_dims[0] = time_dim; + WCHANGE_dims[1] = lat_dim; + WCHANGE_dims[2] = lon_dim; + stat = nc_def_var(MERR_grp, "WCHANGE", NC_FLOAT, RANK_WCHANGE, WCHANGE_dims, &WCHANGE_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, WCHANGE_id, NC_CHUNKED, WCHANGE_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, WCHANGE_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, WCHANGE_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + lat_dims[0] = lat_dim; + stat = nc_def_var(MERR_grp, "lat", NC_DOUBLE, RANK_lat, lat_dims, &lat_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, lat_id, NC_CONTIGUOUS, NULL); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, lat_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + lon_dims[0] = lon_dim; + stat = nc_def_var(MERR_grp, "lon", NC_DOUBLE, RANK_lon, lon_dims, &lon_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, lon_id, NC_CONTIGUOUS, NULL); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, lon_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + time_dims[0] = time_dim; + stat = nc_def_var(MERR_grp, "time", NC_INT, RANK_time, time_dims, &time_id); + check_err(stat,__LINE__,__FILE__); + if (cmode & NC_NETCDF4) + { + stat = nc_def_var_chunking(MERR_grp, time_id, NC_CHUNKED, time_chunksizes); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_deflate(MERR_grp, time_id, NC_SHUFFLE, 1, 0); + check_err(stat,__LINE__,__FILE__); + stat = nc_def_var_endian(MERR_grp, time_id, NC_ENDIAN_LITTLE); + check_err(stat,__LINE__,__FILE__); + } + + /* assign global attributes */ + + { + stat = nc_put_att_text(MERR_grp, NC_GLOBAL, "History", 120, "Wed Sep 20 09:06:02 2017: ncks -L 0 MERR.nc4 MERR.uncompressed.nc4\nOriginal file generated: Mon Mar 23 09:27:34 2015 GMT"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, NC_GLOBAL, "Comment", 58, "GMAO filename: d5124_m2_jan00.tavg1_2d_lnd_Nx.20100105.nc4"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, NC_GLOBAL, "Filename", 39, "MERRA2_300.tavg1_2d_lnd_Nx.20100105.nc4"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, NC_GLOBAL, "Conventions", 4, "CF-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, NC_GLOBAL, "Institution", 44, "NASA Global Modeling and Assimilation Office"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, NC_GLOBAL, "References", 25, "http://gmao.gsfc.nasa.gov"); + check_err(stat,__LINE__,__FILE__); + } + + /* { */ + /* stat = nc_put_att_text(MERR_grp, NC_GLOBAL, "Format", 14, "NetCDF-4/HDF-5"); */ + /* check_err(stat,__LINE__,__FILE__); */ + /* } */ + + { + stat = nc_put_att_text(MERR_grp, NC_GLOBAL, "SpatialCoverage", 6, "global"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, NC_GLOBAL, "VersionID", 6, "5.12.4"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, NC_GLOBAL, "TemporalRange", 24, "1980-01-01 -> 2016-12-31"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, NC_GLOBAL, "identifier_product_doi_authority", 18, "http://dx.doi.org/"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, NC_GLOBAL, "ShortName", 9, "M2T1NXLND"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, NC_GLOBAL, "RangeBeginningDate", 10, "2010-01-04"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, NC_GLOBAL, "RangeBeginningTime", 15, "23:30:00.000000"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, NC_GLOBAL, "RangeEndingDate", 10, "2010-01-05"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, NC_GLOBAL, "RangeEndingTime", 15, "00:30:00.000000"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, NC_GLOBAL, "GranuleID", 39, "MERRA2_300.tavg1_2d_lnd_Nx.20100105.nc4"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, NC_GLOBAL, "ProductionDateTime", 53, "Original file generated: Mon Mar 23 09:27:34 2015 GMT"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, NC_GLOBAL, "LongName", 100, "MERRA2 tavg1_2d_lnd_Nx: 2d,1-Hourly,Time-Averaged,Single-Level,Assimilation,Land Surface Diagnostics"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, NC_GLOBAL, "Title", 100, "MERRA2 tavg1_2d_lnd_Nx: 2d,1-Hourly,Time-Averaged,Single-Level,Assimilation,Land Surface Diagnostics"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, NC_GLOBAL, "SouthernmostLatitude", 5, "-90.0"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, NC_GLOBAL, "NorthernmostLatitude", 4, "90.0"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, NC_GLOBAL, "WesternmostLongitude", 6, "-180.0"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, NC_GLOBAL, "EasternmostLongitude", 7, "179.375"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, NC_GLOBAL, "LatitudeResolution", 3, "0.5"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, NC_GLOBAL, "LongitudeResolution", 5, "0.625"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, NC_GLOBAL, "DataResolution", 11, "0.5 x 0.625"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, NC_GLOBAL, "identifier_product_doi", 3, "TBD"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, NC_GLOBAL, "Source", 24, "CVS tag: GEOSadas-5_12_4"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, NC_GLOBAL, "Contact", 25, "http://gmao.gsfc.nasa.gov"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, NC_GLOBAL, "NCO", 5, "4.6.7"); + check_err(stat,__LINE__,__FILE__); + } + + + /* assign per-variable attributes */ + + { + stat = nc_put_att_text(MERR_grp, BASEFLOW_id, "long_name", 13, "baseflow_flux"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, BASEFLOW_id, "units", 10, "kg m-2 s-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, BASEFLOW_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, BASEFLOW_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, BASEFLOW_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, BASEFLOW_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, BASEFLOW_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, BASEFLOW_id, "standard_name", 13, "baseflow_flux"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, BASEFLOW_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, BASEFLOW_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, BASEFLOW_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, ECHANGE_id, "long_name", 35, "rate_of_change_of_total_land_energy"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, ECHANGE_id, "units", 5, "W m-2"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, ECHANGE_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, ECHANGE_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, ECHANGE_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, ECHANGE_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, ECHANGE_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, ECHANGE_id, "standard_name", 35, "rate_of_change_of_total_land_energy"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, ECHANGE_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, ECHANGE_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, ECHANGE_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, EVLAND_id, "long_name", 16, "Evaporation_land"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, EVLAND_id, "units", 10, "kg m-2 s-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, EVLAND_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, EVLAND_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, EVLAND_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, EVLAND_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, EVLAND_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, EVLAND_id, "standard_name", 16, "Evaporation_land"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, EVLAND_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, EVLAND_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, EVLAND_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, EVPINTR_id, "long_name", 29, "interception_loss_energy_flux"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, EVPINTR_id, "units", 5, "W m-2"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, EVPINTR_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, EVPINTR_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, EVPINTR_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, EVPINTR_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, EVPINTR_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, EVPINTR_id, "standard_name", 29, "interception_loss_energy_flux"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, EVPINTR_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, EVPINTR_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, EVPINTR_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, EVPSBLN_id, "long_name", 32, "snow_ice_evaporation_energy_flux"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, EVPSBLN_id, "units", 5, "W m-2"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, EVPSBLN_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, EVPSBLN_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, EVPSBLN_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, EVPSBLN_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, EVPSBLN_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, EVPSBLN_id, "standard_name", 32, "snow_ice_evaporation_energy_flux"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, EVPSBLN_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, EVPSBLN_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, EVPSBLN_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, EVPSOIL_id, "long_name", 25, "baresoil_evap_energy_flux"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, EVPSOIL_id, "units", 5, "W m-2"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, EVPSOIL_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, EVPSOIL_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, EVPSOIL_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, EVPSOIL_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, EVPSOIL_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, EVPSOIL_id, "standard_name", 25, "baresoil_evap_energy_flux"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, EVPSOIL_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, EVPSOIL_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, EVPSOIL_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, EVPTRNS_id, "long_name", 25, "transpiration_energy_flux"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, EVPTRNS_id, "units", 5, "W m-2"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, EVPTRNS_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, EVPTRNS_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, EVPTRNS_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, EVPTRNS_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, EVPTRNS_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, EVPTRNS_id, "standard_name", 25, "transpiration_energy_flux"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, EVPTRNS_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, EVPTRNS_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, EVPTRNS_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, FRSAT_id, "long_name", 33, "fractional_area_of_saturated_zone"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, FRSAT_id, "units", 1, "1"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, FRSAT_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, FRSAT_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, FRSAT_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, FRSAT_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, FRSAT_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, FRSAT_id, "standard_name", 33, "fractional_area_of_saturated_zone"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, FRSAT_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, FRSAT_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, FRSAT_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, FRSNO_id, "long_name", 33, "fractional_area_of_land_snowcover"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, FRSNO_id, "units", 1, "1"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, FRSNO_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, FRSNO_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, FRSNO_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, FRSNO_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, FRSNO_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, FRSNO_id, "standard_name", 33, "fractional_area_of_land_snowcover"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, FRSNO_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, FRSNO_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, FRSNO_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, FRUNST_id, "long_name", 35, "fractional_area_of_unsaturated_zone"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, FRUNST_id, "units", 1, "1"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, FRUNST_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, FRUNST_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, FRUNST_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, FRUNST_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, FRUNST_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, FRUNST_id, "standard_name", 35, "fractional_area_of_unsaturated_zone"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, FRUNST_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, FRUNST_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, FRUNST_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, FRWLT_id, "long_name", 31, "fractional_area_of_wilting_zone"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, FRWLT_id, "units", 1, "1"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, FRWLT_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, FRWLT_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, FRWLT_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, FRWLT_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, FRWLT_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, FRWLT_id, "standard_name", 31, "fractional_area_of_wilting_zone"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, FRWLT_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, FRWLT_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, FRWLT_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, GHLAND_id, "long_name", 19, "Ground_heating_land"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, GHLAND_id, "units", 5, "W m-2"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, GHLAND_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, GHLAND_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, GHLAND_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, GHLAND_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, GHLAND_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, GHLAND_id, "standard_name", 19, "Ground_heating_land"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, GHLAND_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, GHLAND_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, GHLAND_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, GRN_id, "long_name", 17, "greeness_fraction"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, GRN_id, "units", 1, "1"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, GRN_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, GRN_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, GRN_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, GRN_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, GRN_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, GRN_id, "standard_name", 17, "greeness_fraction"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, GRN_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, GRN_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, GRN_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, GWETPROF_id, "long_name", 22, "ave_prof_soil_moisture"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, GWETPROF_id, "units", 1, "1"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, GWETPROF_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, GWETPROF_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, GWETPROF_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, GWETPROF_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, GWETPROF_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, GWETPROF_id, "standard_name", 22, "ave_prof_soil_moisture"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, GWETPROF_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, GWETPROF_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, GWETPROF_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, GWETROOT_id, "long_name", 22, "root_zone_soil_wetness"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, GWETROOT_id, "units", 1, "1"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, GWETROOT_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, GWETROOT_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, GWETROOT_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, GWETROOT_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, GWETROOT_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, GWETROOT_id, "standard_name", 22, "root_zone_soil_wetness"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, GWETROOT_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, GWETROOT_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, GWETROOT_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, GWETTOP_id, "long_name", 20, "surface_soil_wetness"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, GWETTOP_id, "units", 1, "1"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, GWETTOP_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, GWETTOP_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, GWETTOP_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, GWETTOP_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, GWETTOP_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, GWETTOP_id, "standard_name", 20, "surface_soil_wetness"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, GWETTOP_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, GWETTOP_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, GWETTOP_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, LAI_id, "long_name", 15, "leaf_area_index"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, LAI_id, "units", 1, "1"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, LAI_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, LAI_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, LAI_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, LAI_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, LAI_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, LAI_id, "standard_name", 15, "leaf_area_index"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, LAI_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, LAI_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, LAI_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, LHLAND_id, "long_name", 21, "Latent_heat_flux_land"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, LHLAND_id, "units", 5, "W m-2"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, LHLAND_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, LHLAND_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, LHLAND_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, LHLAND_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, LHLAND_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, LHLAND_id, "standard_name", 21, "Latent_heat_flux_land"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, LHLAND_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, LHLAND_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, LHLAND_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, LWLAND_id, "long_name", 17, "Net_longwave_land"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, LWLAND_id, "units", 5, "W m-2"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, LWLAND_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, LWLAND_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, LWLAND_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, LWLAND_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, LWLAND_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, LWLAND_id, "standard_name", 17, "Net_longwave_land"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, LWLAND_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, LWLAND_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, LWLAND_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, PARDFLAND_id, "long_name", 36, "surface_downwelling_par_diffuse_flux"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, PARDFLAND_id, "units", 5, "W m-2"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, PARDFLAND_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, PARDFLAND_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, PARDFLAND_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, PARDFLAND_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, PARDFLAND_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, PARDFLAND_id, "standard_name", 36, "surface_downwelling_par_diffuse_flux"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, PARDFLAND_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, PARDFLAND_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, PARDFLAND_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, PARDRLAND_id, "long_name", 33, "surface_downwelling_par_beam_flux"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, PARDRLAND_id, "units", 5, "W m-2"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, PARDRLAND_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, PARDRLAND_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, PARDRLAND_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, PARDRLAND_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, PARDRLAND_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, PARDRLAND_id, "standard_name", 33, "surface_downwelling_par_beam_flux"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, PARDRLAND_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, PARDRLAND_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, PARDRLAND_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, PRECSNOLAND_id, "long_name", 13, "snowfall_land"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, PRECSNOLAND_id, "units", 10, "kg m-2 s-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, PRECSNOLAND_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, PRECSNOLAND_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, PRECSNOLAND_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, PRECSNOLAND_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, PRECSNOLAND_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, PRECSNOLAND_id, "standard_name", 13, "snowfall_land"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, PRECSNOLAND_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, PRECSNOLAND_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, PRECSNOLAND_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, PRECTOTLAND_id, "long_name", 24, "Total_precipitation_land"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, PRECTOTLAND_id, "units", 10, "kg m-2 s-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, PRECTOTLAND_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, PRECTOTLAND_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, PRECTOTLAND_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, PRECTOTLAND_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, PRECTOTLAND_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, PRECTOTLAND_id, "standard_name", 24, "Total_precipitation_land"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, PRECTOTLAND_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, PRECTOTLAND_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, PRECTOTLAND_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, PRMC_id, "long_name", 13, "water_profile"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, PRMC_id, "units", 7, "m-3 m-3"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, PRMC_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, PRMC_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, PRMC_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, PRMC_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, PRMC_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, PRMC_id, "standard_name", 13, "water_profile"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, PRMC_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, PRMC_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, PRMC_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, QINFIL_id, "long_name", 28, "Soil_water_infiltration_rate"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, QINFIL_id, "units", 10, "kg m-2 s-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, QINFIL_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, QINFIL_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, QINFIL_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, QINFIL_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, QINFIL_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, QINFIL_id, "standard_name", 28, "Soil_water_infiltration_rate"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, QINFIL_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, QINFIL_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, QINFIL_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, RUNOFF_id, "long_name", 37, "overland_runoff_including_throughflow"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, RUNOFF_id, "units", 10, "kg m-2 s-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, RUNOFF_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, RUNOFF_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, RUNOFF_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, RUNOFF_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, RUNOFF_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, RUNOFF_id, "standard_name", 37, "overland_runoff_including_throughflow"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, RUNOFF_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, RUNOFF_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, RUNOFF_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, RZMC_id, "long_name", 15, "water_root_zone"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, RZMC_id, "units", 7, "m-3 m-3"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, RZMC_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, RZMC_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, RZMC_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, RZMC_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, RZMC_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, RZMC_id, "standard_name", 15, "water_root_zone"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, RZMC_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, RZMC_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, RZMC_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, SFMC_id, "long_name", 19, "water_surface_layer"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, SFMC_id, "units", 7, "m-3 m-3"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SFMC_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SFMC_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SFMC_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, SFMC_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, SFMC_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, SFMC_id, "standard_name", 19, "water_surface_layer"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SFMC_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SFMC_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SFMC_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, SHLAND_id, "long_name", 23, "Sensible_heat_flux_land"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, SHLAND_id, "units", 5, "W m-2"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SHLAND_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SHLAND_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SHLAND_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, SHLAND_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, SHLAND_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, SHLAND_id, "standard_name", 23, "Sensible_heat_flux_land"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SHLAND_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SHLAND_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SHLAND_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, SMLAND_id, "long_name", 18, "Snowmelt_flux_land"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, SMLAND_id, "units", 10, "kg m-2 s-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SMLAND_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SMLAND_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SMLAND_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, SMLAND_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, SMLAND_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, SMLAND_id, "standard_name", 18, "Snowmelt_flux_land"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SMLAND_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SMLAND_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SMLAND_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, SNODP_id, "long_name", 10, "snow_depth"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, SNODP_id, "units", 1, "m"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SNODP_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SNODP_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SNODP_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, SNODP_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, SNODP_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, SNODP_id, "standard_name", 10, "snow_depth"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SNODP_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SNODP_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SNODP_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, SNOMAS_id, "long_name", 23, "Total_snow_storage_land"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, SNOMAS_id, "units", 6, "kg m-2"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SNOMAS_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SNOMAS_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SNOMAS_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, SNOMAS_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, SNOMAS_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, SNOMAS_id, "standard_name", 23, "Total_snow_storage_land"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SNOMAS_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SNOMAS_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SNOMAS_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, SPLAND_id, "long_name", 35, "rate_of_spurious_land_energy_source"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, SPLAND_id, "units", 5, "W m-2"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SPLAND_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SPLAND_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SPLAND_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, SPLAND_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, SPLAND_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, SPLAND_id, "standard_name", 35, "rate_of_spurious_land_energy_source"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SPLAND_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SPLAND_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SPLAND_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, SPSNOW_id, "long_name", 28, "rate_of_spurious_snow_energy"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, SPSNOW_id, "units", 5, "W m-2"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SPSNOW_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SPSNOW_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SPSNOW_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, SPSNOW_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, SPSNOW_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, SPSNOW_id, "standard_name", 28, "rate_of_spurious_snow_energy"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SPSNOW_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SPSNOW_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SPSNOW_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, SPWATR_id, "long_name", 34, "rate_of_spurious_land_water_source"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, SPWATR_id, "units", 10, "kg m-2 s-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SPWATR_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SPWATR_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SPWATR_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, SPWATR_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, SPWATR_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, SPWATR_id, "standard_name", 34, "rate_of_spurious_land_water_source"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SPWATR_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SPWATR_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SPWATR_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, SWLAND_id, "long_name", 18, "Net_shortwave_land"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, SWLAND_id, "units", 5, "W m-2"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SWLAND_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SWLAND_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SWLAND_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, SWLAND_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, SWLAND_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, SWLAND_id, "standard_name", 18, "Net_shortwave_land"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SWLAND_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SWLAND_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, SWLAND_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TELAND_id, "long_name", 25, "Total_energy_storage_land"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TELAND_id, "units", 5, "J m-2"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TELAND_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TELAND_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TELAND_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, TELAND_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, TELAND_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TELAND_id, "standard_name", 25, "Total_energy_storage_land"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TELAND_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TELAND_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TELAND_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TPSNOW_id, "long_name", 27, "surface_temperature_of_snow"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TPSNOW_id, "units", 1, "K"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TPSNOW_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TPSNOW_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TPSNOW_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, TPSNOW_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, TPSNOW_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TPSNOW_id, "standard_name", 27, "surface_temperature_of_snow"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TPSNOW_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TPSNOW_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TPSNOW_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TSAT_id, "long_name", 37, "surface_temperature_of_saturated_zone"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TSAT_id, "units", 1, "K"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSAT_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSAT_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSAT_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, TSAT_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, TSAT_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TSAT_id, "standard_name", 37, "surface_temperature_of_saturated_zone"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSAT_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSAT_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSAT_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TSOIL1_id, "long_name", 25, "soil_temperatures_layer_1"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TSOIL1_id, "units", 1, "K"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL1_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL1_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL1_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, TSOIL1_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, TSOIL1_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TSOIL1_id, "standard_name", 25, "soil_temperatures_layer_1"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL1_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL1_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL1_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TSOIL2_id, "long_name", 25, "soil_temperatures_layer_2"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TSOIL2_id, "units", 1, "K"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL2_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL2_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL2_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, TSOIL2_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, TSOIL2_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TSOIL2_id, "standard_name", 25, "soil_temperatures_layer_2"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL2_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL2_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL2_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TSOIL3_id, "long_name", 25, "soil_temperatures_layer_3"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TSOIL3_id, "units", 1, "K"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL3_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL3_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL3_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, TSOIL3_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, TSOIL3_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TSOIL3_id, "standard_name", 25, "soil_temperatures_layer_3"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL3_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL3_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL3_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TSOIL4_id, "long_name", 25, "soil_temperatures_layer_4"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TSOIL4_id, "units", 1, "K"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL4_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL4_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL4_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, TSOIL4_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, TSOIL4_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TSOIL4_id, "standard_name", 25, "soil_temperatures_layer_4"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL4_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL4_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL4_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TSOIL5_id, "long_name", 25, "soil_temperatures_layer_5"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TSOIL5_id, "units", 1, "K"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL5_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL5_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL5_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, TSOIL5_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, TSOIL5_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TSOIL5_id, "standard_name", 25, "soil_temperatures_layer_5"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL5_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL5_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL5_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TSOIL6_id, "long_name", 25, "soil_temperatures_layer_6"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TSOIL6_id, "units", 1, "K"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL6_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL6_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL6_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, TSOIL6_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, TSOIL6_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TSOIL6_id, "standard_name", 25, "soil_temperatures_layer_6"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL6_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL6_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSOIL6_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TSURF_id, "long_name", 37, "surface_temperature_of_land_incl_snow"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TSURF_id, "units", 1, "K"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSURF_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSURF_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSURF_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, TSURF_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, TSURF_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TSURF_id, "standard_name", 37, "surface_temperature_of_land_incl_snow"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSURF_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSURF_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TSURF_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TUNST_id, "long_name", 39, "surface_temperature_of_unsaturated_zone"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TUNST_id, "units", 1, "K"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TUNST_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TUNST_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TUNST_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, TUNST_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, TUNST_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TUNST_id, "standard_name", 39, "surface_temperature_of_unsaturated_zone"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TUNST_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TUNST_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TUNST_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TWLAND_id, "long_name", 24, "Avail_water_storage_land"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TWLAND_id, "units", 6, "kg m-2"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TWLAND_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TWLAND_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TWLAND_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, TWLAND_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, TWLAND_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TWLAND_id, "standard_name", 24, "Avail_water_storage_land"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TWLAND_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TWLAND_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TWLAND_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TWLT_id, "long_name", 34, "surface_temperature_of_wilted_zone"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TWLT_id, "units", 1, "K"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TWLT_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TWLT_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TWLT_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, TWLT_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, TWLT_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, TWLT_id, "standard_name", 34, "surface_temperature_of_wilted_zone"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TWLT_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TWLT_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, TWLT_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, WCHANGE_id, "long_name", 34, "rate_of_change_of_total_land_water"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, WCHANGE_id, "units", 10, "kg m-2 s-1"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float _FillValue_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, WCHANGE_id, "_FillValue", NC_FLOAT, 1, _FillValue_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float missing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, WCHANGE_id, "missing_value", NC_FLOAT, 1, missing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float fmissing_value_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, WCHANGE_id, "fmissing_value", NC_FLOAT, 1, fmissing_value_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float scale_factor_att[1] = {((float)1)} ; + stat = nc_put_att_float(MERR_grp, WCHANGE_id, "scale_factor", NC_FLOAT, 1, scale_factor_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float add_offset_att[1] = {((float)0)} ; + stat = nc_put_att_float(MERR_grp, WCHANGE_id, "add_offset", NC_FLOAT, 1, add_offset_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, WCHANGE_id, "standard_name", 34, "rate_of_change_of_total_land_water"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, WCHANGE_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, WCHANGE_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, WCHANGE_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, lat_id, "long_name", 8, "latitude"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, lat_id, "units", 13, "degrees_north"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, lat_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, lat_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, lat_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, lon_id, "long_name", 9, "longitude"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, lon_id, "units", 12, "degrees_east"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, lon_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, lon_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, lon_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, time_id, "long_name", 4, "time"); + check_err(stat,__LINE__,__FILE__); + } + + { + stat = nc_put_att_text(MERR_grp, time_id, "units", 33, "minutes since 2010-01-05 00:30:00"); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int time_increment_att[1] = {10000} ; + stat = nc_put_att_int(MERR_grp, time_id, "time_increment", NC_INT, 1, time_increment_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int begin_date_att[1] = {20100105} ; + stat = nc_put_att_int(MERR_grp, time_id, "begin_date", NC_INT, 1, begin_date_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const int begin_time_att[1] = {3000} ; + stat = nc_put_att_int(MERR_grp, time_id, "begin_time", NC_INT, 1, begin_time_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmax_att[1] = {((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, time_id, "vmax", NC_FLOAT, 1, vmax_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float vmin_att[1] = {((float)-9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, time_id, "vmin", NC_FLOAT, 1, vmin_att); + check_err(stat,__LINE__,__FILE__); + } + + { + static const float valid_range_att[2] = {((float)-9.9999999e+14), ((float)9.9999999e+14)} ; + stat = nc_put_att_float(MERR_grp, time_id, "valid_range", NC_FLOAT, 2, valid_range_att); + check_err(stat,__LINE__,__FILE__); + } + + + /* leave define mode */ + stat = nc_enddef (MERR_grp); + check_err(stat,__LINE__,__FILE__); + + /* assign variable data */ + + stat = nc_close(MERR_grp); + check_err(stat,__LINE__,__FILE__); + return 0; +} + +int +run_test(int test_no, char *file_name, int cmode, int *open_time, int *create_time, int *close_time) +{ + int ncid; + struct timeval start_time, end_time, diff_time; + + if (gettimeofday(&start_time, NULL)) ERR_RET; + if (test_no) + { + if (create_wrfbdy_file(file_name, cmode)) ERR; + } + else + { + if (create_merr_file(file_name, cmode)) ERR; + } + + if (gettimeofday(&end_time, NULL)) ERR_RET; + if (nc4_timeval_subtract(&diff_time, &end_time, &start_time)) ERR_RET; + *create_time += (int)diff_time.tv_sec * MILLION + (int)diff_time.tv_usec; + + if (gettimeofday(&start_time, NULL)) ERR_RET; + if (nc_open(file_name, 0, &ncid)) ERR; + if (gettimeofday(&end_time, NULL)) ERR_RET; + if (nc4_timeval_subtract(&diff_time, &end_time, &start_time)) ERR_RET; + *open_time += (int)diff_time.tv_sec * MILLION + (int)diff_time.tv_usec; + + if (gettimeofday(&start_time, NULL)) ERR_RET; + if (nc_close(ncid)) ERR; + if (gettimeofday(&end_time, NULL)) ERR_RET; + if (nc4_timeval_subtract(&diff_time, &end_time, &start_time)) ERR_RET; + *close_time += (int)diff_time.tv_sec * MILLION + (int)diff_time.tv_usec; + + return 0; +} + +#define MAX_I 100 +#define NUM_CMODES 2 + +int +main(int argc, char **argv) +{ + int cmode[NUM_CMODES] = {0, NC_NETCDF4}; + int c, i; + + printf("Testing with wrfbdy file...\n"); + { + printf("cmode \t\tcreate time (us) \topen time (us) \tclose time (us)\n"); + for (c = 0; c < NUM_CMODES; c++) + { + { + int open_time = 0, create_time = 0, close_time = 0; + + for (i = 0; i < MAX_I; i++) + { + char file_name[NC_MAX_NAME + 1]; + + nc_set_log_level(4); + sprintf(file_name, "%s_%d.nc", FILE_NAME, i); + run_test(0, file_name, cmode[c], &open_time, &create_time, &close_time); + remove(file_name); + } + printf("%s \t %d \t\t\t %d \t\t %d\n", cmode[c] ? "netcdf-4" : "classic", + create_time/MAX_I, open_time/MAX_I, close_time/MAX_I); + } + } + } + SUMMARIZE_ERR; + printf("Testing with merr file...\n"); + { + printf("cmode \t\tcreate time (us) \topen time (us) \tclose time (us)\n"); + for (c = 0; c < NUM_CMODES; c++) + { + { + int open_time = 0, create_time = 0, close_time = 0; + + for (i = 0; i < MAX_I; i++) + { + char file_name[NC_MAX_NAME + 1]; + + nc_set_log_level(4); + sprintf(file_name, "%s_%d.nc", FILE_NAME, i); + run_test(1, file_name, cmode[c], &open_time, &create_time, &close_time); + remove(file_name); + } + printf("%s \t %d \t\t\t %d \t\t %d\n", cmode[c] ? "netcdf-4" : "classic", + create_time/MAX_I, open_time/MAX_I, close_time/MAX_I); + } + } + } + SUMMARIZE_ERR; + FINAL_RESULTS; +} From f724fe63851e820915adcf6e37266f14ee312052 Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Tue, 11 Dec 2018 06:34:44 -0700 Subject: [PATCH 07/24] uncommented test in tst_interops.c --- nc_test4/tst_interops.c | 84 ++++++++++++++++++++--------------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/nc_test4/tst_interops.c b/nc_test4/tst_interops.c index 086336e30e..b2dca460d5 100644 --- a/nc_test4/tst_interops.c +++ b/nc_test4/tst_interops.c @@ -398,47 +398,47 @@ main(int argc, char **argv) if (nc_close(ncid)) ERR; } SUMMARIZE_ERR; -/* printf("**** testing 2D coordinate variable..."); */ - -/* { */ -/* #define VAR_NAME "Britany" */ -/* #define NDIMS 2 */ -/* #define TEXT_LEN 15 */ -/* #define D0_NAME "time" */ -/* #define D1_NAME "tl" */ -/* int ncid, nvars_in, varids_in[1]; */ -/* int time_dimids[NDIMS], time_id; */ -/* size_t time_count[NDIMS], time_index[NDIMS] = {0, 0}; */ -/* const char ttext[TEXT_LEN]="20051224.150000"; */ -/* int nvars, ndims, ngatts, unlimdimid; */ -/* int ndims_in, natts_in, dimids_in[NDIMS]; */ -/* char var_name_in[NC_MAX_NAME + 1]; */ -/* nc_type xtype_in; */ - -/* /\* Create a netcdf-4 file with 2D coordinate var. *\/ */ -/* if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR; */ - -/* if (nc_def_dim(ncid, D0_NAME, NC_UNLIMITED, &time_dimids[0])) ERR; */ -/* if (nc_def_dim(ncid, D1_NAME, TEXT_LEN, &time_dimids[1])) ERR; */ -/* if (nc_def_var(ncid, D0_NAME, NC_CHAR, NDIMS, time_dimids, &time_id)) ERR; */ - -/* /\* Write one time to the coordinate variable. *\/ */ -/* time_count[0] = 1; */ -/* time_count[1] = TEXT_LEN; */ -/* if (nc_put_vara_text(ncid, time_id, time_index, time_count, ttext)) ERR; */ -/* if (nc_close(ncid)) ERR; */ - -/* /\* Open the file and check. *\/ */ -/* if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR; */ -/* if (nc_inq(ncid, &ndims, &nvars, &ngatts, &unlimdimid)) ERR; */ -/* if (nvars != 1 || ndims != 2 || ngatts != 0 || unlimdimid != 0) ERR; */ -/* if (nc_inq_varids(ncid, &nvars_in, varids_in)) ERR; */ -/* if (nvars_in != 1 || varids_in[0] != 0) ERR; */ -/* if (nc_inq_var(ncid, 0, var_name_in, &xtype_in, &ndims_in, dimids_in, &natts_in)) ERR; */ -/* if (strcmp(var_name_in, D0_NAME) || xtype_in != NC_CHAR || ndims_in != 2 || */ -/* dimids_in[0] != 0 || dimids_in[1] != 1 || natts_in != 0) ERR; */ -/* if (nc_close(ncid)) ERR; */ -/* } */ -/* SUMMARIZE_ERR; */ + printf("**** testing 2D coordinate variable..."); + + { +#define VAR_NAME "Britany" +#define NDIMS 2 +#define TEXT_LEN 15 +#define D0_NAME "time" +#define D1_NAME "tl" + int ncid, nvars_in, varids_in[1]; + int time_dimids[NDIMS], time_id; + size_t time_count[NDIMS], time_index[NDIMS] = {0, 0}; + const char ttext[TEXT_LEN]="20051224.150000"; + int nvars, ndims, ngatts, unlimdimid; + int ndims_in, natts_in, dimids_in[NDIMS]; + char var_name_in[NC_MAX_NAME + 1]; + nc_type xtype_in; + + /* Create a netcdf-4 file with 2D coordinate var. */ + if (nc_create(FILE_NAME, NC_NETCDF4, &ncid)) ERR; + + if (nc_def_dim(ncid, D0_NAME, NC_UNLIMITED, &time_dimids[0])) ERR; + if (nc_def_dim(ncid, D1_NAME, TEXT_LEN, &time_dimids[1])) ERR; + if (nc_def_var(ncid, D0_NAME, NC_CHAR, NDIMS, time_dimids, &time_id)) ERR; + + /* Write one time to the coordinate variable. */ + time_count[0] = 1; + time_count[1] = TEXT_LEN; + if (nc_put_vara_text(ncid, time_id, time_index, time_count, ttext)) ERR; + if (nc_close(ncid)) ERR; + + /* Open the file and check. */ + if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR; + if (nc_inq(ncid, &ndims, &nvars, &ngatts, &unlimdimid)) ERR; + if (nvars != 1 || ndims != 2 || ngatts != 0 || unlimdimid != 0) ERR; + if (nc_inq_varids(ncid, &nvars_in, varids_in)) ERR; + if (nvars_in != 1 || varids_in[0] != 0) ERR; + if (nc_inq_var(ncid, 0, var_name_in, &xtype_in, &ndims_in, dimids_in, &natts_in)) ERR; + if (strcmp(var_name_in, D0_NAME) || xtype_in != NC_CHAR || ndims_in != 2 || + dimids_in[0] != 0 || dimids_in[1] != 1 || natts_in != 0) ERR; + if (nc_close(ncid)) ERR; + } + SUMMARIZE_ERR; FINAL_RESULTS; } From 53bdb74869933d5fa7217be656c7b24af68ae268 Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Tue, 11 Dec 2018 06:38:23 -0700 Subject: [PATCH 08/24] fixed error handling of write_netcdf4_dimid() --- libhdf5/nc4hdf.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/libhdf5/nc4hdf.c b/libhdf5/nc4hdf.c index bdf715a138..04153d6f4d 100644 --- a/libhdf5/nc4hdf.c +++ b/libhdf5/nc4hdf.c @@ -744,16 +744,17 @@ write_coord_dimids(NC_VAR_INFO_T *var) static int write_netcdf4_dimid(hid_t datasetid, int dimid) { - hid_t dimid_spaceid, dimid_attid; + hid_t dimid_spaceid = -1, dimid_attid = -1; htri_t attr_exists; + int retval = NC_NOERR; /* Create the space. */ if ((dimid_spaceid = H5Screate(H5S_SCALAR)) < 0) - return NC_EHDFERR; + BAIL(NC_EHDFERR); /* Does the attribute already exist? If so, don't try to create it. */ if ((attr_exists = H5Aexists(datasetid, NC_DIMID_ATT_NAME)) < 0) - return NC_EHDFERR; + BAIL(NC_EHDFERR); if (attr_exists) dimid_attid = H5Aopen_by_name(datasetid, ".", NC_DIMID_ATT_NAME, H5P_DEFAULT, H5P_DEFAULT); @@ -762,21 +763,22 @@ write_netcdf4_dimid(hid_t datasetid, int dimid) dimid_attid = H5Acreate(datasetid, NC_DIMID_ATT_NAME, H5T_NATIVE_INT, dimid_spaceid, H5P_DEFAULT); if (dimid_attid < 0) - return NC_EHDFERR; + BAIL(NC_EHDFERR); /* Write it. */ LOG((4, "%s: writing secret dimid %d", __func__, dimid)); if (H5Awrite(dimid_attid, H5T_NATIVE_INT, &dimid) < 0) - return NC_EHDFERR; + BAIL(NC_EHDFERR); +exit: /* Close stuff*/ - if (H5Sclose(dimid_spaceid) < 0) - return NC_EHDFERR; - if (H5Aclose(dimid_attid) < 0) - return NC_EHDFERR; + if (dimid_spaceid >= 0 && H5Sclose(dimid_spaceid) < 0) + BAIL2(NC_EHDFERR); + if (dimid_attid >= 0 && H5Aclose(dimid_attid) < 0) + BAIL2(NC_EHDFERR); - return NC_NOERR; + return retval; } /** From d7b657af4e201e4b578a1f51c445d059ff62d02f Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Tue, 11 Dec 2018 06:43:27 -0700 Subject: [PATCH 09/24] cleaned up comments, changed loop to use ncindexlookup() instead of looping through the names --- libhdf5/nc4hdf.c | 48 ++++++++++++++++-------------------------------- 1 file changed, 16 insertions(+), 32 deletions(-) diff --git a/libhdf5/nc4hdf.c b/libhdf5/nc4hdf.c index 04153d6f4d..d10ba6d9ce 100644 --- a/libhdf5/nc4hdf.c +++ b/libhdf5/nc4hdf.c @@ -1553,14 +1553,11 @@ write_var(NC_VAR_INFO_T *var, NC_GRP_INFO_T *grp, nc_bool_t write_dimid) { replace_existing_var = NC_TRUE; var->fill_val_changed = NC_FALSE; - /* If the variable is going to be replaced, - we need to flag any other attributes associated - with the variable as 'dirty', or else - *only* the fill value attribute will be copied over - and the rest will be lost. See: - - * https://github.com/Unidata/netcdf-c/issues/239 */ - + /* If the variable is going to be replaced, we need to flag any + other attributes associated with the variable as 'dirty', or + else *only* the fill value attribute will be copied over and + the rest will be lost. See + https://github.com/Unidata/netcdf-c/issues/239 */ flag_atts_dirty(var->att); } @@ -1570,37 +1567,24 @@ write_var(NC_VAR_INFO_T *var, NC_GRP_INFO_T *grp, nc_bool_t write_dimid) * this object exists in the HDF group. */ if (var->became_coord_var) { - NC_DIM_INFO_T *d1; - int i; - - for (i = 0; i < ncindexsize(grp->dim); i++) + if ((NC_DIM_INFO_T *)ncindexlookup(grp->dim, var->hdr.name)) { - d1 = (NC_DIM_INFO_T*)ncindexith(grp->dim,i); - assert(d1); - if (!strcmp(d1->hdr.name, var->hdr.name)) - { - nc_bool_t exists; + nc_bool_t exists; - if ((retval = var_exists(hdf5_grp->hdf_grpid, var->hdr.name, &exists))) - return retval; - if (exists) - { - /* Indicate that the variable already exists, and should be replaced */ - replace_existing_var = NC_TRUE; - flag_atts_dirty(var->att); - break; - } + if ((retval = var_exists(hdf5_grp->hdf_grpid, var->hdr.name, &exists))) + return retval; + if (exists) + { + /* Indicate that the variable already exists, and should + * be replaced. */ + replace_existing_var = NC_TRUE; + flag_atts_dirty(var->att); } } } /* Check dims if the variable will be replaced, so that the - * dimensions will be de-attached and re-attached correctly. (Note: - * There's a temptation to merge this loop over the dimensions with - * the prior loop over dimensions, but that blurs the line over the - * purpose of them, so they are currently separate. If performance - * becomes an issue here, it would be possible to merge them. -QAK) - */ + * dimensions will be de-attached and re-attached correctly. */ if (replace_existing_var) { int i; From 39a0f822faf3bdceadd61174b1c1780fe25ff355 Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Tue, 11 Dec 2018 07:07:00 -0700 Subject: [PATCH 10/24] changed loop to use ncindexlookup() instead of looping through the names --- libhdf5/nc4hdf.c | 53 +++++++++++++++++++----------------------------- 1 file changed, 21 insertions(+), 32 deletions(-) diff --git a/libhdf5/nc4hdf.c b/libhdf5/nc4hdf.c index d10ba6d9ce..57849156fa 100644 --- a/libhdf5/nc4hdf.c +++ b/libhdf5/nc4hdf.c @@ -1587,44 +1587,33 @@ write_var(NC_VAR_INFO_T *var, NC_GRP_INFO_T *grp, nc_bool_t write_dimid) * dimensions will be de-attached and re-attached correctly. */ if (replace_existing_var) { - int i; + NC_DIM_INFO_T *d1; - for (i = 0; i < ncindexsize(grp->dim); i++) + /* Is there a dim with this var's name? */ + if ((d1 = (NC_DIM_INFO_T *)ncindexlookup(grp->dim, var->hdr.name))) { - NC_DIM_INFO_T *d1; - NC_HDF5_DIM_INFO_T *hdf5_d1; - - /* Get info about the dim, including HDF5-specific info. */ - d1 = (NC_DIM_INFO_T *)ncindexith(grp->dim, i); - assert(d1 && d1->format_dim_info && d1->hdr.name); - hdf5_d1 = (NC_HDF5_DIM_INFO_T *)d1->format_dim_info; + nc_bool_t exists; + assert(d1->format_dim_info && d1->hdr.name); - if (!strcmp(d1->hdr.name, var->hdr.name)) + if ((retval = var_exists(hdf5_grp->hdf_grpid, var->hdr.name, &exists))) + return retval; + if (exists) { - nc_bool_t exists; + hid_t dsid; - if ((retval = var_exists(hdf5_grp->hdf_grpid, var->hdr.name, - &exists))) + /* Find dataset ID for dimension */ + if (d1->coord_var) + dsid = ((NC_HDF5_VAR_INFO_T *)d1->coord_var->format_var_info)->hdf_datasetid; + else + dsid = ((NC_HDF5_DIM_INFO_T *)d1->format_dim_info)->hdf_dimscaleid; + assert(dsid > 0); + + /* If we're replacing an existing dimscale dataset, go to + * every var in the file and detach this dimension scale, + * because we have to delete it. */ + if ((retval = rec_detach_scales(grp->nc4_info->root_grp, + var->dimids[0], dsid))) return retval; - if (exists) - { - hid_t dim_datasetid; /* Dataset ID for dimension */ - - /* Find dataset ID for dimension */ - if (d1->coord_var) - dim_datasetid = ((NC_HDF5_VAR_INFO_T *)(d1->coord_var->format_var_info))->hdf_datasetid; - else - dim_datasetid = hdf5_d1->hdf_dimscaleid; - assert(dim_datasetid > 0); - - /* If we're replacing an existing dimscale dataset, go to - * every var in the file and detach this dimension scale, - * because we have to delete it. */ - if ((retval = rec_detach_scales(grp->nc4_info->root_grp, - var->dimids[0], dim_datasetid))) - return retval; - break; - } } } } From 7b72d0b832779986b83a4b6b7b88306c2cdfed3c Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Tue, 11 Dec 2018 07:15:46 -0700 Subject: [PATCH 11/24] fixed error handling in attach_dimscales() --- libhdf5/nc4hdf.c | 73 +++++++++++++++++++----------------------------- 1 file changed, 28 insertions(+), 45 deletions(-) diff --git a/libhdf5/nc4hdf.c b/libhdf5/nc4hdf.c index 57849156fa..22c45225b5 100644 --- a/libhdf5/nc4hdf.c +++ b/libhdf5/nc4hdf.c @@ -1366,70 +1366,53 @@ attach_dimscales(NC_GRP_INFO_T *grp) { NC_VAR_INFO_T *var; NC_HDF5_VAR_INFO_T *hdf5_var; - NC_DIM_INFO_T *dim1; - int d, i; - int retval = NC_NOERR; + int d, v; /* Attach dimension scales. */ - for (i = 0; i < ncindexsize(grp->vars); i++) + for (v = 0; v < ncindexsize(grp->vars); v++) { /* Get pointer to var and HDF5-specific var info. */ - var = (NC_VAR_INFO_T*)ncindexith(grp->vars, i); + var = (NC_VAR_INFO_T*)ncindexith(grp->vars, v); assert(var && var->format_var_info); hdf5_var = (NC_HDF5_VAR_INFO_T *)var->format_var_info; /* Scales themselves do not attach. But I really wish they * would. */ if (var->dimscale) + continue; + + /* Find the scale for each dimension, if any, and attach it. */ + for (d = 0; d < var->ndims; d++) { - /* If this is a multidimensional coordinate variable, it will - * have a special coords attribute (read earlier) with a list - * of the dimensions for this variable. */ - } - else /* not a dimscale... */ - { - /* Find the scale for each dimension, if any, and attach it. */ - for (d = 0; d < var->ndims; d++) + /* Is there a dimscale for this dimension? */ + if (var->dimscale_attached) { - /* Is there a dimscale for this dimension? */ - if (var->dimscale_attached) + if (!var->dimscale_attached[d]) { - if (!var->dimscale_attached[d]) - { - NC_HDF5_DIM_INFO_T *hdf5_dim1; - hid_t dim_datasetid; /* Dataset ID for dimension */ - dim1 = var->dim[d]; - assert(dim1 && dim1->hdr.id == var->dimids[d] && dim1->format_dim_info); - hdf5_dim1 = (NC_HDF5_DIM_INFO_T *)dim1->format_dim_info; - - LOG((2, "%s: attaching scale for dimid %d to var %s", - __func__, var->dimids[d], var->hdr.name)); - - /* Find dataset ID for dimension */ - if (dim1->coord_var) - dim_datasetid = ((NC_HDF5_VAR_INFO_T *)(dim1->coord_var->format_var_info))->hdf_datasetid; - else - dim_datasetid = hdf5_dim1->hdf_dimscaleid; - if(!(dim_datasetid > 0)) - assert(dim_datasetid > 0); - if (H5DSattach_scale(hdf5_var->hdf_datasetid, dim_datasetid, d) < 0) - BAIL(NC_EHDFERR); - var->dimscale_attached[d] = NC_TRUE; - } + hid_t dsid; /* Dataset ID for dimension */ + assert(var->dim[d] && var->dim[d]->hdr.id == var->dimids[d] && + var->dim[d]->format_dim_info); - /* If we didn't find a dimscale to attach, that's a problem! */ - if (!var->dimscale_attached[d]) - { - LOG((0, "no dimscale found!")); - return NC_EDIMSCALE; - } + LOG((2, "%s: attaching scale for dimid %d to var %s", + __func__, var->dimids[d], var->hdr.name)); + + /* Find dataset ID for dimension */ + if (var->dim[d]->coord_var) + dsid = ((NC_HDF5_VAR_INFO_T *)(var->dim[d]->coord_var->format_var_info))->hdf_datasetid; + else + dsid = ((NC_HDF5_DIM_INFO_T *)var->dim[d]->format_dim_info)->hdf_dimscaleid; + assert(dsid > 0); + + /* Attach the scale. */ + if (H5DSattach_scale(hdf5_var->hdf_datasetid, dsid, d) < 0) + return NC_EHDFERR; + var->dimscale_attached[d] = NC_TRUE; } } } } -exit: - return retval; + return NC_NOERR; } /** From 26239a0897f1c7ea494ac0962725b334eba9b393 Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Tue, 11 Dec 2018 07:21:09 -0700 Subject: [PATCH 12/24] cleaned up loop reattaching dimscales --- libhdf5/nc4hdf.c | 28 ++++++++++++---------------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/libhdf5/nc4hdf.c b/libhdf5/nc4hdf.c index 22c45225b5..a3eefa674b 100644 --- a/libhdf5/nc4hdf.c +++ b/libhdf5/nc4hdf.c @@ -1601,18 +1601,15 @@ write_var(NC_VAR_INFO_T *var, NC_GRP_INFO_T *grp, nc_bool_t write_dimid) } } - /* If this is not a dimension scale, do this stuff. */ + /* If this is not a dimension scale, remove any attached scales, + * and delete dimscale attributes from the var. */ if (var->was_coord_var && var->dimscale_attached) { /* If the variable already exists in the file, Remove any dimension scale * attributes from it, if they exist. */ - /* (The HDF5 Dimension Scale API should really have an API routine - * for making a dataset not a scale. -QAK) */ if (var->created) - { if ((retval = remove_coord_atts(hdf5_var->hdf_datasetid))) BAIL(retval); - } if (var->dimscale_attached) { @@ -1623,21 +1620,20 @@ write_var(NC_VAR_INFO_T *var, NC_GRP_INFO_T *grp, nc_bool_t write_dimid) { if (var->dimscale_attached[d]) { - hid_t dim_datasetid; /* Dataset ID for dimension */ - NC_DIM_INFO_T *dim1 = var->dim[d]; - NC_HDF5_DIM_INFO_T *hdf5_dim1; - assert(dim1 && dim1->hdr.id == var->dimids[d] && dim1->format_dim_info); - hdf5_dim1 = (NC_HDF5_DIM_INFO_T *)dim1->format_dim_info; + hid_t dsid; /* Dataset ID for dimension */ + assert(var->dim[d] && var->dim[d]->hdr.id == var->dimids[d] && + var->dim[d]->format_dim_info); /* Find dataset ID for dimension */ - if (dim1->coord_var) - dim_datasetid = ((NC_HDF5_VAR_INFO_T *)dim1->coord_var->format_var_info)->hdf_datasetid; + if (var->dim[d]->coord_var) + dsid = ((NC_HDF5_VAR_INFO_T *)var->dim[d]->coord_var->format_var_info)->hdf_datasetid; else - dim_datasetid = hdf5_dim1->hdf_dimscaleid; - assert(dim_datasetid > 0); + dsid = ((NC_HDF5_DIM_INFO_T *)var->dim[d]->format_dim_info)->hdf_dimscaleid; + assert(dsid > 0); - if (H5DSdetach_scale(hdf5_var->hdf_datasetid, dim_datasetid, d) < 0) - BAIL(NC_EHDFERR); + /* Detach this dim scale. */ + if (H5DSdetach_scale(hdf5_var->hdf_datasetid, dsid, d) < 0) + return NC_EHDFERR; var->dimscale_attached[d] = NC_FALSE; } } From 1a0cfb729e914adfdff3e835cc39690f93644a89 Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Tue, 11 Dec 2018 08:10:08 -0700 Subject: [PATCH 13/24] fixed error handling in write_var() --- libhdf5/nc4hdf.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/libhdf5/nc4hdf.c b/libhdf5/nc4hdf.c index a3eefa674b..17e62b53ef 100644 --- a/libhdf5/nc4hdf.c +++ b/libhdf5/nc4hdf.c @@ -1609,7 +1609,7 @@ write_var(NC_VAR_INFO_T *var, NC_GRP_INFO_T *grp, nc_bool_t write_dimid) * attributes from it, if they exist. */ if (var->created) if ((retval = remove_coord_atts(hdf5_var->hdf_datasetid))) - BAIL(retval); + return retval; if (var->dimscale_attached) { @@ -1645,7 +1645,7 @@ write_var(NC_VAR_INFO_T *var, NC_GRP_INFO_T *grp, nc_bool_t write_dimid) { /* Free the HDF5 dataset id. */ if (hdf5_var->hdf_datasetid && H5Dclose(hdf5_var->hdf_datasetid) < 0) - BAIL(NC_EHDFERR); + return NC_EHDFERR; hdf5_var->hdf_datasetid = 0; /* Now delete the variable. */ @@ -1664,7 +1664,7 @@ write_var(NC_VAR_INFO_T *var, NC_GRP_INFO_T *grp, nc_bool_t write_dimid) if (write_dimid && var->ndims) if ((retval = write_netcdf4_dimid(hdf5_var->hdf_datasetid, var->dimids[0]))) - BAIL(retval); + return retval; } if (replace_existing_var) @@ -1695,13 +1695,11 @@ write_var(NC_VAR_INFO_T *var, NC_GRP_INFO_T *grp, nc_bool_t write_dimid) { /* Write attributes for this var. */ if ((retval = write_attlist(var->att, var->hdr.id, grp))) - BAIL(retval); + return retval; var->attr_dirty = NC_FALSE; } return NC_NOERR; -exit: - return retval; } /** From 8e1d781ea33902dab604bb8e4370add4dfc1d0e8 Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Tue, 11 Dec 2018 09:28:23 -0700 Subject: [PATCH 14/24] fixed error handling in write_dim(), also converted dimscale creation to H5Dcreate2() --- libhdf5/nc4hdf.c | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/libhdf5/nc4hdf.c b/libhdf5/nc4hdf.c index 17e62b53ef..4e1a304c3b 100644 --- a/libhdf5/nc4hdf.c +++ b/libhdf5/nc4hdf.c @@ -1717,9 +1717,11 @@ write_var(NC_VAR_INFO_T *var, NC_GRP_INFO_T *grp, nc_bool_t write_dimid) static int write_dim(NC_DIM_INFO_T *dim, NC_GRP_INFO_T *grp, nc_bool_t write_dimid) { + hid_t spaceid = -1, create_propid = -1; NC_HDF5_GRP_INFO_T *hdf5_grp; NC_HDF5_DIM_INFO_T *hdf5_dim; - int retval; + hsize_t *new_size = NULL; + int retval = NC_NOERR; assert(dim && dim->format_dim_info && grp && grp->format_grp_info); @@ -1733,14 +1735,13 @@ write_dim(NC_DIM_INFO_T *dim, NC_GRP_INFO_T *grp, nc_bool_t write_dimid) * without an associated variable.) */ if (!hdf5_dim->hdf_dimscaleid) { - hid_t spaceid, create_propid; hsize_t dims[1], max_dims[1], chunk_dims[1] = {1}; char dimscale_wo_var[NC_MAX_NAME]; LOG((4, "%s: creating dim %s", __func__, dim->hdr.name)); /* Sanity check */ - assert(NULL == dim->coord_var); + assert(!dim->coord_var); /* Create a property list. If this dimension scale is * unlimited (i.e. it's an unlimited dimension), then set @@ -1748,7 +1749,7 @@ write_dim(NC_DIM_INFO_T *dim, NC_GRP_INFO_T *grp, nc_bool_t write_dimid) if ((create_propid = H5Pcreate(H5P_DATASET_CREATE)) < 0) BAIL(NC_EHDFERR); - /* RJ: this suppose to be FALSE that is defined in H5 private.h as 0 */ + /* Turn off recording of times associated with this object. */ if (H5Pset_obj_track_times(create_propid,0)<0) BAIL(NC_EHDFERR); @@ -1765,20 +1766,18 @@ write_dim(NC_DIM_INFO_T *dim, NC_GRP_INFO_T *grp, nc_bool_t write_dimid) if ((spaceid = H5Screate_simple(1, dims, max_dims)) < 0) BAIL(NC_EHDFERR); + /* Turn on creation-order tracking. */ if (H5Pset_attr_creation_order(create_propid, H5P_CRT_ORDER_TRACKED| H5P_CRT_ORDER_INDEXED) < 0) BAIL(NC_EHDFERR); /* Create the dataset that will be the dimension scale. */ - LOG((4, "%s: about to H5Dcreate1 a dimscale dataset %s", __func__, dim->hdr.name)); - if ((hdf5_dim->hdf_dimscaleid = H5Dcreate1(hdf5_grp->hdf_grpid, dim->hdr.name, H5T_IEEE_F32BE, - spaceid, create_propid)) < 0) - BAIL(NC_EHDFERR); - - /* Close the spaceid and create_propid. */ - if (H5Sclose(spaceid) < 0) - BAIL(NC_EHDFERR); - if (H5Pclose(create_propid) < 0) + LOG((4, "%s: about to H5Dcreate1 a dimscale dataset %s", __func__, + dim->hdr.name)); + if ((hdf5_dim->hdf_dimscaleid = H5Dcreate2(hdf5_grp->hdf_grpid, dim->hdr.name, + H5T_IEEE_F32BE, spaceid, + H5P_DEFAULT, create_propid, + H5P_DEFAULT)) < 0) BAIL(NC_EHDFERR); /* Indicate that this is a scale. Also indicate that not @@ -1798,11 +1797,10 @@ write_dim(NC_DIM_INFO_T *dim, NC_GRP_INFO_T *grp, nc_bool_t write_dimid) /* If this is a dimension without a variable, then update * the secret length information at the end of the NAME * attribute. */ - v1 = (NC_VAR_INFO_T*)ncindexlookup(grp->vars,dim->hdr.name); + v1 = (NC_VAR_INFO_T *)ncindexlookup(grp->vars, dim->hdr.name); if (v1) { NC_HDF5_VAR_INFO_T *hdf5_v1; - hsize_t *new_size = NULL; int d1; hdf5_v1 = (NC_HDF5_VAR_INFO_T *)v1->format_var_info; @@ -1816,11 +1814,8 @@ write_dim(NC_DIM_INFO_T *dim, NC_GRP_INFO_T *grp, nc_bool_t write_dimid) assert(v1->dim[d1] && v1->dim[d1]->hdr.id == v1->dimids[d1]); new_size[d1] = v1->dim[d1]->len; } - if (H5Dset_extent(hdf5_v1->hdf_datasetid, new_size) < 0) { - free(new_size); + if (H5Dset_extent(hdf5_v1->hdf_datasetid, new_size) < 0) BAIL(NC_EHDFERR); - } - free(new_size); } } @@ -1832,8 +1827,13 @@ write_dim(NC_DIM_INFO_T *dim, NC_GRP_INFO_T *grp, nc_bool_t write_dimid) if ((retval = write_netcdf4_dimid(hdf5_dim->hdf_dimscaleid, dim->hdr.id))) BAIL(retval); - return NC_NOERR; exit: + if (spaceid > 0 && H5Sclose(spaceid) < 0) + BAIL2(NC_EHDFERR); + if (create_propid > 0 && H5Pclose(create_propid) < 0) + BAIL2(NC_EHDFERR); + if (new_size) + free(new_size); return retval; } From 28aa22f8cff915246f2b68d18ac7c618b4045c7f Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Tue, 11 Dec 2018 09:33:46 -0700 Subject: [PATCH 15/24] cleanup and some comments for rec_write_metadata() --- libhdf5/nc4hdf.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/libhdf5/nc4hdf.c b/libhdf5/nc4hdf.c index 4e1a304c3b..3df7eebd9c 100644 --- a/libhdf5/nc4hdf.c +++ b/libhdf5/nc4hdf.c @@ -1873,11 +1873,9 @@ nc4_rec_write_metadata(NC_GRP_INFO_T *grp, nc_bool_t bad_coord_order) /* Set the pointers to the beginning of the list of dims & vars in this * group. */ - dim_index = 0; - var_index = 0; - /* prime the loop */ - dim = (NC_DIM_INFO_T*)ncindexith(grp->dim,dim_index); - var = (NC_VAR_INFO_T*)ncindexith(grp->vars,var_index); + dim = (NC_DIM_INFO_T *)ncindexith(grp->dim, dim_index); + var = (NC_VAR_INFO_T *)ncindexith(grp->vars, var_index); + /* Because of HDF5 ordering the dims and vars have to be stored in * this way to ensure that the dims and coordinate vars come out in * the correct order. */ @@ -1899,7 +1897,7 @@ nc4_rec_write_metadata(NC_GRP_INFO_T *grp, nc_bool_t bad_coord_order) coord_varid = dim->coord_var->hdr.id; found_coord = NC_TRUE; } - dim = (NC_DIM_INFO_T*)ncindexith(grp->dim,++dim_index); + dim = (NC_DIM_INFO_T *)ncindexith(grp->dim, ++dim_index); } /* Write each var. When we get to the coord var we are waiting @@ -1910,16 +1908,19 @@ nc4_rec_write_metadata(NC_GRP_INFO_T *grp, nc_bool_t bad_coord_order) return retval; if (found_coord && var->hdr.id == coord_varid) wrote_coord = NC_TRUE; - var = (NC_VAR_INFO_T*)ncindexith(grp->vars,++var_index); + var = (NC_VAR_INFO_T *)ncindexith(grp->vars, ++var_index); } } /* end while */ + /* Attach dimscales to vars in this group. */ if ((retval = attach_dimscales(grp))) return retval; /* If there are any child groups, write their metadata. */ - for(i=0;ichildren);i++) { - if((child_grp = (NC_GRP_INFO_T*)ncindexith(grp->children,i)) == NULL) continue; + for (i = 0; i < ncindexsize(grp->children); i++) + { + child_grp = (NC_GRP_INFO_T *)ncindexith(grp->children, i); + assert(child_grp); if ((retval = nc4_rec_write_metadata(child_grp, bad_coord_order))) return retval; } From dc1115ae76ada46357c532a3a6f0a3f2ccb86365 Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Tue, 11 Dec 2018 09:40:59 -0700 Subject: [PATCH 16/24] moved rec_match_dimscales() to hdf5open.c, made it faster by skipping already-identified dims --- include/hdf5internal.h | 1 - libhdf5/hdf5open.c | 220 ++++++++++++++++++++++++++++++++++++++++- 2 files changed, 219 insertions(+), 2 deletions(-) diff --git a/include/hdf5internal.h b/include/hdf5internal.h index aaa2a5ddb3..6a5ee7e765 100644 --- a/include/hdf5internal.h +++ b/include/hdf5internal.h @@ -105,7 +105,6 @@ int hdf5_set_log_level(); int rec_detach_scales(NC_GRP_INFO_T *grp, int dimid, hid_t dimscaleid); int rec_reattach_scales(NC_GRP_INFO_T *grp, int dimid, hid_t dimscaleid); int delete_existing_dimscale_dataset(NC_GRP_INFO_T *grp, int dimid, NC_DIM_INFO_T *dim); -int nc4_rec_match_dimscales(NC_GRP_INFO_T *grp); /* Write metadata. */ int nc4_rec_write_metadata(NC_GRP_INFO_T *grp, nc_bool_t bad_coord_order); diff --git a/libhdf5/hdf5open.c b/libhdf5/hdf5open.c index 0998195d48..a69a512f71 100644 --- a/libhdf5/hdf5open.c +++ b/libhdf5/hdf5open.c @@ -329,6 +329,224 @@ dimscale_visitor(hid_t did, unsigned dim, hid_t dsid, return 0; } +/** + * @internal For files without any netCDF-4 dimensions defined, create phony + * dimension to match the available datasets. + * + * @param grp Pointer to the group info. + * @param hdf_datasetid HDF5 datsetid for the var's dataset. + * @param var Pointer to the var info. + * + * @returns NC_NOERR No error. + * @returns NC_EHDFERR HDF5 returned an error. + * @returns NC_ENOMEM Out of memory. + * @author Ed Hartnett + */ +static int +create_phony_dims(NC_GRP_INFO_T *grp, hid_t hdf_datasetid, NC_VAR_INFO_T *var) +{ + NC_DIM_INFO_T *dim; + hid_t spaceid = 0; + hsize_t *h5dimlen = NULL, *h5dimlenmax = NULL; + int dataset_ndims; + int d; + int retval = NC_NOERR; + + /* Find the space information for this dimension. */ + if ((spaceid = H5Dget_space(hdf_datasetid)) < 0) + BAIL(NC_EHDFERR); + + /* Get the len of each dim in the space. */ + if (var->ndims) + { + /* Allocate storage for dim lens and max lens for this var. */ + if (!(h5dimlen = malloc(var->ndims * sizeof(hsize_t)))) + return NC_ENOMEM; + if (!(h5dimlenmax = malloc(var->ndims * sizeof(hsize_t)))) + BAIL(NC_ENOMEM); + + /* Get ndims, also len and mac len of all dims. */ + if ((dataset_ndims = H5Sget_simple_extent_dims(spaceid, h5dimlen, + h5dimlenmax)) < 0) + BAIL(NC_EHDFERR); + assert(dataset_ndims == var->ndims); + } + else + { + /* Make sure it's scalar. */ + assert(H5Sget_simple_extent_type(spaceid) == H5S_SCALAR); + } + + /* Create a phony dimension for each dimension in the dataset, + * unless there already is one the correct size. */ + for (d = 0; d < var->ndims; d++) + { + int k; + int match; + + /* Is there already a phony dimension of the correct size? */ + for (match=-1, k = 0; k < ncindexsize(grp->dim); k++) + { + dim = (NC_DIM_INFO_T *)ncindexith(grp->dim, k); + assert(dim); + if ((dim->len == h5dimlen[d]) && + ((h5dimlenmax[d] == H5S_UNLIMITED && dim->unlimited) || + (h5dimlenmax[d] != H5S_UNLIMITED && !dim->unlimited))) + {match = k; break;} + } + + /* Didn't find a phony dim? Then create one. */ + if (match < 0) + { + char phony_dim_name[NC_MAX_NAME + 1]; + sprintf(phony_dim_name, "phony_dim_%d", grp->nc4_info->next_dimid); + LOG((3, "%s: creating phony dim for var %s", __func__, var->hdr.name)); + + /* Add phony dim to metadata list. */ + if ((retval = nc4_dim_list_add(grp, phony_dim_name, h5dimlen[d], -1, &dim))) + BAIL(retval); + + /* Create struct for HDF5-specific dim info. */ + if (!(dim->format_dim_info = calloc(1, sizeof(NC_HDF5_DIM_INFO_T)))) + BAIL(NC_ENOMEM); + if (h5dimlenmax[d] == H5S_UNLIMITED) + dim->unlimited = NC_TRUE; + } + + /* The variable must remember the dimid. */ + var->dimids[d] = dim->hdr.id; + var->dim[d] = dim; + } /* next dim */ + +exit: + /* Free resources. */ + if (spaceid > 0 && H5Sclose(spaceid) < 0) + BAIL2(NC_EHDFERR); + if (h5dimlenmax) + free(h5dimlenmax); + if (h5dimlen) + free(h5dimlen); + + return retval; +} + +/** + * @internal Iterate through the vars in this file and make sure we've + * got a dimid and a pointer to a dim for each dimension. This may + * already have been done using the COORDINATES hidden attribute, in + * which case this function will not have to do anything. This is + * desirable because recurdively matching the dimscales (when + * necessary) is very much the slowest part of opening a file. + * + * @param grp Pointer to group info struct. + * + * @returns NC_NOERR No error. + * @returns NC_EHDFERR HDF5 returned an error. + * @returns NC_ENOMEM Out of memory. + * @author Ed Hartnett + */ +static int +rec_match_dimscales(NC_GRP_INFO_T *grp) +{ + NC_VAR_INFO_T *var; + NC_DIM_INFO_T *dim; + int retval = NC_NOERR; + int i; + + assert(grp && grp->hdr.name); + LOG((4, "%s: grp->hdr.name %s", __func__, grp->hdr.name)); + + /* Perform var dimscale match for child groups. */ + for (i = 0; i < ncindexsize(grp->children); i++) + if ((retval = rec_match_dimscales((NC_GRP_INFO_T *)ncindexith(grp->children, i)))) + return retval; + + /* Check all the vars in this group. If they have dimscale info, + * try and find a dimension for them. */ + for (i = 0; i < ncindexsize(grp->vars); i++) + { + NC_HDF5_VAR_INFO_T *hdf5_var; + int d; + + /* Get pointer to var and to the HDF5-specific var info. */ + var = (NC_VAR_INFO_T *)ncindexith(grp->vars, i); + assert(var && var->format_var_info); + hdf5_var = (NC_HDF5_VAR_INFO_T *)var->format_var_info; + + /* Check all vars and see if dim[i] != NULL if dimids[i] + * valid. Recall that dimids were initialized to -1. */ + for (d = 0; d < var->ndims; d++) + { + if (!var->dim[d]) + nc4_find_dim(grp, var->dimids[d], &var->dim[d], NULL); + } + + /* Skip dimension scale variables */ + if (!var->dimscale) + { + int d; + int j; + + /* Are there dimscales for this variable? */ + if (hdf5_var->dimscale_hdf5_objids) + { + for (d = 0; d < var->ndims; d++) + { + NC_GRP_INFO_T *g; + nc_bool_t finished = NC_FALSE; + LOG((5, "%s: var %s has dimscale info...", __func__, var->hdr.name)); + + /* If we already have the dimension, we don't need to + * match the dimscales. This is better because matching + * the dimscales is slow. */ + if (var->dim[d]) + continue; + + /* Now we have to try to match dimscales. Check this + * and parent groups. */ + for (g = grp; g && !finished; g = g->parent) + { + /* Check all dims in this group. */ + for (j = 0; j < ncindexsize(g->dim); j++) + { + /* Get the HDF5 specific dim info. */ + NC_HDF5_DIM_INFO_T *hdf5_dim; + dim = (NC_DIM_INFO_T *)ncindexith(g->dim, j); + assert(dim && dim->format_dim_info); + hdf5_dim = (NC_HDF5_DIM_INFO_T *)dim->format_dim_info; + + /* Check for exact match of fileno/objid arrays + * to find identical objects in HDF5 file. */ + if (hdf5_var->dimscale_hdf5_objids[d].fileno[0] == hdf5_dim->hdf5_objid.fileno[0] && + hdf5_var->dimscale_hdf5_objids[d].objno[0] == hdf5_dim->hdf5_objid.objno[0] && + hdf5_var->dimscale_hdf5_objids[d].fileno[1] == hdf5_dim->hdf5_objid.fileno[1] && + hdf5_var->dimscale_hdf5_objids[d].objno[1] == hdf5_dim->hdf5_objid.objno[1]) + { + LOG((4, "%s: for dimension %d, found dim %s", __func__, + d, dim->hdr.name)); + var->dimids[d] = dim->hdr.id; + var->dim[d] = dim; + finished = NC_TRUE; + break; + } + } /* next dim */ + } /* next grp */ + LOG((5, "%s: dimid for this dimscale is %d", __func__, + var->type_info->hdr.id)); + } /* next var->dim */ + } + else + { + /* No dimscales for this var! Invent phony dimensions. */ + if ((retval = create_phony_dims(grp, hdf5_var->hdf_datasetid, var))) + return retval; + } + } + } + + return retval; +} + /** * @internal Check for the attribute that indicates that netcdf * classic model is in use. @@ -555,7 +773,7 @@ nc4_open_file(const char *path, int mode, void* parameters, NC *nc) /* Now figure out which netCDF dims are indicated by the dimscale * information. */ - if ((retval = nc4_rec_match_dimscales(nc4_info->root_grp))) + if ((retval = rec_match_dimscales(nc4_info->root_grp))) BAIL(retval); #ifdef LOGGING From aaa5a50ca9dd45abf3e7ad751941180823d899db Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Tue, 11 Dec 2018 09:57:08 -0700 Subject: [PATCH 17/24] cleanup of hdf5open.c, now check for COORDINATES hidden att and use it to find dimids if available --- libhdf5/hdf5open.c | 572 +++++++++++++++++++++++++++------------------ 1 file changed, 346 insertions(+), 226 deletions(-) diff --git a/libhdf5/hdf5open.c b/libhdf5/hdf5open.c index a69a512f71..e5f86b94bf 100644 --- a/libhdf5/hdf5open.c +++ b/libhdf5/hdf5open.c @@ -42,7 +42,7 @@ static const int nc_type_size_g[NUM_TYPES] = {sizeof(char), sizeof(char), sizeof /** @internal These flags may not be set for open mode. */ static const int ILLEGAL_OPEN_FLAGS = (NC_MMAP); -/* From hdf5file.c. */ +/* From libsrc4, these are the netcdf-4 cache sizes. */ extern size_t nc4_chunk_cache_size; extern size_t nc4_chunk_cache_nelems; extern float nc4_chunk_cache_preemption; @@ -51,30 +51,31 @@ extern float nc4_chunk_cache_preemption; extern int NC4_open_image_file(NC_FILE_INFO_T* h5); /* Defined later in this file. */ -static int nc4_rec_read_metadata(NC_GRP_INFO_T *grp); +static int rec_read_metadata(NC_GRP_INFO_T *grp); /** - * @internal Struct to track information about objects in a group, for - * nc4_rec_read_metadata() - */ -typedef struct NC4_rec_read_metadata_obj_info + * @internal Struct to track HDF5 object info, for + * rec_read_metadata(). We get this info for every object in the + * HDF5 file when we H5Literate() over the file. */ +typedef struct hdf5_obj_info { hid_t oid; /* HDF5 object ID */ char oname[NC_MAX_NAME + 1]; /* Name of object */ H5G_stat_t statbuf; /* Information about the object */ - struct NC4_rec_read_metadata_obj_info *next; /* Pointer to next node in list */ -} NC4_rec_read_metadata_obj_info_t; + struct hdf5_obj_info *next; /* Pointer to next node in list */ +} hdf5_obj_info_t; /** * @internal User data struct for call to H5Literate() in - * nc4_rec_read_metadata(). Tracks the groups, named datatypes and - * datasets in the group, for later use. - */ -typedef struct NC4_rec_read_metadata_ud + * rec_read_metadata(). When iterating through the objects in a + * group, if we find child groups, we save their hdf5_obj_info_t + * object in a list. Then we processes them after completely + * processing the parent group. */ +typedef struct user_data { - NClist* grps; /* NClist */ + NClist *grps; /* NClist */ NC_GRP_INFO_T *grp; /* Pointer to parent group */ -} NC4_rec_read_metadata_ud_t; +} user_data_t; /* Custom iteration callback data */ typedef struct { @@ -238,12 +239,16 @@ get_type_info2(NC_FILE_INFO_T *h5, hid_t datasetid, /** * @internal This function reads the coordinates attribute used for - * multi-dimensional coordinates. + * multi-dimensional coordinates. It then sets var->dimids[], and + * attempts to find a pointer to the dims and sets var->dim[] as well. * * @param grp Group info pointer. * @param var Var info pointer. * - * @return NC_NOERR No error. + * @return ::NC_NOERR No error. + * @return ::NC_ENOTATT Attribute does not exist. + * @return ::NC_EATTMETA Attribute metadata error. + * @return ::NC_EHDFERR HDF5 error. * @author Ed Hartnett */ static int @@ -252,14 +257,21 @@ read_coord_dimids(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var) NC_HDF5_VAR_INFO_T *hdf5_var; hid_t coord_att_typeid = -1, coord_attid = -1, spaceid = -1; hssize_t npoints; - int retval = NC_NOERR; + htri_t attr_exists; int d; + int retval = NC_NOERR; assert(grp && var && var->format_var_info); /* Get HDF5-sepecific var info. */ hdf5_var = (NC_HDF5_VAR_INFO_T *)var->format_var_info; + /* Does the COORDINATES att exist? */ + if ((attr_exists = H5Aexists(hdf5_var->hdf_datasetid, COORDINATES)) < 0) + return NC_EHDFERR; + if (!attr_exists) + return NC_ENOTATT; + /* There is a hidden attribute telling us the ids of the * dimensions that apply to this multi-dimensional coordinate * variable. Read it. */ @@ -280,9 +292,9 @@ read_coord_dimids(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var) if (npoints != var->ndims) BAIL(NC_EATTMETA); + /* Read the dimids for this var. */ if (H5Aread(coord_attid, coord_att_typeid, var->dimids) < 0) BAIL(NC_EATTMETA); - LOG((4, "dimscale %s is multidimensional and has coords", var->hdr.name)); /* Update var->dim field based on the var->dimids. Ok if does not * find a dim at this time, but if found set it. */ @@ -561,7 +573,7 @@ rec_match_dimscales(NC_GRP_INFO_T *grp) static int check_for_classic_model(NC_GRP_INFO_T *root_grp, int *is_classic) { - htri_t attr_exists = -1; + htri_t attr_exists; hid_t grpid; /* Check inputs. */ @@ -746,7 +758,7 @@ nc4_open_file(const char *path, int mode, void* parameters, NC *nc) * information may be difficult to resolve here, if, for example, a * dataset of user-defined type is encountered before the * definition of that type. */ - if ((retval = nc4_rec_read_metadata(nc4_info->root_grp))) + if ((retval = rec_read_metadata(nc4_info->root_grp))) BAIL(retval); /* Check for classic model attribute. */ @@ -755,21 +767,10 @@ nc4_open_file(const char *path, int mode, void* parameters, NC *nc) if (is_classic) nc4_info->cmode |= NC_CLASSIC_MODEL; - /* See if this file contained _NCPROPERTIES, - * and if yes, process it, if no, then fake it. - */ - if(nc4_info->root_grp != NULL) { - /* Since _NCProperties does not exist as an NC_ATT_INFO object, - * we need to check using the HDF5 API - */ - if((retval = NC4_read_ncproperties(nc4_info))) - BAIL(retval); - } - - if ((retval = check_for_classic_model(nc4_info->root_grp, &is_classic))) + /* See if this file contained _NCPROPERTIES, and if yes, process + * it, if no, then fake it. */ + if ((retval = NC4_read_ncproperties(nc4_info))) BAIL(retval); - if (is_classic) - nc4_info->cmode |= NC_CLASSIC_MODEL; /* Now figure out which netCDF dims are indicated by the dimscale * information. */ @@ -851,119 +852,36 @@ NC4_open(const char *path, int mode, int basepe, size_t *chunksizehintp, } /** - * @internal This function is called by read_dataset(), (which is called - * by nc4_rec_read_metadata()) when a netCDF variable is found in the - * file. This function reads in all the metadata about the var, - * including the attributes. + * @internal Find out what filters are applied to this HDF5 dataset, + * fletcher32, deflate, and/or shuffle. All other filters are just + * dumped The possible values of * - * @param grp Pointer to group info struct. - * @param datasetid HDF5 dataset ID. - * @param obj_name Name of the HDF5 object to read. - * @param ndims Number of dimensions. - * @param dim + * @param propid ID of HDF5 var creation properties list. + * @param var Pointer to NC_VAR_INFO_T for this variable. * * @return ::NC_NOERR No error. - * @return ::NC_EBADID Bad ncid. * @return ::NC_ENOMEM Out of memory. * @return ::NC_EHDFERR HDF5 returned error. - * @return ::NC_EVARMETA Error with var metadata. - * @author Ed Hartnett + * @author Dennis Heimbigner, Ed Hartnett */ -static int -read_var(NC_GRP_INFO_T *grp, hid_t datasetid, const char *obj_name, - size_t ndims, NC_DIM_INFO_T *dim) +static int get_filter_info(hid_t propid, NC_VAR_INFO_T *var) { - NC_VAR_INFO_T *var = NULL; - NC_HDF5_VAR_INFO_T *hdf5_var; - hid_t access_pid = 0; - int incr_id_rc = 0; /* Whether dataset ID's ref count has been incremented */ - int d; H5Z_filter_t filter; int num_filters; unsigned int cd_values_zip[CD_NELEMS_ZLIB]; size_t cd_nelems = CD_NELEMS_ZLIB; - hid_t propid = 0; - H5D_fill_value_t fill_status; - H5D_layout_t layout; - hsize_t chunksize[NC_MAX_VAR_DIMS] = {0}; - int retval = NC_NOERR; - double rdcc_w0; int f; - char* finalname = NULL; - - assert(obj_name && grp); - LOG((4, "%s: obj_name %s", __func__, obj_name)); - - /* Check for a weird case: a non-coordinate variable that has the - * same name as a dimension. It's legal in netcdf, and requires - * that the HDF5 dataset name be changed. */ - if (strlen(obj_name) > strlen(NON_COORD_PREPEND) && - !strncmp(obj_name, NON_COORD_PREPEND, strlen(NON_COORD_PREPEND))) - { - /* Allocate space for the name. */ - if(finalname) {free(finalname); finalname = NULL;} - if (!(finalname = malloc(((strlen(obj_name) - - strlen(NON_COORD_PREPEND))+ 1) * sizeof(char)))) - BAIL(NC_ENOMEM); - strcpy(finalname, &obj_name[strlen(NON_COORD_PREPEND)]); - } else - finalname = strdup(obj_name); - - /* Add a variable to the end of the group's var list. */ - if ((retval = nc4_var_list_add(grp, finalname, ndims, &var))) - BAIL(retval); - - /* Add storage for HDF5-specific var info. */ - if (!(var->format_var_info = calloc(1, sizeof(NC_HDF5_VAR_INFO_T)))) - BAIL(NC_ENOMEM); - hdf5_var = (NC_HDF5_VAR_INFO_T *)var->format_var_info; - - /* Fill in what we already know. */ - hdf5_var->hdf_datasetid = datasetid; - H5Iinc_ref(hdf5_var->hdf_datasetid); /* Increment number of objects using ID */ - incr_id_rc++; /* Indicate that we've incremented the ref. count (for errors) */ - var->created = NC_TRUE; - - /* Get the current chunk cache settings. */ - if ((access_pid = H5Dget_access_plist(datasetid)) < 0) - BAIL(NC_EVARMETA); - - /* Learn about current chunk cache settings. */ - if ((H5Pget_chunk_cache(access_pid, &(var->chunk_cache_nelems), - &(var->chunk_cache_size), &rdcc_w0)) < 0) - BAIL(NC_EHDFERR); - var->chunk_cache_preemption = rdcc_w0; - /* Find out what filters are applied to this HDF5 dataset, - * fletcher32, deflate, and/or shuffle. All other filters are - * just dumped */ - if ((propid = H5Dget_create_plist(datasetid)) < 0) - BAIL(NC_EHDFERR); + assert(var); - /* Get the chunking info for non-scalar vars. */ - if ((layout = H5Pget_layout(propid)) < -1) - BAIL(NC_EHDFERR); - if (layout == H5D_CHUNKED) - { - if (H5Pget_chunk(propid, NC_MAX_VAR_DIMS, chunksize) < 0) - BAIL(NC_EHDFERR); - if (!(var->chunksizes = malloc(var->ndims * sizeof(size_t)))) - BAIL(NC_ENOMEM); - for (d = 0; d < var->ndims; d++) - var->chunksizes[d] = chunksize[d]; - } - else if (layout == H5D_CONTIGUOUS || layout == H5D_COMPACT) - var->contiguous = NC_TRUE; - - /* The possible values of filter (which is just an int) can be - * found in H5Zpublic.h. */ if ((num_filters = H5Pget_nfilters(propid)) < 0) - BAIL(NC_EHDFERR); + return NC_EHDFERR; + for (f = 0; f < num_filters; f++) { - if ((filter = H5Pget_filter2(propid, f, NULL, &cd_nelems, - cd_values_zip, 0, NULL, NULL)) < 0) - BAIL(NC_EHDFERR); + if ((filter = H5Pget_filter2(propid, f, NULL, &cd_nelems, cd_values_zip, + 0, NULL, NULL)) < 0) + return NC_EHDFERR; switch (filter) { case H5Z_FILTER_SHUFFLE: @@ -978,7 +896,7 @@ read_var(NC_GRP_INFO_T *grp, hid_t datasetid, const char *obj_name, var->deflate = NC_TRUE; if (cd_nelems != CD_NELEMS_ZLIB || cd_values_zip[0] > NC_MAX_DEFLATE_LEVEL) - BAIL(NC_EHDFERR); + return NC_EHDFERR; var->deflate_level = cd_values_zip[0]; break; @@ -993,10 +911,10 @@ read_var(NC_GRP_INFO_T *grp, hid_t datasetid, const char *obj_name, which in the case of szip, differs from users original nparams */ var->params = (unsigned int*)calloc(1,sizeof(unsigned int)*cd_nelems); if(var->params == NULL) - BAIL(NC_ENOMEM); + return NC_ENOMEM; if((filter = H5Pget_filter2(propid, f, NULL, &cd_nelems, var->params, 0, NULL, NULL)) < 0) - BAIL(NC_EHDFERR); + return NC_EHDFERR; /* fix up the parameters and the #params */ var->nparams = cd_nelems; } @@ -1011,26 +929,36 @@ read_var(NC_GRP_INFO_T *grp, hid_t datasetid, const char *obj_name, /* We have to re-read the parameters based on actual nparams */ var->params = (unsigned int*)calloc(1,sizeof(unsigned int)*var->nparams); if(var->params == NULL) - BAIL(NC_ENOMEM); + return NC_ENOMEM; if((filter = H5Pget_filter2(propid, f, NULL, &cd_nelems, var->params, 0, NULL, NULL)) < 0) - BAIL(NC_EHDFERR); + return NC_EHDFERR; } break; } } + return NC_NOERR; +} - /* Learn all about the type of this variable. */ - if ((retval = get_type_info2(grp->nc4_info, datasetid, - &var->type_info))) - BAIL(retval); - - /* Indicate that the variable has a pointer to the type */ - var->type_info->rc++; +/** + * @internal Learn if there is a fill value defined for a variable, + * and, if so, its value. + * + * @param propid ID of HDF5 var creation properties list. + * @param var Pointer to NC_VAR_INFO_T for this variable. + * + * @return ::NC_NOERR No error. + * @return ::NC_ENOMEM Out of memory. + * @return ::NC_EHDFERR HDF5 returned error. + * @author Dennis Heimbigner, Ed Hartnett + */ +static int get_fill_info(hid_t propid, NC_VAR_INFO_T *var) +{ + H5D_fill_value_t fill_status; /* Is there a fill value associated with this dataset? */ if (H5Pfill_value_defined(propid, &fill_status) < 0) - BAIL(NC_EHDFERR); + return NC_EHDFERR; /* Get the fill value, if there is one defined. */ if (fill_status == H5D_FILL_VALUE_USER_DEFINED) @@ -1041,29 +969,95 @@ read_var(NC_GRP_INFO_T *grp, hid_t datasetid, const char *obj_name, if (var->type_info->nc_type_class == NC_VLEN) { if (!(var->fill_value = malloc(sizeof(nc_vlen_t)))) - BAIL(NC_ENOMEM); + return NC_ENOMEM; } else if (var->type_info->nc_type_class == NC_STRING) { if (!(var->fill_value = malloc(sizeof(char *)))) - BAIL(NC_ENOMEM); + return NC_ENOMEM; } else { assert(var->type_info->size); if (!(var->fill_value = malloc(var->type_info->size))) - BAIL(NC_ENOMEM); + return NC_ENOMEM; } } /* Get the fill value from the HDF5 property lust. */ if (H5Pget_fill_value(propid, ((NC_HDF5_TYPE_INFO_T *)var->type_info->format_type_info)->native_hdf_typeid, var->fill_value) < 0) - BAIL(NC_EHDFERR); + return NC_EHDFERR; } else var->no_fill = NC_TRUE; + return NC_NOERR; +} + +/** + * @internal Learn the chunking settings of a var. + * + * @param propid ID of HDF5 var creation properties list. + * @param var Pointer to NC_VAR_INFO_T for this variable. + * + * @return ::NC_NOERR No error. + * @return ::NC_ENOMEM Out of memory. + * @return ::NC_EHDFERR HDF5 returned error. + * @author Dennis Heimbigner, Ed Hartnett + */ +static int get_chunking_info(hid_t propid, NC_VAR_INFO_T *var) +{ + H5D_layout_t layout; + hsize_t chunksize[H5S_MAX_RANK] = {0}; + int d; + + /* Get the chunking info the var. */ + if ((layout = H5Pget_layout(propid)) < -1) + return NC_EHDFERR; + + /* Remember the layout and, if chunked, the chunksizes. */ + if (layout == H5D_CHUNKED) + { + if (H5Pget_chunk(propid, H5S_MAX_RANK, chunksize) < 0) + return NC_EHDFERR; + if (!(var->chunksizes = malloc(var->ndims * sizeof(size_t)))) + return NC_ENOMEM; + for (d = 0; d < var->ndims; d++) + var->chunksizes[d] = chunksize[d]; + } + else if (layout == H5D_CONTIGUOUS || layout == H5D_COMPACT) + var->contiguous = NC_TRUE; + + return NC_NOERR; +} + +/** + * @internal This function reads scale info for vars, whether there + * are scales or not. + * + * @param grp Pointer to group info struct. + * @param dim Pointer to dim info struct if this is a scale, NULL + * otherwise. + * @param var Pointer to var info struct. + * @param hdf5_var Pointer to HDF5 var info struct. + * @param ndims Number of dims for this var. + * @param datasetid HDF5 datasetid. + * + * @return ::NC_NOERR No error. + * @return ::NC_EBADID Bad ncid. + * @return ::NC_ENOMEM Out of memory. + * @return ::NC_EHDFERR HDF5 returned error. + * @return ::NC_EVARMETA Error with var metadata. + * @author Ed Hartnett, Dennis Heimbigner + */ +static int +get_scale_info(NC_GRP_INFO_T *grp, NC_DIM_INFO_T *dim, NC_VAR_INFO_T *var, + NC_HDF5_VAR_INFO_T *hdf5_var, int ndims, hid_t datasetid) +{ + int d; + int retval; + /* If it's a scale, mark it as such. */ if (dim) { @@ -1072,22 +1066,17 @@ read_var(NC_GRP_INFO_T *grp, hid_t datasetid, const char *obj_name, if (var->ndims > 1) { if ((retval = read_coord_dimids(grp, var))) - BAIL(retval); + return retval; } else { - /* sanity check */ - assert(0 == strcmp(var->hdr.name, dim->hdr.name)); - + assert(!strcmp(var->hdr.name, dim->hdr.name)); var->dimids[0] = dim->hdr.id; var->dim[0] = dim; } dim->coord_var = var; } - /* If this is not a scale, but has scales, iterate - * through them. (i.e. this is a variable that is not a - * coordinate variable) */ - else + else /* Not a scale. */ { int num_scales = 0; @@ -1103,24 +1092,137 @@ read_var(NC_GRP_INFO_T *grp, hid_t datasetid, const char *obj_name, /* Allocate space to remember whether the dimscale has been * attached for each dimension. */ if (!(var->dimscale_attached = calloc(ndims, sizeof(nc_bool_t)))) - BAIL(NC_ENOMEM); + return NC_ENOMEM; /* Store id information allowing us to match hdf5 * dimscales to netcdf dimensions. */ if (!(hdf5_var->dimscale_hdf5_objids = malloc(ndims * sizeof(struct hdf5_objid)))) - BAIL(NC_ENOMEM); + return NC_ENOMEM; for (d = 0; d < var->ndims; d++) { if (H5DSiterate_scales(hdf5_var->hdf_datasetid, d, NULL, dimscale_visitor, &(hdf5_var->dimscale_hdf5_objids[d])) < 0) - BAIL(NC_EHDFERR); + return NC_EHDFERR; var->dimscale_attached[d] = NC_TRUE; } } } - /* Read variable attributes. */ + return NC_NOERR; +} + +/** + * @internal This function is called by read_dataset(), (which is + * called by rec_read_metadata()) when a netCDF variable is found in + * the file. This function reads in all the metadata about the + * var. Attributes are not read until the user asks for information + * about one of them. + * + * @param grp Pointer to group info struct. + * @param datasetid HDF5 dataset ID. + * @param obj_name Name of the HDF5 object to read. + * @param ndims Number of dimensions. + * @param dim If non-NULL, then this var is a coordinate var for a + * dimension, and this points to the info for that dimension. + * + * @return ::NC_NOERR No error. + * @return ::NC_EBADID Bad ncid. + * @return ::NC_ENOMEM Out of memory. + * @return ::NC_EHDFERR HDF5 returned error. + * @return ::NC_EVARMETA Error with var metadata. + * @author Ed Hartnett, Dennis Heimbigner + */ +static int +read_var(NC_GRP_INFO_T *grp, hid_t datasetid, const char *obj_name, + size_t ndims, NC_DIM_INFO_T *dim) +{ + NC_VAR_INFO_T *var = NULL; + NC_HDF5_VAR_INFO_T *hdf5_var; + hid_t access_pid = 0; + int incr_id_rc = 0; /* Whether dataset ID's ref count has been incremented */ + hid_t propid = 0; + int retval = NC_NOERR; + double rdcc_w0; + char *finalname = NULL; + + assert(obj_name && grp); + LOG((4, "%s: obj_name %s", __func__, obj_name)); + + /* Check for a weird case: a non-coordinate variable that has the + * same name as a dimension. It's legal in netcdf, and requires + * that the HDF5 dataset name be changed. */ + if (strlen(obj_name) > strlen(NON_COORD_PREPEND) && + !strncmp(obj_name, NON_COORD_PREPEND, strlen(NON_COORD_PREPEND))) + { + /* Allocate space for the name. */ + if (!(finalname = malloc(((strlen(obj_name) - + strlen(NON_COORD_PREPEND))+ 1) * sizeof(char)))) + BAIL(NC_ENOMEM); + strcpy(finalname, &obj_name[strlen(NON_COORD_PREPEND)]); + } else + finalname = strdup(obj_name); + + /* Add a variable to the end of the group's var list. */ + if ((retval = nc4_var_list_add(grp, finalname, ndims, &var))) + BAIL(retval); + + /* Add storage for HDF5-specific var info. */ + if (!(var->format_var_info = calloc(1, sizeof(NC_HDF5_VAR_INFO_T)))) + BAIL(NC_ENOMEM); + hdf5_var = (NC_HDF5_VAR_INFO_T *)var->format_var_info; + + /* Fill in what we already know. */ + hdf5_var->hdf_datasetid = datasetid; + H5Iinc_ref(hdf5_var->hdf_datasetid); /* Increment number of objects using ID */ + incr_id_rc++; /* Indicate that we've incremented the ref. count (for errors) */ + var->created = NC_TRUE; + + /* Get the current chunk cache settings. */ + if ((access_pid = H5Dget_access_plist(datasetid)) < 0) + BAIL(NC_EVARMETA); + + /* Learn about current chunk cache settings. */ + if ((H5Pget_chunk_cache(access_pid, &(var->chunk_cache_nelems), + &(var->chunk_cache_size), &rdcc_w0)) < 0) + BAIL(NC_EHDFERR); + var->chunk_cache_preemption = rdcc_w0; + + /* Get the dataset creation properties. */ + if ((propid = H5Dget_create_plist(datasetid)) < 0) + BAIL(NC_EHDFERR); + + /* Get var chunking info. */ + if ((retval = get_chunking_info(propid, var))) + BAIL(retval); + + /* Get filter info for a var. */ + if ((retval = get_filter_info(propid, var))) + BAIL(retval); + + /* Learn all about the type of this variable. */ + if ((retval = get_type_info2(grp->nc4_info, datasetid, &var->type_info))) + BAIL(retval); + + /* Indicate that the variable has a pointer to the type */ + var->type_info->rc++; + + /* Get fill value, if defined. */ + if ((retval = get_fill_info(propid, var))) + BAIL(retval); + + /* Try and read the dimids from the COORDINATES attribute. If it's + * not present, we will have to do dimsscale matching to locate the + * dims for this var. */ + retval = read_coord_dimids(grp, var); + if (retval && retval != NC_ENOTATT) + return retval; + + /* Handle scale info. */ + if ((retval = get_scale_info(grp, dim, var, hdf5_var, ndims, datasetid))) + BAIL(retval); + + /* Don't read variable attributes until user asks for one. */ var->atts_not_read = 1; /* Is this a deflated variable with a chunksize greater than the @@ -1129,7 +1231,8 @@ read_var(NC_GRP_INFO_T *grp, hid_t datasetid, const char *obj_name, BAIL(retval); exit: - if(finalname) free(finalname); + if (finalname) + free(finalname); if (retval) { if (incr_id_rc && H5Idec_ref(datasetid) < 0) @@ -1917,16 +2020,16 @@ nc4_read_atts(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var) } /** - * @internal This function is called by read_dataset when a dimension - * scale dataset is encountered. It reads in the dimension data - * (creating a new NC_DIM_INFO_T object), and also checks to see if - * this is a dimension without a variable - that is, a coordinate + * @internal This function is called by read_dataset() when a + * dimension scale dataset is encountered. It reads in the dimension + * data (creating a new NC_DIM_INFO_T object), and also checks to see + * if this is a dimension without a variable - that is, a coordinate * dimension which does not have any coordinate data. * * @param grp Pointer to group info struct. * @param datasetid The HDF5 dataset ID. - * @param obj_name - * @param statbuf + * @param obj_name The HDF5 object name. + * @param statbuf HDF5 status buffer. * @param scale_size Size of dimension scale. * @param max_scale_size Maximum size of dim scale. * @param dim Pointer to pointer that gets new dim info struct. @@ -1937,8 +2040,8 @@ nc4_read_atts(NC_GRP_INFO_T *grp, NC_VAR_INFO_T *var) */ static int read_scale(NC_GRP_INFO_T *grp, hid_t datasetid, const char *obj_name, - const H5G_stat_t *statbuf, hsize_t scale_size, hsize_t max_scale_size, - NC_DIM_INFO_T **dim) + const H5G_stat_t *statbuf, hsize_t scale_size, + hsize_t max_scale_size, NC_DIM_INFO_T **dim) { NC_DIM_INFO_T *new_dim; /* Dimension added to group */ NC_HDF5_DIM_INFO_T *new_hdf5_dim; /* HDF5-specific dim info. */ @@ -1947,10 +2050,12 @@ read_scale(NC_GRP_INFO_T *grp, hid_t datasetid, const char *obj_name, hid_t attid = -1; /* ID of hidden attribute (to store dim ID) */ int dimscale_created = 0; /* Remember if a dimension was created (for error recovery) */ short initial_next_dimid = grp->nc4_info->next_dimid;/* Retain for error recovery */ - int retval; size_t len = 0; int too_long = NC_FALSE; int assigned_id = -1; + int retval = NC_NOERR; + + assert(grp && dim); /* Does this dataset have a hidden attribute that tells us its * dimid? If so, read it. */ @@ -1969,6 +2074,8 @@ read_scale(NC_GRP_INFO_T *grp, hid_t datasetid, const char *obj_name, grp->nc4_info->next_dimid = assigned_id + 1; } + /* Get dim size. On machines with a size_t of less than 8 bytes, it + * is possible for a dimension to be too long. */ if (SIZEOF_SIZE_T < 8 && scale_size > NC_MAX_UINT) { len = NC_MAX_UINT; @@ -1980,16 +2087,17 @@ read_scale(NC_GRP_INFO_T *grp, hid_t datasetid, const char *obj_name, /* Create the dimension for this scale. */ if ((retval = nc4_dim_list_add(grp, obj_name, len, assigned_id, &new_dim))) BAIL(retval); + new_dim->too_long = too_long; /* Create struct for HDF5-specific dim info. */ if (!(new_dim->format_dim_info = calloc(1, sizeof(NC_HDF5_DIM_INFO_T)))) BAIL(NC_ENOMEM); new_hdf5_dim = (NC_HDF5_DIM_INFO_T *)new_dim->format_dim_info; - new_dim->too_long = too_long; - dimscale_created++; + /* Remember these 4 values to uniquely identify this dataset in the + * HDF5 file. */ new_hdf5_dim->hdf5_objid.fileno[0] = statbuf->fileno[0]; new_hdf5_dim->hdf5_objid.fileno[1] = statbuf->fileno[1]; new_hdf5_dim->hdf5_objid.objno[0] = statbuf->objno[0]; @@ -2012,6 +2120,8 @@ read_scale(NC_GRP_INFO_T *grp, hid_t datasetid, const char *obj_name, { size_t len = 0, *lenp = &len; + /* Find actual length by checking all datasets that use + * this dim. */ if ((retval = nc4_find_dim_len(grp, new_dim->hdr.id, &lenp))) BAIL(retval); new_dim->len = *lenp; @@ -2024,17 +2134,16 @@ read_scale(NC_GRP_INFO_T *grp, hid_t datasetid, const char *obj_name, } } - /* Set the dimension created */ + /* Set the dimension created. */ *dim = new_dim; exit: - /* Close the hidden attribute, if it was opened (error, or no - * error) */ + /* Close the hidden attribute, if it was opened. */ if (attid > 0 && H5Aclose(attid) < 0) BAIL2(NC_EHDFERR); /* On error, undo any dimscale creation */ - if (retval < 0 && dimscale_created) + if (retval && dimscale_created) { /* free the dimension */ if ((retval = nc4_dim_list_del(grp, new_dim))) @@ -2048,8 +2157,8 @@ read_scale(NC_GRP_INFO_T *grp, hid_t datasetid, const char *obj_name, } /** - * @internal This function is called when nc4_rec_read_metadata - * encounters an HDF5 dataset when reading a file. + * @internal Read a HDF5 dataset. This function is called when + * read_hdf5_obj() encounters an HDF5 dataset when opening a file. * * @param grp Pointer to group info struct. * @param datasetid HDF5 dataset ID. @@ -2112,51 +2221,62 @@ read_dataset(NC_GRP_INFO_T *grp, hid_t datasetid, const char *obj_name, } /** - * @internal Add callback function to list. + * @internal Add HDF5 object info for a group to a list for later + * processing. We do this when we encounter groups, so that the parent + * group can be fully processed before the child groups. * - * @param udata - the callback state - * @param oinfo The object info. + * @param udata Pointer to the user data, in this case a + * user_data_t. + * @param oinfo The HDF5 object info. * * @return ::NC_NOERR No error. * @return ::NC_ENOMEM Out of memory. - * @author Ed Hartnett + * @author Ed Hartnett, Dennis Heimbigner */ static int -nc4_rec_read_metadata_cb_list_add(NC4_rec_read_metadata_ud_t* udata, - const NC4_rec_read_metadata_obj_info_t *oinfo) +oinfo_list_add(user_data_t *udata, const hdf5_obj_info_t *oinfo) { - NC4_rec_read_metadata_obj_info_t *new_oinfo; /* Pointer to info for object */ + hdf5_obj_info_t *new_oinfo; /* Pointer to info for object */ - /* Allocate memory for the object's info */ - if (!(new_oinfo = calloc(1, sizeof(*new_oinfo)))) + /* Allocate memory for the object's info. */ + if (!(new_oinfo = calloc(1, sizeof(hdf5_obj_info_t)))) return NC_ENOMEM; - /* Make a copy of the object's info */ - memcpy(new_oinfo, oinfo, sizeof(*oinfo)); + /* Make a copy of the object's info. */ + memcpy(new_oinfo, oinfo, sizeof(hdf5_obj_info_t)); + + /* Add it to the list for future processing. */ + nclistpush(udata->grps, new_oinfo); - nclistpush(udata->grps,new_oinfo); - return (NC_NOERR); + return NC_NOERR; } /** - * @internal Callback function called from nc4_rec_read_metadata(). + * @internal Callback function called by H5Literate() for every HDF5 + * object in the file. + * + * @note This function is called by HDF5 so does not return a netCDF + * error code. * * @param grpid HDF5 group ID. * @param name Name of object. * @param info Info struct for object. - * @param _op_data Pointer to data. + * @param _op_data Pointer to user data, a user_data_t. It will + * contain a pointer to the current group and a list of + * hdf5_obj_info_t. Any child groups will get their hdf5_obj_info + * added to this list. * - * @return ::NC_NOERR No error. - * @return H5_ITER_ERROR HDF5 error. + * @return H5_ITER_CONT No error, continue iteration. + * @return H5_ITER_ERROR HDF5 error, stop iteration. * @author Ed Hartnett */ static int -nc4_rec_read_metadata_cb(hid_t grpid, const char *name, const H5L_info_t *info, - void *_op_data) +read_hdf5_obj(hid_t grpid, const char *name, const H5L_info_t *info, + void *_op_data) { /* Pointer to user data for callback */ - NC4_rec_read_metadata_ud_t *udata = (NC4_rec_read_metadata_ud_t *)_op_data; - NC4_rec_read_metadata_obj_info_t oinfo; /* Pointer to info for object */ + user_data_t *udata = (user_data_t *)_op_data; + hdf5_obj_info_t oinfo; /* Pointer to info for object */ int retval = H5_ITER_CONT; /* Open this critter. */ @@ -2178,7 +2298,7 @@ nc4_rec_read_metadata_cb(hid_t grpid, const char *name, const H5L_info_t *info, /* Defer descending into child group immediately, so that the * types in the current group can be processed and be ready for * use by vars in the child group(s). */ - if (nc4_rec_read_metadata_cb_list_add(udata, &oinfo)) + if (oinfo_list_add(udata, &oinfo)) BAIL(H5_ITER_ERROR); break; @@ -2244,16 +2364,19 @@ nc4_rec_read_metadata_cb(hid_t grpid, const char *name, const H5L_info_t *info, * @param grp Pointer to a group. * * @return ::NC_NOERR No error. - * @author Ed Hartnett + * @return ::NC_EHDFERR HDF5 error. + * @return ::NC_ENOMEM Out of memory. + * @return ::NC_ECANTWRITE File must be opened read-only. + * @author Ed Hartnett, Dennis Heimbigner */ static int -nc4_rec_read_metadata(NC_GRP_INFO_T *grp) +rec_read_metadata(NC_GRP_INFO_T *grp) { NC_HDF5_GRP_INFO_T *hdf5_grp; - NC4_rec_read_metadata_ud_t udata; /* User data for iteration */ - NC4_rec_read_metadata_obj_info_t *oinfo; /* Pointer to info for object */ + user_data_t udata; /* User data for iteration */ + hdf5_obj_info_t *oinfo; /* Pointer to info for object */ hsize_t idx = 0; - hid_t pid = 0; + hid_t pid = -1; unsigned crt_order_flags = 0; H5_index_t iter_index; int i, retval = NC_NOERR; /* everything worked! */ @@ -2264,9 +2387,6 @@ nc4_rec_read_metadata(NC_GRP_INFO_T *grp) /* Get HDF5-specific group info. */ hdf5_grp = (NC_HDF5_GRP_INFO_T *)grp->format_grp_info; - /* Portably initialize user data for later */ - memset(&udata, 0, sizeof(udata)); - /* Open this HDF5 group and retain its grpid. It will remain open * with HDF5 until this file is nc_closed. */ if (!hdf5_grp->hdf_grpid) @@ -2293,9 +2413,9 @@ nc4_rec_read_metadata(NC_GRP_INFO_T *grp) assert(hdf5_grp->hdf_grpid > 0); /* Get the group creation flags, to check for creation ordering */ - pid = H5Gget_create_plist(hdf5_grp->hdf_grpid); - H5Pget_link_creation_order(pid, &crt_order_flags); - if (H5Pclose(pid) < 0) + if ((pid = H5Gget_create_plist(hdf5_grp->hdf_grpid)) < 0) + BAIL(NC_EHDFERR); + if (H5Pget_link_creation_order(pid, &crt_order_flags) < 0) BAIL(NC_EHDFERR); /* Set the iteration index to use */ @@ -2312,14 +2432,16 @@ nc4_rec_read_metadata(NC_GRP_INFO_T *grp) iter_index = H5_INDEX_NAME; } - /* Set user data for iteration */ + /* Set user data for iteration. */ udata.grp = grp; udata.grps = nclistnew(); /* Iterate over links in this group, building lists for the types, - * datasets and groups encountered. */ + * datasets and groups encountered. A pointer to udata will be + * passed as a parameter to the callback function + * read_hdf5_obj(). */ if (H5Literate(hdf5_grp->hdf_grpid, iter_index, H5_ITER_INC, &idx, - nc4_rec_read_metadata_cb, (void *)&udata) < 0) + read_hdf5_obj, (void *)&udata) < 0) BAIL(NC_EHDFERR); /* Process the child groups found. (Deferred until now, so that the @@ -2328,7 +2450,7 @@ nc4_rec_read_metadata(NC_GRP_INFO_T *grp) for (i = 0; i < nclistlength(udata.grps); i++) { NC_GRP_INFO_T *child_grp; - oinfo = (NC4_rec_read_metadata_obj_info_t*)nclistget(udata.grps, i); + oinfo = (hdf5_obj_info_t*)nclistget(udata.grps, i); /* Add group to file's hierarchy */ if ((retval = nc4_grp_list_add(grp->nc4_info, grp, oinfo->oname, @@ -2339,11 +2461,11 @@ nc4_rec_read_metadata(NC_GRP_INFO_T *grp) if (!(child_grp->format_grp_info = calloc(1, sizeof(NC_HDF5_GRP_INFO_T)))) return NC_ENOMEM; - /* Recursively read the child group's metadata */ - if ((retval = nc4_rec_read_metadata(child_grp))) + /* Recursively read the child group's metadata. */ + if ((retval = rec_read_metadata(child_grp))) BAIL(retval); - /* Close the object */ + /* Close the object. */ if (H5Oclose(oinfo->oid) < 0) BAIL(NC_EHDFERR); } @@ -2351,19 +2473,18 @@ nc4_rec_read_metadata(NC_GRP_INFO_T *grp) /* Defer the reading of global atts until someone asks for one. */ grp->atts_not_read = 1; - /* when exiting define mode, mark all variable written */ + /* When exiting define mode, mark all variable written. */ for (i = 0; i < ncindexsize(grp->vars); i++) - { - NC_VAR_INFO_T* var = (NC_VAR_INFO_T*)ncindexith(grp->vars,i); - assert(var); - var->written_to = NC_TRUE; - } + ((NC_VAR_INFO_T *)ncindexith(grp->vars, i))->written_to = NC_TRUE; exit: - /* Clean up local information, if anything remains */ + if (pid > 0 && H5Pclose(pid) < 0) + BAIL2(NC_EHDFERR); + + /* Clean up local information, if anything remains. */ for (i = 0; i < nclistlength(udata.grps); i++) { - oinfo = (NC4_rec_read_metadata_obj_info_t*)nclistget(udata.grps,i); + oinfo = (hdf5_obj_info_t *)nclistget(udata.grps, i); if (retval) { /* Close the object */ @@ -2373,7 +2494,6 @@ nc4_rec_read_metadata(NC_GRP_INFO_T *grp) free(oinfo); } nclistfree(udata.grps); - udata.grps = NULL; return retval; } From 3697f43b1dea8a3a2d59e9a316538373d61c7e8e Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Mon, 17 Dec 2018 07:59:33 -0700 Subject: [PATCH 18/24] whitespace fixes in header file, fixed enable-benchmarks doc string in configure.ac --- configure.ac | 9 ++++----- include/nc4internal.h | 8 ++++---- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index b3de7bc304..47f366f88f 100644 --- a/configure.ac +++ b/configure.ac @@ -550,13 +550,12 @@ if test "x$enable_large_file_tests" = xyes; then fi # Does the user want to run benchmarks? -AC_MSG_CHECKING([whether benchmarks should be run (experimental)]) +AC_MSG_CHECKING([whether benchmarks should be run]) AC_ARG_ENABLE([benchmarks], [AS_HELP_STRING([--enable-benchmarks], - [Run benchmarks. This is an experimental feature. You must fetch - sample data files from the Unidata ftp site to use these benchmarks. - The benchmarks are a bunch of extra tests, which are timed. We use these - tests to check netCDF performance.])]) + [Run benchmarks. This will cause sample data files from the Unidata ftp + site to be fetched. The benchmarks are a bunch of extra tests, which + are timed. We use these tests to check netCDF performance.])]) test "x$enable_benchmarks" = xyes || enable_benchmarks=no AC_MSG_RESULT($enable_benchmarks) AM_CONDITIONAL(BUILD_BENCHMARKS, [test x$enable_benchmarks = xyes]) diff --git a/include/nc4internal.h b/include/nc4internal.h index 5d125c0e65..c464564b8a 100644 --- a/include/nc4internal.h +++ b/include/nc4internal.h @@ -141,10 +141,10 @@ typedef struct NC_VAR_INFO { NC_OBJ hdr; char *hdf5_name; /* used if different from name */ - struct NC_GRP_INFO* container; /* containing group */ + struct NC_GRP_INFO *container; /* containing group */ size_t ndims; int *dimids; - NC_DIM_INFO_T** dim; + NC_DIM_INFO_T **dim; nc_bool_t is_new_var; /* True if variable is newly created */ nc_bool_t was_coord_var; /* True if variable was a coordinate var, but either the dim or var has been renamed */ nc_bool_t became_coord_var; /* True if variable _became_ a coordinate var, because either the dim or var has been renamed */ @@ -154,7 +154,7 @@ typedef struct NC_VAR_INFO nc_bool_t written_to; /* True if variable has data written to it */ struct NC_TYPE_INFO *type_info; int atts_not_read; /* If true, the atts have not yet been read. */ - NCindex* att; /* NCindex */ + NCindex *att; /* NCindex */ nc_bool_t no_fill; /* True if no fill value is defined for var */ void *fill_value; size_t *chunksizes; @@ -172,7 +172,7 @@ typedef struct NC_VAR_INFO /* Stuff for arbitrary filters */ unsigned int filterid; size_t nparams; - unsigned int* params; + unsigned int *params; } NC_VAR_INFO_T; typedef struct NC_FIELD_INFO From 77b3a81d86e30365c3971a6764b51b108d791b15 Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Mon, 17 Dec 2018 08:25:19 -0700 Subject: [PATCH 19/24] starting to deal with var metadata separately --- libhdf5/hdf5open.c | 105 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 91 insertions(+), 14 deletions(-) diff --git a/libhdf5/hdf5open.c b/libhdf5/hdf5open.c index e5f86b94bf..bbd9aabee4 100644 --- a/libhdf5/hdf5open.c +++ b/libhdf5/hdf5open.c @@ -1112,6 +1112,81 @@ get_scale_info(NC_GRP_INFO_T *grp, NC_DIM_INFO_T *dim, NC_VAR_INFO_T *var, return NC_NOERR; } +/** + * @internal Get the metadata for a variable. + * + * @param var Pointer to var info struct. + * + * @return ::NC_NOERR No error. + * @return ::NC_EBADID Bad ncid. + * @return ::NC_ENOMEM Out of memory. + * @return ::NC_EHDFERR HDF5 returned error. + * @return ::NC_EVARMETA Error with var metadata. + * @author Ed Hartnett + */ +static int +get_var_meta(NC_VAR_INFO_T *var) +{ + NC_HDF5_VAR_INFO_T *hdf5_var; + hid_t access_pid = 0; + hid_t propid = 0; + double rdcc_w0; + int retval = NC_NOERR; + + assert(var && var->format_var_info); + + /* Get pointer to the HDF5-specific var info struct. */ + hdf5_var = (NC_HDF5_VAR_INFO_T *)var->format_var_info; + + return NC_NOERR; + + /* Get the current chunk cache settings. */ + if ((access_pid = H5Dget_access_plist(hdf5_var->hdf_datasetid)) < 0) + BAIL(NC_EVARMETA); + + /* Learn about current chunk cache settings. */ + if ((H5Pget_chunk_cache(access_pid, &(var->chunk_cache_nelems), + &(var->chunk_cache_size), &rdcc_w0)) < 0) + BAIL(NC_EHDFERR); + var->chunk_cache_preemption = rdcc_w0; + + /* Get the dataset creation properties. */ + if ((propid = H5Dget_create_plist(hdf5_var->hdf_datasetid)) < 0) + BAIL(NC_EHDFERR); + + /* Get var chunking info. */ + if ((retval = get_chunking_info(propid, var))) + BAIL(retval); + + /* Get filter info for a var. */ + if ((retval = get_filter_info(propid, var))) + BAIL(retval); + + /* Learn all about the type of this variable. */ + if ((retval = get_type_info2(var->container->nc4_info, hdf5_var->hdf_datasetid, + &var->type_info))) + BAIL(retval); + + /* Indicate that the variable has a pointer to the type */ + var->type_info->rc++; + + /* Get fill value, if defined. */ + if ((retval = get_fill_info(propid, var))) + BAIL(retval); + + /* Is this a deflated variable with a chunksize greater than the + * current cache size? */ + if ((retval = nc4_adjust_var_cache(var->container, var))) + BAIL(retval); + +exit: + if (access_pid && H5Pclose(access_pid) < 0) + BAIL2(NC_EHDFERR); + if (propid > 0 && H5Pclose(propid) < 0) + BAIL2(NC_EHDFERR); + return retval; +} + /** * @internal This function is called by read_dataset(), (which is * called by rec_read_metadata()) when a netCDF variable is found in @@ -1177,6 +1252,18 @@ read_var(NC_GRP_INFO_T *grp, hid_t datasetid, const char *obj_name, H5Iinc_ref(hdf5_var->hdf_datasetid); /* Increment number of objects using ID */ incr_id_rc++; /* Indicate that we've incremented the ref. count (for errors) */ var->created = NC_TRUE; + var->atts_not_read = 1; /* Don't read var atts until user asks for one. */ + + /* Try and read the dimids from the COORDINATES attribute. If it's + * not present, we will have to do dimsscale matching to locate the + * dims for this var. */ + retval = read_coord_dimids(grp, var); + if (retval && retval != NC_ENOTATT) + return retval; + + /* Handle scale info. */ + if ((retval = get_scale_info(grp, dim, var, hdf5_var, ndims, datasetid))) + BAIL(retval); /* Get the current chunk cache settings. */ if ((access_pid = H5Dget_access_plist(datasetid)) < 0) @@ -1211,25 +1298,15 @@ read_var(NC_GRP_INFO_T *grp, hid_t datasetid, const char *obj_name, if ((retval = get_fill_info(propid, var))) BAIL(retval); - /* Try and read the dimids from the COORDINATES attribute. If it's - * not present, we will have to do dimsscale matching to locate the - * dims for this var. */ - retval = read_coord_dimids(grp, var); - if (retval && retval != NC_ENOTATT) - return retval; - - /* Handle scale info. */ - if ((retval = get_scale_info(grp, dim, var, hdf5_var, ndims, datasetid))) - BAIL(retval); - - /* Don't read variable attributes until user asks for one. */ - var->atts_not_read = 1; - /* Is this a deflated variable with a chunksize greater than the * current cache size? */ if ((retval = nc4_adjust_var_cache(grp, var))) BAIL(retval); + /* Get the rest of the metadata for this variable. */ + if ((retval = get_var_meta(var))) + BAIL(retval); + exit: if (finalname) free(finalname); From e9bd94821dc5debb8d204e34b8036760a6411ec2 Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Mon, 17 Dec 2018 08:41:43 -0700 Subject: [PATCH 20/24] split out some var meta reading, fixed setting of var->container --- libhdf5/hdf5open.c | 52 +++---------------------------------------- libsrc4/nc4internal.c | 1 + 2 files changed, 4 insertions(+), 49 deletions(-) diff --git a/libhdf5/hdf5open.c b/libhdf5/hdf5open.c index bbd9aabee4..a1e81b3fff 100644 --- a/libhdf5/hdf5open.c +++ b/libhdf5/hdf5open.c @@ -1138,8 +1138,6 @@ get_var_meta(NC_VAR_INFO_T *var) /* Get pointer to the HDF5-specific var info struct. */ hdf5_var = (NC_HDF5_VAR_INFO_T *)var->format_var_info; - return NC_NOERR; - /* Get the current chunk cache settings. */ if ((access_pid = H5Dget_access_plist(hdf5_var->hdf_datasetid)) < 0) BAIL(NC_EVARMETA); @@ -1214,12 +1212,9 @@ read_var(NC_GRP_INFO_T *grp, hid_t datasetid, const char *obj_name, { NC_VAR_INFO_T *var = NULL; NC_HDF5_VAR_INFO_T *hdf5_var; - hid_t access_pid = 0; int incr_id_rc = 0; /* Whether dataset ID's ref count has been incremented */ - hid_t propid = 0; - int retval = NC_NOERR; - double rdcc_w0; char *finalname = NULL; + int retval = NC_NOERR; assert(obj_name && grp); LOG((4, "%s: obj_name %s", __func__, obj_name)); @@ -1259,50 +1254,12 @@ read_var(NC_GRP_INFO_T *grp, hid_t datasetid, const char *obj_name, * dims for this var. */ retval = read_coord_dimids(grp, var); if (retval && retval != NC_ENOTATT) - return retval; + BAIL(retval); /* Handle scale info. */ if ((retval = get_scale_info(grp, dim, var, hdf5_var, ndims, datasetid))) BAIL(retval); - /* Get the current chunk cache settings. */ - if ((access_pid = H5Dget_access_plist(datasetid)) < 0) - BAIL(NC_EVARMETA); - - /* Learn about current chunk cache settings. */ - if ((H5Pget_chunk_cache(access_pid, &(var->chunk_cache_nelems), - &(var->chunk_cache_size), &rdcc_w0)) < 0) - BAIL(NC_EHDFERR); - var->chunk_cache_preemption = rdcc_w0; - - /* Get the dataset creation properties. */ - if ((propid = H5Dget_create_plist(datasetid)) < 0) - BAIL(NC_EHDFERR); - - /* Get var chunking info. */ - if ((retval = get_chunking_info(propid, var))) - BAIL(retval); - - /* Get filter info for a var. */ - if ((retval = get_filter_info(propid, var))) - BAIL(retval); - - /* Learn all about the type of this variable. */ - if ((retval = get_type_info2(grp->nc4_info, datasetid, &var->type_info))) - BAIL(retval); - - /* Indicate that the variable has a pointer to the type */ - var->type_info->rc++; - - /* Get fill value, if defined. */ - if ((retval = get_fill_info(propid, var))) - BAIL(retval); - - /* Is this a deflated variable with a chunksize greater than the - * current cache size? */ - if ((retval = nc4_adjust_var_cache(grp, var))) - BAIL(retval); - /* Get the rest of the metadata for this variable. */ if ((retval = get_var_meta(var))) BAIL(retval); @@ -1318,10 +1275,7 @@ read_var(NC_GRP_INFO_T *grp, hid_t datasetid, const char *obj_name, nc4_var_list_del(grp,var); } } - if (access_pid && H5Pclose(access_pid) < 0) - BAIL2(NC_EHDFERR); - if (propid > 0 && H5Pclose(propid) < 0) - BAIL2(NC_EHDFERR); + return retval; } diff --git a/libsrc4/nc4internal.c b/libsrc4/nc4internal.c index ddc3757dec..9d5f095f11 100644 --- a/libsrc4/nc4internal.c +++ b/libsrc4/nc4internal.c @@ -510,6 +510,7 @@ nc4_var_list_add2(NC_GRP_INFO_T *grp, const char *name, NC_VAR_INFO_T **var) if (!(new_var = calloc(1, sizeof(NC_VAR_INFO_T)))) return NC_ENOMEM; new_var->hdr.sort = NCVAR; + new_var->container = grp; /* These are the HDF5-1.8.4 defaults. */ new_var->chunk_cache_size = nc4_chunk_cache_size; From aa16d29e98fca66670e4ef01511d754a831e290c Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Mon, 17 Dec 2018 08:43:19 -0700 Subject: [PATCH 21/24] fixed comment --- libsrc4/nc4var.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/libsrc4/nc4var.c b/libsrc4/nc4var.c index 7a6f4cbfb6..7c9b55c538 100644 --- a/libsrc4/nc4var.c +++ b/libsrc4/nc4var.c @@ -160,9 +160,7 @@ NC4_inq_var_all(int ncid, int varid, char *name, nc_type *xtypep, return retval; assert(grp && h5); - /* Walk through the list of vars, and return the info about the one - with a matching varid. If the varid is -1, find the global - atts and call it a day. */ + /* If the varid is -1, find the global atts and call it a day. */ if (varid == NC_GLOBAL && nattsp) { *nattsp = ncindexcount(grp->att); From dc982efb3d3e7a24e2105fb2e66fd07fd62f9ce8 Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Mon, 17 Dec 2018 08:44:36 -0700 Subject: [PATCH 22/24] moved tst_attsperf to be with rest of benchmarks --- nc_test4/Makefile.am | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/nc_test4/Makefile.am b/nc_test4/Makefile.am index 9adeac80bf..efb0bb093b 100644 --- a/nc_test4/Makefile.am +++ b/nc_test4/Makefile.am @@ -74,7 +74,8 @@ endif # BUILD_V2 if BUILD_BENCHMARKS check_PROGRAMS += tst_create_files bm_file tst_chunks3 tst_ar4 \ tst_ar4_3d tst_ar4_4d bm_many_objs tst_h_many_atts bm_many_atts \ -tst_files2 tst_files3 tst_mem tst_knmi bm_netcdf4_recs tst_wrf_reads +tst_files2 tst_files3 tst_mem tst_knmi bm_netcdf4_recs tst_wrf_reads \ +tst_attsperf bm_netcdf4_recs_SOURCES = bm_netcdf4_recs.c tst_utils.c bm_many_atts_SOURCES = bm_many_atts.c tst_utils.c @@ -90,7 +91,7 @@ tst_wrf_reads_SOURCES = tst_wrf_reads.c tst_utils.c TESTS += tst_ar4_3d tst_create_files run_bm_test1.sh run_bm_elena.sh \ run_bm_test2.sh run_tst_chunks.sh tst_files2 tst_files3 tst_mem \ -run_knmi_bm.sh tst_wrf_reads +run_knmi_bm.sh tst_wrf_reads tst_attsperf # tst_create_files creates files for other tests. run_bm_test1.log: tst_create_files.log @@ -131,8 +132,8 @@ TESTS += run_par_test.sh endif if ENABLE_METADATA_PERF -check_PROGRAMS += bigmeta openbigmeta tst_attsperf -TESTS += tst_attsperf perftest.sh +check_PROGRAMS += bigmeta openbigmeta +TESTS += perftest.sh endif EXTRA_DIST = run_par_test.sh.in run_par_bm_test.sh.in run_bm_test1.sh \ From b2fbc71bd4c3c29946f88f78bb44fe5540b2cf46 Mon Sep 17 00:00:00 2001 From: Ed Hartnett Date: Mon, 17 Dec 2018 09:24:47 -0700 Subject: [PATCH 23/24] added test, uncommented some test code --- nc_test4/tst_vars4.c | 279 ++++++++++++++++++++++++------------------- 1 file changed, 155 insertions(+), 124 deletions(-) diff --git a/nc_test4/tst_vars4.c b/nc_test4/tst_vars4.c index bb571ea7f2..acc2d0b3cc 100644 --- a/nc_test4/tst_vars4.c +++ b/nc_test4/tst_vars4.c @@ -17,151 +17,182 @@ #define VAR_NAME Y_NAME #define XDIM_LEN 2 #define YDIM_LEN 5 +#define CLAIR "Clair" +#define JAMIE "Jamie" int main(int argc, char **argv) { printf("\n*** Testing netcdf-4 variable functions, even more.\n"); -/* printf("**** testing Jeff's dimension problem..."); */ -/* { */ -/* int varid, ncid, dims[NDIMS2], dims_in[NDIMS2]; */ -/* int ndims, nvars, ngatts, unlimdimid, natts; */ -/* char name_in[NC_MAX_NAME + 1]; */ -/* nc_type type_in; */ -/* size_t len_in; */ - -/* if (nc_create(FILE_NAME, NC_NETCDF4 | NC_CLOBBER, &ncid)) ERR; */ -/* if (nc_def_dim(ncid, X_NAME, XDIM_LEN, &dims[0])) ERR; */ -/* if (nc_def_dim(ncid, Y_NAME, YDIM_LEN, &dims[1])) ERR; */ -/* if (nc_def_var(ncid, VAR_NAME, NC_FLOAT, 2, dims, &varid)) ERR; */ -/* if (nc_inq(ncid, &ndims, &nvars, &ngatts, &unlimdimid)) ERR; */ -/* if (nvars != NUM_VARS || ndims != NDIMS2 || ngatts != 0 || unlimdimid != -1) ERR; */ -/* if (nc_inq_var(ncid, 0, name_in, &type_in, &ndims, dims_in, &natts)) ERR; */ -/* if (strcmp(name_in, VAR_NAME) || type_in != NC_FLOAT || ndims != NDIMS2 || */ -/* dims_in[0] != dims[0] || dims_in[1] != dims[1] || natts != 0) ERR; */ -/* if (nc_inq_dim(ncid, 0, name_in, &len_in)) ERR; */ -/* if (strcmp(name_in, X_NAME) || len_in != XDIM_LEN) ERR; */ -/* if (nc_inq_dim(ncid, 1, name_in, &len_in)) ERR; */ -/* if (strcmp(name_in, Y_NAME)) ERR; */ -/* if (len_in != YDIM_LEN) ERR; */ -/* if (nc_close(ncid)) ERR; */ - -/* /\* Open the file and check. *\/ */ -/* if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR; */ -/* if (nc_inq(ncid, &ndims, &nvars, &ngatts, &unlimdimid)) ERR; */ -/* if (nvars != NUM_VARS || ndims != NDIMS2 || ngatts != 0 || unlimdimid != -1) ERR; */ -/* if (nc_inq_var(ncid, 0, name_in, &type_in, &ndims, dims_in, &natts)) ERR; */ -/* if (strcmp(name_in, VAR_NAME) || type_in != NC_FLOAT || ndims != NDIMS2 || */ -/* dims_in[0] != dims[0] || dims_in[1] != dims[1] || natts != 0) ERR; */ -/* if (nc_inq_dim(ncid, 0, name_in, &len_in)) ERR; */ -/* if (strcmp(name_in, X_NAME) || len_in != XDIM_LEN) ERR; */ -/* if (nc_inq_dim(ncid, 1, name_in, &len_in)) ERR; */ -/* if (strcmp(name_in, Y_NAME)) ERR; */ -/* if (len_in != YDIM_LEN) ERR; */ -/* if (nc_close(ncid)) ERR; */ -/* } */ -/* SUMMARIZE_ERR; */ -/* printf("**** testing chunking turned on by fletcher..."); */ -/* { */ -/* int varid, ncid, dims[NDIMS2]; */ -/* int storage_in; */ -/* size_t chunksizes_in[NDIMS2]; */ - -/* if (nc_create(FILE_NAME, NC_NETCDF4 | NC_CLOBBER, &ncid)) ERR; */ -/* if (nc_def_dim(ncid, X_NAME, XDIM_LEN, &dims[0])) ERR; */ -/* if (nc_def_dim(ncid, Y_NAME, YDIM_LEN, &dims[1])) ERR; */ -/* if (nc_def_var(ncid, VAR_NAME, NC_FLOAT, 2, dims, &varid)) ERR; */ -/* if (nc_def_var_fletcher32(ncid, varid, NC_FLETCHER32)) ERR; */ -/* if (nc_inq_var_chunking(ncid, varid, &storage_in, chunksizes_in)) ERR; */ -/* if (chunksizes_in[0] != XDIM_LEN || chunksizes_in[1] != YDIM_LEN) ERR; */ -/* if (nc_close(ncid)) ERR; */ - -/* /\* Open the file and check. *\/ */ -/* if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR; */ -/* if (nc_inq_var_chunking(ncid, varid, &storage_in, chunksizes_in)) ERR; */ -/* if (chunksizes_in[0] != XDIM_LEN || chunksizes_in[1] != YDIM_LEN) ERR; */ -/* if (nc_close(ncid)) ERR; */ -/* } */ -/* SUMMARIZE_ERR; */ -/* printf("**** testing chunking turned on by shuffle..."); */ -/* { */ -/* int varid, ncid, dims[NDIMS2]; */ -/* int storage_in; */ -/* size_t chunksizes_in[NDIMS2]; */ - -/* if (nc_create(FILE_NAME, NC_NETCDF4 | NC_CLOBBER, &ncid)) ERR; */ -/* if (nc_def_dim(ncid, X_NAME, XDIM_LEN, &dims[0])) ERR; */ -/* if (nc_def_dim(ncid, Y_NAME, YDIM_LEN, &dims[1])) ERR; */ -/* if (nc_def_var(ncid, VAR_NAME, NC_FLOAT, 2, dims, &varid)) ERR; */ -/* if (nc_def_var_deflate(ncid, varid, NC_SHUFFLE, 0, 0)) ERR; */ -/* if (nc_inq_var_chunking(ncid, varid, &storage_in, chunksizes_in)) ERR; */ -/* if (chunksizes_in[0] != XDIM_LEN || chunksizes_in[1] != YDIM_LEN) ERR; */ -/* if (nc_close(ncid)) ERR; */ - -/* /\* Open the file and check. *\/ */ -/* if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR; */ -/* if (nc_inq_var_chunking(ncid, varid, &storage_in, chunksizes_in)) ERR; */ -/* if (chunksizes_in[0] != XDIM_LEN || chunksizes_in[1] != YDIM_LEN) ERR; */ -/* if (nc_close(ncid)) ERR; */ -/* } */ -/* SUMMARIZE_ERR; */ -/* #define DIM_NAME "Distance_from_Mayo" */ -/* #define VAR_NAME_2 "Rocky_Road_to_Dublin" */ -/* #define NDIMS1 1 */ -/* #define NUM_RECORDS 3 */ -/* printf("**** testing extending var along unlimited dim with no coord var..."); */ -/* { */ -/* int varid, ncid, dimid; */ -/* int ndims, nvars, natts, unlimdimid; */ -/* size_t dim_len_in, index; */ -/* int data = TEST_VAL_42; */ - -/* /\* Create the test file with one var, one unlimited dim. *\/ */ -/* if (nc_create(FILE_NAME, NC_NETCDF4 | NC_CLOBBER, &ncid)) ERR; */ -/* if (nc_def_dim(ncid, DIM_NAME, NC_UNLIMITED, &dimid)) ERR; */ -/* if (nc_def_var(ncid, VAR_NAME_2, NC_INT, NDIMS1, &dimid, &varid)) ERR; */ - -/* /\* Write some records. *\/ */ -/* for (index = 0; index < NUM_RECORDS; index++) */ -/* if (nc_put_var1_int(ncid, varid, &index, &data)) ERR; */ -/* if (nc_close(ncid)) ERR; */ - -/* /\* Open the file and check. *\/ */ -/* if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR; */ -/* if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR; */ -/* if (ndims != 1 || nvars != 1 || natts != 0 || unlimdimid != 0) ERR; */ -/* if (nc_inq_dim(ncid, dimid, NULL, &dim_len_in)) ERR; */ -/* if (dim_len_in != NUM_RECORDS) ERR; */ - -/* /\* Now add more records. *\/ */ -/* for (index = 3; index < NUM_RECORDS * 2; index++) */ -/* if (nc_put_var1_int(ncid, varid, &index, &data)) ERR; */ -/* if (nc_inq_dim(ncid, dimid, NULL, &dim_len_in)) ERR; */ - -/* if (dim_len_in != NUM_RECORDS * 2) ERR; */ - -/* /\* Close the file. *\/ */ -/* if (nc_close(ncid)) ERR; */ -/* } */ -/* SUMMARIZE_ERR; */ -#define CLAIR "Clair" -#define JAMIE "Jamie" + printf("**** testing Jeff's dimension problem..."); + { + int varid, ncid, dims[NDIMS2], dims_in[NDIMS2]; + int ndims, nvars, ngatts, unlimdimid, natts; + char name_in[NC_MAX_NAME + 1]; + nc_type type_in; + size_t len_in; + + if (nc_create(FILE_NAME, NC_NETCDF4 | NC_CLOBBER, &ncid)) ERR; + if (nc_def_dim(ncid, X_NAME, XDIM_LEN, &dims[0])) ERR; + if (nc_def_dim(ncid, Y_NAME, YDIM_LEN, &dims[1])) ERR; + if (nc_def_var(ncid, VAR_NAME, NC_FLOAT, 2, dims, &varid)) ERR; + if (nc_inq(ncid, &ndims, &nvars, &ngatts, &unlimdimid)) ERR; + if (nvars != NUM_VARS || ndims != NDIMS2 || ngatts != 0 || unlimdimid != -1) ERR; + if (nc_inq_var(ncid, 0, name_in, &type_in, &ndims, dims_in, &natts)) ERR; + if (strcmp(name_in, VAR_NAME) || type_in != NC_FLOAT || ndims != NDIMS2 || + dims_in[0] != dims[0] || dims_in[1] != dims[1] || natts != 0) ERR; + if (nc_inq_dim(ncid, 0, name_in, &len_in)) ERR; + if (strcmp(name_in, X_NAME) || len_in != XDIM_LEN) ERR; + if (nc_inq_dim(ncid, 1, name_in, &len_in)) ERR; + if (strcmp(name_in, Y_NAME)) ERR; + if (len_in != YDIM_LEN) ERR; + if (nc_close(ncid)) ERR; + + /* Open the file and check. */ + if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR; + if (nc_inq(ncid, &ndims, &nvars, &ngatts, &unlimdimid)) ERR; + if (nvars != NUM_VARS || ndims != NDIMS2 || ngatts != 0 || unlimdimid != -1) ERR; + if (nc_inq_var(ncid, 0, name_in, &type_in, &ndims, dims_in, &natts)) ERR; + if (strcmp(name_in, VAR_NAME) || type_in != NC_FLOAT || ndims != NDIMS2 || + dims_in[0] != dims[0] || dims_in[1] != dims[1] || natts != 0) ERR; + if (nc_inq_dim(ncid, 0, name_in, &len_in)) ERR; + if (strcmp(name_in, X_NAME) || len_in != XDIM_LEN) ERR; + if (nc_inq_dim(ncid, 1, name_in, &len_in)) ERR; + if (strcmp(name_in, Y_NAME)) ERR; + if (len_in != YDIM_LEN) ERR; + if (nc_close(ncid)) ERR; + } + SUMMARIZE_ERR; + printf("**** testing chunking turned on by fletcher..."); + { + int varid, ncid, dims[NDIMS2]; + int storage_in; + size_t chunksizes_in[NDIMS2]; + + if (nc_create(FILE_NAME, NC_NETCDF4 | NC_CLOBBER, &ncid)) ERR; + if (nc_def_dim(ncid, X_NAME, XDIM_LEN, &dims[0])) ERR; + if (nc_def_dim(ncid, Y_NAME, YDIM_LEN, &dims[1])) ERR; + if (nc_def_var(ncid, VAR_NAME, NC_FLOAT, 2, dims, &varid)) ERR; + if (nc_def_var_fletcher32(ncid, varid, NC_FLETCHER32)) ERR; + if (nc_inq_var_chunking(ncid, varid, &storage_in, chunksizes_in)) ERR; + if (chunksizes_in[0] != XDIM_LEN || chunksizes_in[1] != YDIM_LEN) ERR; + if (nc_close(ncid)) ERR; + + /* Open the file and check. */ + if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR; + if (nc_inq_var_chunking(ncid, varid, &storage_in, chunksizes_in)) ERR; + if (chunksizes_in[0] != XDIM_LEN || chunksizes_in[1] != YDIM_LEN) ERR; + if (nc_close(ncid)) ERR; + } + SUMMARIZE_ERR; + printf("**** testing chunking turned on by shuffle..."); + { + int varid, ncid, dims[NDIMS2]; + int storage_in; + size_t chunksizes_in[NDIMS2]; + + if (nc_create(FILE_NAME, NC_NETCDF4 | NC_CLOBBER, &ncid)) ERR; + if (nc_def_dim(ncid, X_NAME, XDIM_LEN, &dims[0])) ERR; + if (nc_def_dim(ncid, Y_NAME, YDIM_LEN, &dims[1])) ERR; + if (nc_def_var(ncid, VAR_NAME, NC_FLOAT, 2, dims, &varid)) ERR; + if (nc_def_var_deflate(ncid, varid, NC_SHUFFLE, 0, 0)) ERR; + if (nc_inq_var_chunking(ncid, varid, &storage_in, chunksizes_in)) ERR; + if (chunksizes_in[0] != XDIM_LEN || chunksizes_in[1] != YDIM_LEN) ERR; + if (nc_close(ncid)) ERR; + + /* Open the file and check. */ + if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR; + if (nc_inq_var_chunking(ncid, varid, &storage_in, chunksizes_in)) ERR; + if (chunksizes_in[0] != XDIM_LEN || chunksizes_in[1] != YDIM_LEN) ERR; + if (nc_close(ncid)) ERR; + } + SUMMARIZE_ERR; +#define DIM_NAME "Distance_from_Mayo" +#define VAR_NAME_2 "Rocky_Road_to_Dublin" +#define NDIMS1 1 +#define NUM_RECORDS 3 + printf("**** testing extending var along unlimited dim with no coord var..."); + { + int varid, ncid, dimid; + int ndims, nvars, natts, unlimdimid; + size_t dim_len_in, index; + int data = TEST_VAL_42; + + /* Create the test file with one var, one unlimited dim. */ + if (nc_create(FILE_NAME, NC_NETCDF4 | NC_CLOBBER, &ncid)) ERR; + if (nc_def_dim(ncid, DIM_NAME, NC_UNLIMITED, &dimid)) ERR; + if (nc_def_var(ncid, VAR_NAME_2, NC_INT, NDIMS1, &dimid, &varid)) ERR; + + /* Write some records. */ + for (index = 0; index < NUM_RECORDS; index++) + if (nc_put_var1_int(ncid, varid, &index, &data)) ERR; + if (nc_close(ncid)) ERR; + + /* Open the file and check. */ + if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR; + if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR; + if (ndims != 1 || nvars != 1 || natts != 0 || unlimdimid != 0) ERR; + if (nc_inq_dim(ncid, dimid, NULL, &dim_len_in)) ERR; + if (dim_len_in != NUM_RECORDS) ERR; + + /* Now add more records. */ + for (index = 3; index < NUM_RECORDS * 2; index++) + if (nc_put_var1_int(ncid, varid, &index, &data)) ERR; + if (nc_inq_dim(ncid, dimid, NULL, &dim_len_in)) ERR; + + if (dim_len_in != NUM_RECORDS * 2) ERR; + + /* Close the file. */ + if (nc_close(ncid)) ERR; + } + SUMMARIZE_ERR; printf("**** testing type creation and destruction for atomic types..."); { int varid1, varid2, ncid; int ndims, nvars, natts, unlimdimid; + /* Create the test file with two scalar vars. */ + /* nc_set_log_level(4); */ + if (nc_create(FILE_NAME, NC_NETCDF4 | NC_CLOBBER, &ncid)) ERR; + if (nc_def_var(ncid, CLAIR, NC_INT, 0, NULL, &varid1)) ERR; + if (nc_def_var(ncid, JAMIE, NC_INT, 0, NULL, &varid2)) ERR; + if (nc_close(ncid)) ERR; + + /* Open the file and check. */ + if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR; + if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR; + if (ndims != 0 || nvars != 2 || natts != 0 || unlimdimid != -1) ERR; + if (nc_close(ncid)) ERR; + } + SUMMARIZE_ERR; + printf("**** testing scalar big endian vars..."); + { + int varid1, varid2, ncid; + int ndims, nvars, natts, unlimdimid; + int test_val = TEST_VAL_42; + int test_val2 = TEST_VAL_42 * 2; + int data_in; + /* Create the test file with two scalar vars. */ nc_set_log_level(4); if (nc_create(FILE_NAME, NC_NETCDF4 | NC_CLOBBER, &ncid)) ERR; if (nc_def_var(ncid, CLAIR, NC_INT, 0, NULL, &varid1)) ERR; + if (nc_def_var_endian(ncid, varid1, NC_ENDIAN_BIG)) ERR; if (nc_def_var(ncid, JAMIE, NC_INT, 0, NULL, &varid2)) ERR; + if (nc_def_var_endian(ncid, varid2, NC_ENDIAN_BIG)) ERR; + if (nc_enddef(ncid)) ERR; + if (nc_put_var(ncid, varid1, &test_val)) ERR; + if (nc_put_var(ncid, varid2, &test_val2)) ERR; if (nc_close(ncid)) ERR; /* Open the file and check. */ if (nc_open(FILE_NAME, NC_WRITE, &ncid)) ERR; if (nc_inq(ncid, &ndims, &nvars, &natts, &unlimdimid)) ERR; if (ndims != 0 || nvars != 2 || natts != 0 || unlimdimid != -1) ERR; + if (nc_get_var(ncid, varid1, &data_in)) ERR; + if (data_in != TEST_VAL_42) ERR; + if (nc_get_var(ncid, varid2, &data_in)) ERR; + if (data_in != TEST_VAL_42 * 2) ERR; if (nc_close(ncid)) ERR; } SUMMARIZE_ERR; From 718537af7ee1750aa6f28f3d0002452a6a7f96b7 Mon Sep 17 00:00:00 2001 From: Ward Fisher Date: Sun, 30 Dec 2018 23:49:22 -0800 Subject: [PATCH 24/24] A bit of cleanup. --- include/nc_provenance.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/nc_provenance.h b/include/nc_provenance.h index 2400b2e101..f2888d7d2c 100644 --- a/include/nc_provenance.h +++ b/include/nc_provenance.h @@ -7,9 +7,6 @@ * info and/or displaying provenance info. * * @author Dennis Heimbigner, Ward Fisher - */ - -/** It has come to pass that we can't guarantee that this information is contained only within netcdf4 files. As a result, we need