diff --git a/include/hdf5internal.h b/include/hdf5internal.h index 0741af40b6..66c2fc6227 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); @@ -137,7 +136,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); 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/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) diff --git a/libhdf5/hdf5open.c b/libhdf5/hdf5open.c index 0998195d48..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. */ @@ -329,6 +341,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. @@ -343,7 +573,7 @@ dimscale_visitor(hid_t did, unsigned dim, hid_t dsid, 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. */ @@ -528,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. */ @@ -537,25 +767,14 @@ 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. */ - if ((retval = nc4_rec_match_dimscales(nc4_info->root_grp))) + if ((retval = rec_match_dimscales(nc4_info->root_grp))) BAIL(retval); #ifdef LOGGING @@ -633,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)); + assert(var); - /* 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); - - /* 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: @@ -760,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; @@ -775,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; } @@ -793,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) @@ -823,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) { @@ -854,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; @@ -885,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 @@ -911,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) @@ -1699,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. @@ -1719,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. */ @@ -1729,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. */ @@ -1751,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; @@ -1762,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]; @@ -1794,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; @@ -1806,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))) @@ -1830,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. @@ -1894,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)); - nclistpush(udata->grps,new_oinfo); - return (NC_NOERR); + /* Add it to the list for future processing. */ + nclistpush(udata->grps, new_oinfo); + + 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. */ @@ -1960,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; @@ -2026,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! */ @@ -2046,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) @@ -2075,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 */ @@ -2094,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 @@ -2110,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, @@ -2121,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); } @@ -2133,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 */ @@ -2155,7 +2494,6 @@ nc4_rec_read_metadata(NC_GRP_INFO_T *grp) free(oinfo); } nclistfree(udata.grps); - udata.grps = NULL; return retval; } diff --git a/libhdf5/nc4hdf.c b/libhdf5/nc4hdf.c index 9401a0d829..9a23e1f411 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; } /** @@ -1364,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; } /** @@ -1551,14 +1536,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); } @@ -1568,93 +1550,66 @@ 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; + 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; - } } } } - /* 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); - } + return retval; if (var->dimscale_attached) { @@ -1665,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; } } @@ -1691,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. */ @@ -1710,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) @@ -1741,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; } /** @@ -1765,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); @@ -1781,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 @@ -1796,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); @@ -1813,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 @@ -1846,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; @@ -1864,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); } } @@ -1880,90 +1827,17 @@ 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; } -/** - * @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 @@ -1999,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. */ @@ -2025,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 @@ -2036,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; } 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)); } 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_interops.c b/nc_test4/tst_interops.c index f7662e42b4..171304876f 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; } 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; +} diff --git a/ncgen3/Makefile.am b/ncgen3/Makefile.am index 3b4de1b84f..123564361a 100644 --- a/ncgen3/Makefile.am +++ b/ncgen3/Makefile.am @@ -24,6 +24,7 @@ run_nc4_tests.sh XGetopt.c $(man_MANS) # There is a netcdf classic and netcdf-4 test script, but don't run # them for DLL builds. #if !BUILD_DLL + TESTS = run_tests.sh if USE_HDF5 TESTS += run_nc4_tests.sh