Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bc9bbb8

Browse filesBrowse files
Remove _FillValue, conditionally add missing_value
This commit removes the addition of _FillValue and only conditionally adds missing_value if it has been defined within the <var> or <var_array> tag in Registry. It also adds a special keyword FILLVAL for the missing_value attribute to get the NetCDF Fill Value.
1 parent 6886fc1 commit bc9bbb8
Copy full SHA for bc9bbb8

File tree

Expand file treeCollapse file tree

1 file changed

+15
-7
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+15
-7
lines changed
Open diff view settings
Collapse file

‎src/tools/registry/gen_inc.c‎

Copy file name to clipboardExpand all lines: src/tools/registry/gen_inc.c
+15-7Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -450,21 +450,21 @@ int get_field_information(const char *vartype, const char *varval, char *default
450450

451451
if (strcmp(vartype, "real") == 0){
452452
(*type) = REAL;
453-
if(!varmissval){
453+
if(!varmissval || strcmp(varmissval, "FILLVAL") == 0){
454454
snprintf(missing_value, 1024, "MPAS_REAL_FILLVAL");
455455
} else {
456456
snprintf(missing_value, 1024, "%s", varmissval);
457457
}
458458
} else if (strcmp(vartype, "integer") == 0){
459459
(*type) = INTEGER;
460-
if(!varmissval){
460+
if(!varmissval || strcmp(varmissval, "FILLVAL") == 0){
461461
snprintf(missing_value, 1024, "MPAS_INT_FILLVAL");
462462
} else {
463463
snprintf(missing_value, 1024, "%s", varmissval);
464464
}
465465
} else if (strcmp(vartype, "text") == 0){
466466
(*type) = CHARACTER;
467-
if(!varmissval){
467+
if(!varmissval || strcmp(varmissval, "FILLVAL") == 0){
468468
snprintf(missing_value, 1024, "MPAS_CHAR_FILLVAL");
469469
} else {
470470
snprintf(missing_value, 1024, "'%s'", varmissval);
@@ -1339,8 +1339,12 @@ int parse_var_array(FILE *fd, ezxml_t registry, ezxml_t superStruct, ezxml_t var
13391339
fortprintf(fd, " call mpas_add_att(%s(%d) %% attLists(const_index) %% attList, 'units', '%s')\n", pointer_name, time_lev, varunits);
13401340
}
13411341

1342-
fortprintf(fd, " call mpas_add_att(%s(%d) %% attLists(const_index) %% attList, 'missing_value', %s)\n", pointer_name, time_lev, missing_value);
1343-
fortprintf(fd, " call mpas_add_att(%s(%d) %% attLists(const_index) %% attList, '_FillValue', %s)\n", pointer_name, time_lev, missing_value);
1342+
if ( vararrmissingval ) {
1343+
fortprintf(fd, " call mpas_add_att(%s(%d) %% attLists(const_index) %% attList, 'missing_value', %s)\n", pointer_name, time_lev, missing_value);
1344+
// Uncomment to add _FillValue to match missing_value
1345+
// fortprintf(fd, " call mpas_add_att(%s(%d) %% attLists(const_index) %% attList, '_FillValue', %s)\n", pointer_name, time_lev, missing_value);
1346+
}
1347+
fortprintf(fd, " %s(%d) %% missingValue = %s\n", pointer_name, time_lev, missing_value);
13441348
fortprintf(fd, " %s(%d) %% constituentNames(const_index) = '%s'\n", pointer_name, time_lev, varname);
13451349
fortprintf(fd, " end if\n", spacing);
13461350
}
@@ -1526,8 +1530,12 @@ int parse_var(FILE *fd, ezxml_t registry, ezxml_t superStruct, ezxml_t currentVa
15261530
fortprintf(fd, " call mpas_add_att(%s(%d) %% attLists(1) %% attList, 'long_name', '%s')\n", pointer_name, time_lev, vardesc);
15271531
}
15281532

1529-
fortprintf(fd, " call mpas_add_att(%s(%d) %% attLists(1) %% attList, 'missing_value', %s)\n", pointer_name, time_lev, missing_value);
1530-
fortprintf(fd, " call mpas_add_att(%s(%d) %% attLists(1) %% attList, '_FillValue', %s)\n", pointer_name, time_lev, missing_value);
1533+
if ( varmissingval != NULL ) {
1534+
fortprintf(fd, " call mpas_add_att(%s(%d) %% attLists(1) %% attList, 'missing_value', %s)\n", pointer_name, time_lev, missing_value);
1535+
// Uncomment to add _FillValue to match missing_value
1536+
// fortprintf(fd, " call mpas_add_att(%s(%d) %% attLists(1) %% attList, '_FillValue', %s)\n", pointer_name, time_lev, missing_value);
1537+
}
1538+
fortprintf(fd, " %s(%d) %% missingValue = %s\n", pointer_name, time_lev, missing_value);
15311539

15321540
fortprintf(fd, " %s(%d) %% block => block\n", pointer_name, time_lev);
15331541

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.