-
Notifications
You must be signed in to change notification settings - Fork 353
Ocean/develop: add CF-compliant _FillValue attribute #533
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,7 +61,7 @@ | |
|
||
<var_struct name="state" time_levs="2"> | ||
<var_struct name="tracers" time_levs="2"> | ||
<var_array name="activeTracers" dimensions="nVertLevels nCells Time" type="real" packages="activeTracersPKG" > | ||
<var_array name="activeTracers" dimensions="nVertLevels nCells Time" type="real" packages="activeTracersPKG" missing_value="FILLVAL"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will we need to add @mgduda would a default setting of the An alternative is to have a global variable or attribute at the top of the registry file so each core can specify the missing_value for all variables with a single line. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @czender seemed to think that we would want to manually mark variables with I don't know what There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is correct. Variables that are valid everywhere (e.g., most of EAM) will never use a |
||
<var name="temperature" array_group="activeGRP" units="degrees Celsius" | ||
description="potential temperature" | ||
/> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1386,10 +1386,10 @@ int parse_var_array(FILE *fd, ezxml_t registry, ezxml_t superStruct, ezxml_t var | |
fortprintf(fd, " call mpas_add_att(%s(%d) %% attLists(const_index) %% attList, 'units', '%s')\n", pointer_name, time_lev, temp_str); | ||
} | ||
|
||
if ( vararrmissingval ) { | ||
fortprintf(fd, " call mpas_add_att(%s(%d) %% attLists(const_index) %% attList, 'missing_value', %s)\n", pointer_name, time_lev, missing_value); | ||
if ( vararrmissingval != NULL ) { | ||
// fortprintf(fd, " call mpas_add_att(%s(%d) %% attLists(const_index) %% attList, 'missing_value', %s)\n", pointer_name, time_lev, missing_value); | ||
// Uncomment to add _FillValue to match missing_value | ||
// fortprintf(fd, " call mpas_add_att(%s(%d) %% attLists(const_index) %% attList, '_FillValue', %s)\n", pointer_name, time_lev, missing_value); | ||
fortprintf(fd, " call mpas_add_att(%s(%d) %% attLists(const_index) %% attList, '_FillValue', %s)\n", pointer_name, time_lev, missing_value); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this is a framework file, we need to merge this into the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Right, I was thinking that would be the right approach, too, and that @wenshanw shouldn't have to worry about that. We need to do more testing anyway. |
||
} | ||
fortprintf(fd, " %s(%d) %% missingValue = %s\n", pointer_name, time_lev, missing_value); | ||
fortprintf(fd, " %s(%d) %% constituentNames(const_index) = '%s'\n", pointer_name, time_lev, varname); | ||
|
@@ -1431,7 +1431,6 @@ int parse_var_array(FILE *fd, ezxml_t registry, ezxml_t superStruct, ezxml_t var | |
return 0; | ||
}/*}}}*/ | ||
|
||
|
||
int parse_var(FILE *fd, ezxml_t registry, ezxml_t superStruct, ezxml_t currentVar, const char * corename)/*{{{*/ | ||
{ | ||
ezxml_t struct_xml, var_xml, var_xml2; | ||
|
@@ -1596,9 +1595,9 @@ int parse_var(FILE *fd, ezxml_t registry, ezxml_t superStruct, ezxml_t currentVa | |
} | ||
|
||
if ( varmissingval != NULL ) { | ||
fortprintf(fd, " call mpas_add_att(%s(%d) %% attLists(1) %% attList, 'missing_value', %s)\n", pointer_name, time_lev, missing_value); | ||
// fortprintf(fd, " call mpas_add_att(%s(%d) %% attLists(1) %% attList, 'missing_value', %s)\n", pointer_name, time_lev, missing_value); | ||
// Uncomment to add _FillValue to match missing_value | ||
// fortprintf(fd, " call mpas_add_att(%s(%d) %% attLists(1) %% attList, '_FillValue', %s)\n", pointer_name, time_lev, missing_value); | ||
fortprintf(fd, " call mpas_add_att(%s(%d) %% attLists(1) %% attList, '_FillValue', %s)\n", pointer_name, time_lev, missing_value); | ||
} | ||
fortprintf(fd, " %s(%d) %% missingValue = %s\n", pointer_name, time_lev, missing_value); | ||
|
||
|
@@ -1672,7 +1671,7 @@ int parse_struct(FILE *fd, ezxml_t registry, ezxml_t superStruct, int subpool, c | |
|
||
structname = ezxml_attr(superStruct, "name"); | ||
structnameincode = ezxml_attr(superStruct, "name_in_code"); | ||
|
||
if(!structnameincode){ | ||
structnameincode = ezxml_attr(superStruct, "name"); | ||
} | ||
|
@@ -2123,7 +2122,7 @@ int generate_immutable_streams(ezxml_t registry){/*{{{*/ | |
fortprintf(fd, " call MPAS_stream_mgr_add_field(manager, \'%s\', \'%s\', packages=packages, ierr=ierr)\n", optname, optvarname); | ||
else | ||
fortprintf(fd, " call MPAS_stream_mgr_add_field(manager, \'%s\', \'%s\', ierr=ierr)\n", optname, optvarname); | ||
|
||
} | ||
|
||
/* Loop over arrays of fields listed within the stream */ | ||
|
@@ -2571,5 +2570,3 @@ int parse_structs_from_registry(ezxml_t registry)/*{{{*/ | |
|
||
return 0; | ||
}/*}}}*/ | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wenshanw, this spacing needs to be done with tabs rather than spaces to be compatible with the rest of the XML in MPAS. (I know it's hard to see the difference in a lot of editors.)