@@ -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