Skip to content

Add _FillValue to all active and debug tracer fields #571

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

Closed
wants to merge 3 commits into from

Conversation

wenshanw
Copy link

@wenshanw wenshanw commented May 24, 2020

1, Added the _FillValue attribute to active and debug tracers in the output NetCDF files.
2, Replaced -1e34 with _FillValue in active and debug tracers.

@xylar
Copy link
Collaborator

xylar commented May 24, 2020

Nice work @wenshanw! Exactly what we discussed on Friday.

@xylar
Copy link
Collaborator

xylar commented May 24, 2020

Note: This PR is based off of #533 so it should be rebased onto ocean/develop after that PR is merged and develop is merged into ocean/develop.

@xylar xylar requested a review from mark-petersen May 24, 2020 18:31
mark-petersen added a commit that referenced this pull request Jul 13, 2020
Change name of missing value attribute from missing_value to _FillValue

This PR changes the name of the missing value attribute in netCDF output
files from missing_value to _FillValue. The _FillValue attribute can be
set by adding a missing_value to individual variables and var_arrays in the
Registry file (See #571 for an example).

This change is needed because some analysis software, notably NCO, does
not support the missing_value attribute by default and expects
_FillValue instead.
@xylar
Copy link
Collaborator

xylar commented Aug 26, 2020

@wenshanw, this branch needs to be rebased onto ocean/develop. The changes to src/tools/registry/gen_inc.c should be removed in the process. I have done this on my branch here: https://github.com/xylar/MPAS-Model/tree/ocean/add_fill_values

If my branch looks good to you, you can just do a hard reset to mine. Go to the local directory where you have your master branch checked out, then do:

# if you don't already have my fork as a remote:
git remote add xylar/MPAS-Model git@github.com:xylar/MPAS-Model.git
git fetch --all -p
git reset --hard xylar/MPAS-Model/ocean/add_fill_value

Then, do a force push to your remote. The exact syntax will depend on what you named your remote. I called it wenshanw/MPAS-Model:

git push --force wenshanw/MPAS-Model master

@xylar
Copy link
Collaborator

xylar commented Aug 26, 2020

Testing

In my rebased branch, I ran QU240/init and QU240/daily_output_test. The resulting daily output looks like this:

$ ncdump -h analysis_members/mpaso.hist.am.timeSeriesStatsDaily.0001-01-01.nc | more
netcdf mpaso.hist.am.timeSeriesStatsDaily.0001-01-01 {
dimensions:
	Time = UNLIMITED ; // (1 currently)
	StrLen = 64 ;
	nCells = 7400 ;
	nVertLevels = 16 ;
	nEdges = 23180 ;
	nVertLevelsP1 = 17 ;
variables:
	int timeDaily_counter(Time) ;
		timeDaily_counter:units = "unitless" ;
	char xtime_startDaily(Time, StrLen) ;
		xtime_startDaily:units = "unitless" ;
	char xtime_endDaily(Time, StrLen) ;
		xtime_endDaily:units = "unitless" ;
	double timeDaily_avg_daysSinceStartOfSim(Time) ;
		timeDaily_avg_daysSinceStartOfSim:units = "days" ;
		timeDaily_avg_daysSinceStartOfSim:long_name = "Time since simulationStartTime, for plotting" ;
	double timeDaily_avg_ssh(Time, nCells) ;
		timeDaily_avg_ssh:units = "m" ;
		timeDaily_avg_ssh:long_name = "sea surface height" ;
	double timeDaily_avg_velocityMeridional(Time, nCells, nVertLevels) ;
		timeDaily_avg_velocityMeridional:units = "m s^{-1}" ;
		timeDaily_avg_velocityMeridional:long_name = "component of horizontal velocity in the northward direction" ;
	double timeDaily_avg_velocityZonal(Time, nCells, nVertLevels) ;
		timeDaily_avg_velocityZonal:units = "m s^{-1}" ;
		timeDaily_avg_velocityZonal:long_name = "component of horizontal velocity in the eastward direction" ;
	double timeDaily_avg_layerThickness(Time, nCells, nVertLevels) ;
		timeDaily_avg_layerThickness:units = "m" ;
		timeDaily_avg_layerThickness:long_name = "layer thickness" ;
	double timeDaily_avg_density(Time, nCells, nVertLevels) ;
		timeDaily_avg_density:units = "kg m^{-3}" ;
		timeDaily_avg_density:long_name = "density" ;
	double timeDaily_avg_potentialDensity(Time, nCells, nVertLevels) ;
		timeDaily_avg_potentialDensity:units = "kg m^{-3}" ;
		timeDaily_avg_potentialDensity:long_name = "potential density: density displaced adiabatically to the mid-depth of top layer" ;
	double timeDaily_avg_windStressZonal(Time, nCells) ;
		timeDaily_avg_windStressZonal:units = "N m^{-2}" ;
		timeDaily_avg_windStressZonal:long_name = "Zonal (eastward) component of wind stress at cell centers from coupler. Positive eastward." ;
	double timeDaily_avg_windStressMeridional(Time, nCells) ;
		timeDaily_avg_windStressMeridional:units = "N m^{-2}" ;
		timeDaily_avg_windStressMeridional:long_name = "Meridional (northward) component of wind stress at cell centers from coupler. Positive northward." ;
	double timeDaily_avg_tThreshMLD(Time, nCells) ;
		timeDaily_avg_tThreshMLD:units = "m" ;
		timeDaily_avg_tThreshMLD:long_name = "mixed layer depth based on temperature threshold" ;
	double timeDaily_avg_dThreshMLD(Time, nCells) ;
		timeDaily_avg_dThreshMLD:units = "m" ;
		timeDaily_avg_dThreshMLD:long_name = "mixed layer depth based on density threshold" ;
	double timeDaily_avg_normalVelocity(Time, nEdges, nVertLevels) ;
		timeDaily_avg_normalVelocity:units = "m s^{-1}" ;
		timeDaily_avg_normalVelocity:long_name = "horizontal velocity, normal component to an edge" ;
	double timeDaily_avg_vertVelocityTop(Time, nCells, nVertLevelsP1) ;
		timeDaily_avg_vertVelocityTop:units = "m s^{-1}" ;
		timeDaily_avg_vertVelocityTop:long_name = "vertical velocity defined at center (horizontally) and top (vertically) of cell" ;
	double timeDaily_avg_normalGMBolusVelocity(Time, nEdges, nVertLevels) ;
		timeDaily_avg_normalGMBolusVelocity:units = "m s^{-1}" ;
		timeDaily_avg_normalGMBolusVelocity:long_name = "Bolus velocity in Gent-McWilliams eddy parameterization" ;
	double timeDaily_avg_vertGMBolusVelocityTop(Time, nCells, nVertLevelsP1) ;
		timeDaily_avg_vertGMBolusVelocityTop:units = "m s^{-1}" ;
		timeDaily_avg_vertGMBolusVelocityTop:long_name = "vertical tracer-transport velocity defined at center (horizontally) and top (vertically) of cell.  This is not the vertical ALE transport, but is Eulerian (fixed-frame) in the vertical, and computed from the continuity equation from the horizontal GM Bolus velocity." ;
	double timeDaily_avg_GMBolusVelocityZonal(Time, nCells, nVertLevels) ;
		timeDaily_avg_GMBolusVelocityZonal:units = "m s^{-1}" ;
		timeDaily_avg_GMBolusVelocityZonal:long_name = "Bolus velocity in Gent-McWilliams eddy parameterization, zonal-direction" ;
	double timeDaily_avg_GMBolusVelocityMeridional(Time, nCells, nVertLevels) ;
		timeDaily_avg_GMBolusVelocityMeridional:units = "m s^{-1}" ;
		timeDaily_avg_GMBolusVelocityMeridional:long_name = "Bolus velocity in Gent-McWilliams eddy parameterization, meridional-direction" ;
	double timeDaily_avg_gmKappaScaling(Time, nCells, nVertLevelsP1) ;
		timeDaily_avg_gmKappaScaling:units = "NA" ;
		timeDaily_avg_gmKappaScaling:long_name = "spatially and depth varying GM kappa.  The scaling is based on the Brunt Vaisala Frequency relative to a maximum value below the mixed layer, follows from Danabasoglu and Marshall 2007.  If config_GM_closure is not set to N2_dependent the scaling value is set to 1 everywhere." ;
	double timeDaily_avg_RediKappaScaling(Time, nCells, nVertLevelsP1) ;
		timeDaily_avg_RediKappaScaling:units = "NA" ;
		timeDaily_avg_RediKappaScaling:long_name = "Scaling coefficient for GM kappa. Varies from 0 to 1.  The scaling is based on the Brunt Vaisala Frequency relative to a maximum value below the mixed layer, follows from Danabasoglu and Marshall 2007.  If config_Redi_use_N2_based_taper = .false. the scaling is set to 1 everywhere." ;
	double timeDaily_avg_cGMphaseSpeed(Time, nEdges) ;
		timeDaily_avg_cGMphaseSpeed:units = "m s^{-1}" ;
		timeDaily_avg_cGMphaseSpeed:long_name = "phase speed for the bolus velocity calculation" ;
	double timeDaily_avg_velocityZonalTimesTemperature_GM(Time, nCells, nVertLevels) ;
		timeDaily_avg_velocityZonalTimesTemperature_GM:units = "m s^{-1} C" ;
		timeDaily_avg_velocityZonalTimesTemperature_GM:long_name = "cell-wise product of component of horizontal bolus velocity in the eastward direction and temperature" ;
	double timeDaily_avg_velocityMeridionalTimesTemperature_GM(Time, nCells, nVertLevels) ;
		timeDaily_avg_velocityMeridionalTimesTemperature_GM:units = "m s^{-1} C" ;
		timeDaily_avg_velocityMeridionalTimesTemperature_GM:long_name = "cell-wise product of component of horizontal bolus velocity in the northward direction and temperature" ;
	double timeDaily_avg_penetrativeTemperatureFlux(Time, nCells) ;
		timeDaily_avg_penetrativeTemperatureFlux:units = "^\\circ C m s^{-1}" ;
		timeDaily_avg_penetrativeTemperatureFlux:long_name = "Penetrative temperature flux at the surface due to solar radiation. Positive is into the ocean." ;
	double timeDaily_avg_evaporationFlux(Time, nCells) ;
		timeDaily_avg_evaporationFlux:units = "kg m^{-2} s^{-1}" ;
		timeDaily_avg_evaporationFlux:long_name = "Evaporation flux at cell centers from coupler. Positive into the ocean." ;
	double timeDaily_avg_seaIceFreshWaterFlux(Time, nCells) ;
		timeDaily_avg_seaIceFreshWaterFlux:units = "kg m^{-2} s^{-1}" ;
		timeDaily_avg_seaIceFreshWaterFlux:long_name = "Fresh water flux from sea ice at cell centers from coupler. Positive into the ocean." ;
	double timeDaily_avg_riverRunoffFlux(Time, nCells) ;
		timeDaily_avg_riverRunoffFlux:units = "kg m^{-2} s^{-1}" ;
		timeDaily_avg_riverRunoffFlux:long_name = "Fresh water flux from river runoff at cell centers from coupler. Positive into the ocean." ;
	double timeDaily_avg_iceRunoffFlux(Time, nCells) ;
		timeDaily_avg_iceRunoffFlux:units = "kg m^{-2} s^{-1}" ;
		timeDaily_avg_iceRunoffFlux:long_name = "Fresh water flux from ice runoff at cell centers from coupler. Positive into the ocean." ;
	double timeDaily_avg_rainFlux(Time, nCells) ;
		timeDaily_avg_rainFlux:units = "kg m^{-2} s^{-1}" ;
		timeDaily_avg_rainFlux:long_name = "Fresh water flux from rain at cell centers from coupler. Positive into the ocean." ;
	double timeDaily_avg_snowFlux(Time, nCells) ;
		timeDaily_avg_snowFlux:units = "kg m^{-2} s^{-1}" ;
		timeDaily_avg_snowFlux:long_name = "Fresh water flux from snow at cell centers from coupler. Positive into the ocean." ;
	double timeDaily_avg_vertNonLocalFlux_vertNonLocalFluxTemp(Time, nCells, nVertLevelsP1) ;
		timeDaily_avg_vertNonLocalFlux_vertNonLocalFluxTemp:long_name = "CVMix/KPP: nonlocal boundary layer mixing term for temperature" ;
		timeDaily_avg_vertNonLocalFlux_vertNonLocalFluxTemp:units = "nondimensional" ;
	double timeDaily_avg_salinitySurfaceRestoringTendency(Time, nCells) ;
		timeDaily_avg_salinitySurfaceRestoringTendency:units = "m PSU/s" ;
		timeDaily_avg_salinitySurfaceRestoringTendency:long_name = "salinity tendency due to surface restoring" ;
	double timeDaily_avg_areaCellGlobal(Time) ;
		timeDaily_avg_areaCellGlobal:units = "m^2" ;
		timeDaily_avg_areaCellGlobal:long_name = "sum of the areaCell variable over the full domain, used to normalize global statistics" ;
	double timeDaily_avg_areaEdgeGlobal(Time) ;
		timeDaily_avg_areaEdgeGlobal:units = "m^2" ;
		timeDaily_avg_areaEdgeGlobal:long_name = "sum of the areaEdge variable over the full domain, used to normalize global statistics" ;
	double timeDaily_avg_areaTriangleGlobal(Time) ;
		timeDaily_avg_areaTriangleGlobal:units = "m^2" ;
		timeDaily_avg_areaTriangleGlobal:long_name = "sum of the areaTriangle variable over the full domain, used to normalize global statistics" ;
	double timeDaily_avg_volumeCellGlobal(Time) ;
		timeDaily_avg_volumeCellGlobal:units = "m^3" ;
		timeDaily_avg_volumeCellGlobal:long_name = "sum of the volumeCell variable over the full domain, used to normalize global statistics" ;
	double timeDaily_avg_volumeEdgeGlobal(Time) ;
		timeDaily_avg_volumeEdgeGlobal:units = "m^3" ;
		timeDaily_avg_volumeEdgeGlobal:long_name = "sum of the volumeEdge variable over the full domain, used to normalize global statistics" ;
	double timeDaily_avg_CFLNumberGlobal(Time) ;
		timeDaily_avg_CFLNumberGlobal:units = "unitless" ;
		timeDaily_avg_CFLNumberGlobal:long_name = "maximum CFL number over the full domain" ;
	double timeDaily_avg_vertDiffTopOfCell(Time, nCells, nVertLevelsP1) ;
		timeDaily_avg_vertDiffTopOfCell:units = "m^2 s^{-1}" ;
		timeDaily_avg_vertDiffTopOfCell:long_name = "vertical diffusion defined at the cell center (horizontally) and top (vertically)" ;
	double timeDaily_avg_vertViscTopOfCell(Time, nCells, nVertLevelsP1) ;
		timeDaily_avg_vertViscTopOfCell:units = "m^2 s^{-1}" ;
		timeDaily_avg_vertViscTopOfCell:long_name = "vertical viscosity defined at the cell center (horizontally) and top (vertically)" ;
	double timeDaily_avg_bulkRichardsonNumber(Time, nCells, nVertLevels) ;
		timeDaily_avg_bulkRichardsonNumber:units = "nondimensional" ;
		timeDaily_avg_bulkRichardsonNumber:long_name = "CVMix/KPP: bulk Richardson number" ;
	double timeDaily_avg_boundaryLayerDepth(Time, nCells) ;
		timeDaily_avg_boundaryLayerDepth:units = "m" ;
		timeDaily_avg_boundaryLayerDepth:long_name = "CVMix/KPP: diagnosed depth of the ocean surface boundary layer" ;
	double timeDaily_avg_surfaceBuoyancyForcing(Time, nCells) ;
		timeDaily_avg_surfaceBuoyancyForcing:units = "m^2 s^{-3}" ;
		timeDaily_avg_surfaceBuoyancyForcing:long_name = "CVMix/KPP: diagnosed surface buoyancy flux due to heat, salt and freshwater fluxes. Positive flux increases buoyancy." ;
	double timeDaily_avg_tendLayerThickness(Time, nCells, nVertLevels) ;
		timeDaily_avg_tendLayerThickness:units = "m s^{-1}" ;
		timeDaily_avg_tendLayerThickness:long_name = "time tendency of layer thickness" ;
	double timeDaily_avg_boundaryLayerDepthSmooth(Time, nCells) ;
		timeDaily_avg_boundaryLayerDepthSmooth:units = "m" ;
		timeDaily_avg_boundaryLayerDepthSmooth:long_name = "CVMix/KPP: smoothed boundary layer depth" ;
	double timeDaily_avg_pressureAdjustedSSH(Time, nCells) ;
		timeDaily_avg_pressureAdjustedSSH:units = "m" ;
		timeDaily_avg_pressureAdjustedSSH:long_name = "sea surface height adjusted by sea surface pressure" ;
	double timeDaily_avg_activeTracersTend_temperatureTend(Time, nCells, nVertLevels) ;
		timeDaily_avg_activeTracersTend_temperatureTend:long_name = "time tendency of potential temperature" ;
		timeDaily_avg_activeTracersTend_temperatureTend:units = "^\\circ C s^{-1}" ;
		timeDaily_avg_activeTracersTend_temperatureTend:_FillValue = 9.96920996838687e+36 ;
	double timeDaily_avg_activeTracersTend_salinityTend(Time, nCells, nVertLevels) ;
		timeDaily_avg_activeTracersTend_salinityTend:long_name = "time tendency of salinity measured as change in practical salinity units per second" ;
		timeDaily_avg_activeTracersTend_salinityTend:units = "PSU s^{-1}" ;
		timeDaily_avg_activeTracersTend_salinityTend:_FillValue = 9.96920996838687e+36 ;
	double timeDaily_avg_activeTracerHorizontalAdvectionTendency_temperatureHorizontalAdvectionTendency(Time, nCells, nVertLevels) ;
		timeDaily_avg_activeTracerHorizontalAdvectionTendency_temperatureHorizontalAdvectionTendency:long_name = "potential temperature tendency due to horizontal advection" ;
		timeDaily_avg_activeTracerHorizontalAdvectionTendency_temperatureHorizontalAdvectionTendency:units = "degrees Celsius per second" ;
	double timeDaily_avg_activeTracerHorizontalAdvectionTendency_salinityHorizontalAdvectionTendency(Time, nCells, nVertLevels) ;
		timeDaily_avg_activeTracerHorizontalAdvectionTendency_salinityHorizontalAdvectionTendency:long_name = "salinity tendency due to horizontal advection" ;
		timeDaily_avg_activeTracerHorizontalAdvectionTendency_salinityHorizontalAdvectionTendency:units = "PSU per second" ;
	double timeDaily_avg_activeTracerVerticalAdvectionTendency_temperatureVerticalAdvectionTendency(Time, nCells, nVertLevels) ;
		timeDaily_avg_activeTracerVerticalAdvectionTendency_temperatureVerticalAdvectionTendency:long_name = "potential temperature tendency due to vertical advection" ;
		timeDaily_avg_activeTracerVerticalAdvectionTendency_temperatureVerticalAdvectionTendency:units = "degrees Celsius per second" ;
	double timeDaily_avg_activeTracerVerticalAdvectionTendency_salinityVerticalAdvectionTendency(Time, nCells, nVertLevels) ;
		timeDaily_avg_activeTracerVerticalAdvectionTendency_salinityVerticalAdvectionTendency:long_name = "salinity tendency due to vertical advection" ;
		timeDaily_avg_activeTracerVerticalAdvectionTendency_salinityVerticalAdvectionTendency:units = "PSU per second" ;
	double timeDaily_avg_activeTracerVertMixTendency_temperatureVertMixTendency(Time, nCells, nVertLevels) ;
		timeDaily_avg_activeTracerVertMixTendency_temperatureVertMixTendency:long_name = "potential temperature tendency due to vertical mixing" ;
		timeDaily_avg_activeTracerVertMixTendency_temperatureVertMixTendency:units = "degrees Celsius per second" ;
	double timeDaily_avg_activeTracerVertMixTendency_salinityVertMixTendency(Time, nCells, nVertLevels) ;
		timeDaily_avg_activeTracerVertMixTendency_salinityVertMixTendency:long_name = "salinity tendency due to vertical mixing" ;
		timeDaily_avg_activeTracerVertMixTendency_salinityVertMixTendency:units = "PSU per second" ;
	double timeDaily_avg_activeTracerSurfaceFluxTendency_temperatureSurfaceFluxTendency(Time, nCells, nVertLevels) ;
		timeDaily_avg_activeTracerSurfaceFluxTendency_temperatureSurfaceFluxTendency:long_name = "potential temperature tendency due to surface fluxes" ;
		timeDaily_avg_activeTracerSurfaceFluxTendency_temperatureSurfaceFluxTendency:units = "degrees Celsius per second" ;
	double timeDaily_avg_activeTracerSurfaceFluxTendency_salinitySurfaceFluxTendency(Time, nCells, nVertLevels) ;
		timeDaily_avg_activeTracerSurfaceFluxTendency_salinitySurfaceFluxTendency:long_name = "salinity tendency due to surface fluxes" ;
		timeDaily_avg_activeTracerSurfaceFluxTendency_salinitySurfaceFluxTendency:units = "PSU per second" ;
	double timeDaily_avg_temperatureShortWaveTendency(Time, nCells, nVertLevels) ;
		timeDaily_avg_temperatureShortWaveTendency:units = "degrees Celsius per second" ;
		timeDaily_avg_temperatureShortWaveTendency:long_name = "potential temperature tendency due to penetrating shortwave" ;
	double timeDaily_avg_activeTracerNonLocalTendency_temperatureNonLocalTendency(Time, nCells, nVertLevels) ;
		timeDaily_avg_activeTracerNonLocalTendency_temperatureNonLocalTendency:long_name = "potential temperature tendency due to kpp non-local flux" ;
		timeDaily_avg_activeTracerNonLocalTendency_temperatureNonLocalTendency:units = "degrees Celsius per second" ;
	double timeDaily_avg_activeTracerNonLocalTendency_salinityNonLocalTendency(Time, nCells, nVertLevels) ;
		timeDaily_avg_activeTracerNonLocalTendency_salinityNonLocalTendency:long_name = "salinity tendency due to kpp non-local flux" ;
		timeDaily_avg_activeTracerNonLocalTendency_salinityNonLocalTendency:units = "PSU per second" ;
	double timeDaily_avg_activeTracerVerticalAdvectionTopFlux_temperatureVerticalAdvectionTopFlux(Time, nCells, nVertLevels) ;
		timeDaily_avg_activeTracerVerticalAdvectionTopFlux_temperatureVerticalAdvectionTopFlux:long_name = "potential temperature vertical advective flux through top of cell" ;
		timeDaily_avg_activeTracerVerticalAdvectionTopFlux_temperatureVerticalAdvectionTopFlux:units = "C m s^{-1}" ;
	double timeDaily_avg_activeTracerVerticalAdvectionTopFlux_salinityVerticalAdvectionTopFlux(Time, nCells, nVertLevels) ;
		timeDaily_avg_activeTracerVerticalAdvectionTopFlux_salinityVerticalAdvectionTopFlux:long_name = "salinity advective vertical advective flux through top of cell" ;
		timeDaily_avg_activeTracerVerticalAdvectionTopFlux_salinityVerticalAdvectionTopFlux:units = "PSU m s^{-1}" ;
	double timeDaily_avg_activeTracerHorizontalAdvectionEdgeFlux_temperatureHorizontalAdvectionEdgeFlux(Time, nEdges, nVertLevels) ;
		timeDaily_avg_activeTracerHorizontalAdvectionEdgeFlux_temperatureHorizontalAdvectionEdgeFlux:long_name = "potential temperature advective flux due to horizontal advection through edges" ;
		timeDaily_avg_activeTracerHorizontalAdvectionEdgeFlux_temperatureHorizontalAdvectionEdgeFlux:units = "C m s^{-1}" ;
	double timeDaily_avg_activeTracerHorizontalAdvectionEdgeFlux_salinityHorizontalAdvectionEdgeFlux(Time, nEdges, nVertLevels) ;
		timeDaily_avg_activeTracerHorizontalAdvectionEdgeFlux_salinityHorizontalAdvectionEdgeFlux:long_name = "salinity advective flux due to horizontal advection through edges" ;
		timeDaily_avg_activeTracerHorizontalAdvectionEdgeFlux_salinityHorizontalAdvectionEdgeFlux:units = "PSU m s^{-1}" ;
	double timeDaily_avg_activeTracers_temperature(Time, nCells, nVertLevels) ;
		timeDaily_avg_activeTracers_temperature:long_name = "potential temperature" ;
		timeDaily_avg_activeTracers_temperature:units = "degrees Celsius" ;
		timeDaily_avg_activeTracers_temperature:_FillValue = 9.96920996838687e+36 ;
	double timeDaily_avg_activeTracers_salinity(Time, nCells, nVertLevels) ;
		timeDaily_avg_activeTracers_salinity:long_name = "salinity" ;
		timeDaily_avg_activeTracers_salinity:units = "grams salt per kilogram seawater" ;
		timeDaily_avg_activeTracers_salinity:_FillValue = 9.96920996838687e+36 ;
	double timeDaily_avg_debugTracers_tracer1(Time, nCells, nVertLevels) ;
		timeDaily_avg_debugTracers_tracer1:long_name = "tracer for debugging purposes" ;
		timeDaily_avg_debugTracers_tracer1:units = "tracer1" ;
		timeDaily_avg_debugTracers_tracer1:_FillValue = 9.96920996838687e+36 ;
	double timeDaily_avg_debugTracers_tracer2(Time, nCells, nVertLevels) ;
		timeDaily_avg_debugTracers_tracer2:long_name = "tracer for debugging purposes" ;
		timeDaily_avg_debugTracers_tracer2:units = "tracer2" ;
		timeDaily_avg_debugTracers_tracer2:_FillValue = 9.96920996838687e+36 ;
	double timeDaily_avg_debugTracers_tracer3(Time, nCells, nVertLevels) ;
		timeDaily_avg_debugTracers_tracer3:long_name = "tracer for debugging purposes" ;
		timeDaily_avg_debugTracers_tracer3:units = "tracer3" ;
		timeDaily_avg_debugTracers_tracer3:_FillValue = 9.96920996838687e+36 ;
	double timeDaily_avg_activeTracersSurfaceFlux_temperatureSurfaceFlux(Time, nCells) ;
		timeDaily_avg_activeTracersSurfaceFlux_temperatureSurfaceFlux:long_name = "Flux of temperature through the ocean surface. Positive into ocean." ;
		timeDaily_avg_activeTracersSurfaceFlux_temperatureSurfaceFlux:units = "^\\circ C m s^{-1}" ;
	double timeDaily_avg_activeTracersSurfaceFlux_salinitySurfaceFlux(Time, nCells) ;
		timeDaily_avg_activeTracersSurfaceFlux_salinitySurfaceFlux:long_name = "Flux of salinity through the ocean surface. Positive into ocean." ;
		timeDaily_avg_activeTracersSurfaceFlux_salinitySurfaceFlux:units = "PSU m s^{-1}" ;
	double timeDaily_avg_activeTracersSurfaceFluxRunoff_temperatureSurfaceFluxRunoff(Time, nCells) ;
		timeDaily_avg_activeTracersSurfaceFluxRunoff_temperatureSurfaceFluxRunoff:long_name = "Flux of temperature through the ocean surface due to river runoff. Positive into ocean." ;
		timeDaily_avg_activeTracersSurfaceFluxRunoff_temperatureSurfaceFluxRunoff:units = "^\\circ C m s^{-1}" ;
	double timeDaily_avg_activeTracersSurfaceFluxRunoff_salinitySurfaceFluxRunoff(Time, nCells) ;
		timeDaily_avg_activeTracersSurfaceFluxRunoff_salinitySurfaceFluxRunoff:long_name = "Flux of salinity through the ocean surface due to river runoff. Positive into ocean." ;
		timeDaily_avg_activeTracersSurfaceFluxRunoff_salinitySurfaceFluxRunoff:units = "PSU m s^{-1}" ;
	double timeDaily_avg_activeTracersSurfaceFluxRemoved_temperatureSurfaceFluxRemoved(Time, nCells) ;
		timeDaily_avg_activeTracersSurfaceFluxRemoved_temperatureSurfaceFluxRemoved:long_name = "Flux of temperature that is ignored coming into the ocean. Positive into ocean." ;
		timeDaily_avg_activeTracersSurfaceFluxRemoved_temperatureSurfaceFluxRemoved:units = "^\\circ C m s^{-1}" ;
	double timeDaily_avg_activeTracersSurfaceFluxRemoved_salinitySurfaceFluxRemoved(Time, nCells) ;
		timeDaily_avg_activeTracersSurfaceFluxRemoved_salinitySurfaceFluxRemoved:long_name = "Flux of salinity that is ignored coming into the ocean. Positive into ocean." ;
		timeDaily_avg_activeTracersSurfaceFluxRemoved_salinitySurfaceFluxRemoved:units = "PSU m s^{-1}" ;
	double timeDaily_avg_nonLocalSurfaceTracerFlux_nonLocalTemperatureSurfaceFlux(Time, nCells) ;
		timeDaily_avg_nonLocalSurfaceTracerFlux_nonLocalTemperatureSurfaceFlux:long_name = "total flux of temperature (including thickness contributions) through ocean surface" ;
		timeDaily_avg_nonLocalSurfaceTracerFlux_nonLocalTemperatureSurfaceFlux:units = "^\\circ C m s^{-1}" ;
	double timeDaily_avg_nonLocalSurfaceTracerFlux_nonLocalSalinitySurfaceFlux(Time, nCells) ;
		timeDaily_avg_nonLocalSurfaceTracerFlux_nonLocalSalinitySurfaceFlux:long_name = "total flux of salinity (including thickness contributions) through ocean surface" ;
		timeDaily_avg_nonLocalSurfaceTracerFlux_nonLocalSalinitySurfaceFlux:units = "PSU m s^{-1}" ;
	double timeDaily_avg_debugTracersSurfaceFlux_tracer1SurfaceFlux(Time, nCells) ;
		timeDaily_avg_debugTracersSurfaceFlux_tracer1SurfaceFlux:long_name = "Flux of tracer1 through the ocean surface. Positive into ocean." ;
		timeDaily_avg_debugTracersSurfaceFlux_tracer1SurfaceFlux:units = "tracer1 m s^{-1}" ;
	double timeDaily_avg_debugTracersSurfaceFlux_tracer2SurfaceFlux(Time, nCells) ;
		timeDaily_avg_debugTracersSurfaceFlux_tracer2SurfaceFlux:long_name = "Flux of tracer2 through the ocean surface. Positive into ocean." ;
		timeDaily_avg_debugTracersSurfaceFlux_tracer2SurfaceFlux:units = "tracer2 m s^{-1}" ;
	double timeDaily_avg_debugTracersSurfaceFlux_tracer3SurfaceFlux(Time, nCells) ;
		timeDaily_avg_debugTracersSurfaceFlux_tracer3SurfaceFlux:long_name = "Flux of tracer3 through the ocean surface. Positive into ocean." ;
		timeDaily_avg_debugTracersSurfaceFlux_tracer3SurfaceFlux:units = "tracer3 m s^{-1}" ;
	double timeDaily_avg_debugTracersSurfaceFluxRunoff_tracer1SurfaceFluxRunoff(Time, nCells) ;
		timeDaily_avg_debugTracersSurfaceFluxRunoff_tracer1SurfaceFluxRunoff:long_name = "Flux of tracer1 through the ocean surface due to river runoff. Positive into ocean." ;
		timeDaily_avg_debugTracersSurfaceFluxRunoff_tracer1SurfaceFluxRunoff:units = "tracer1 m s^{-1}" ;
	double timeDaily_avg_debugTracersSurfaceFluxRunoff_tracer2SurfaceFluxRunoff(Time, nCells) ;
		timeDaily_avg_debugTracersSurfaceFluxRunoff_tracer2SurfaceFluxRunoff:long_name = "Flux of tracer2 through the ocean surface due to river runoff. Positive into ocean." ;
		timeDaily_avg_debugTracersSurfaceFluxRunoff_tracer2SurfaceFluxRunoff:units = "tracer2 m s^{-1}" ;
	double timeDaily_avg_debugTracersSurfaceFluxRunoff_tracer3SurfaceFluxRunoff(Time, nCells) ;
		timeDaily_avg_debugTracersSurfaceFluxRunoff_tracer3SurfaceFluxRunoff:long_name = "Flux of tracer3 through the ocean surface due to river runoff. Positive into ocean." ;
		timeDaily_avg_debugTracersSurfaceFluxRunoff_tracer3SurfaceFluxRunoff:units = "tracer3 m s^{-1}" ;
	double timeDaily_avg_debugTracersSurfaceFluxRemoved_tracer1SurfaceFluxRemoved(Time, nCells) ;
		timeDaily_avg_debugTracersSurfaceFluxRemoved_tracer1SurfaceFluxRemoved:long_name = "Flux of tracer1 that is ignored coming into the ocean. Positive into ocean." ;
		timeDaily_avg_debugTracersSurfaceFluxRemoved_tracer1SurfaceFluxRemoved:units = "tracer1 m s^{-1}" ;
	double timeDaily_avg_debugTracersSurfaceFluxRemoved_tracer2SurfaceFluxRemoved(Time, nCells) ;
		timeDaily_avg_debugTracersSurfaceFluxRemoved_tracer2SurfaceFluxRemoved:long_name = "Flux of tracer2 that is ignored coming into the ocean. Positive into ocean." ;
		timeDaily_avg_debugTracersSurfaceFluxRemoved_tracer2SurfaceFluxRemoved:units = "tracer2 m s^{-1}" ;
	double timeDaily_avg_debugTracersSurfaceFluxRemoved_tracer3SurfaceFluxRemoved(Time, nCells) ;
		timeDaily_avg_debugTracersSurfaceFluxRemoved_tracer3SurfaceFluxRemoved:long_name = "Flux of tracer3 that is ignored coming into the ocean. Positive into ocean." ;
		timeDaily_avg_debugTracersSurfaceFluxRemoved_tracer3SurfaceFluxRemoved:units = "tracer3 m s^{-1}" ;
...

There are _FillValues on the following variables:

timeDaily_avg_activeTracersTend_temperatureTend
timeDaily_avg_activeTracersTend_salinityTend
timeDaily_avg_activeTracers_temperature
timeDaily_avg_activeTracers_salinity
timeDaily_avg_debugTracers_tracer1
timeDaily_avg_debugTracers_tracer2
timeDaily_avg_debugTracers_tracer3

Looking at timeDaily_avg_activeTracersTend_temperatureTend, it looks like the invalid values are zeros instead of _FillValues. That might be fine -- the tracer tendency is, in fact, zero for invalid cells -- but in that case we don't actually want to add a _FillValue attribute. So we either need to make sure fill values are added to the tracer tendency terms where they are invalid or we need to remove the _FillValue attribute. The same applies to the salinity tendency variable.

The remaining 5 tracer variables are a good start but we would need _FillValues for all variables with a dimension of nVertLevels or nVertLevelsP1. That's quite a few still to go:

	double timeDaily_avg_velocityMeridional(Time, nCells, nVertLevels) ;
	double timeDaily_avg_velocityZonal(Time, nCells, nVertLevels) ;
	double timeDaily_avg_layerThickness(Time, nCells, nVertLevels) ;
	double timeDaily_avg_density(Time, nCells, nVertLevels) ;
	double timeDaily_avg_potentialDensity(Time, nCells, nVertLevels) ;
	double timeDaily_avg_normalVelocity(Time, nEdges, nVertLevels) ;
	double timeDaily_avg_vertVelocityTop(Time, nCells, nVertLevelsP1) ;
	double timeDaily_avg_normalGMBolusVelocity(Time, nEdges, nVertLevels) ;
	double timeDaily_avg_vertGMBolusVelocityTop(Time, nCells, nVertLevelsP1) ;
	double timeDaily_avg_GMBolusVelocityZonal(Time, nCells, nVertLevels) ;
	double timeDaily_avg_GMBolusVelocityMeridional(Time, nCells, nVertLevels) ;
	double timeDaily_avg_gmKappaScaling(Time, nCells, nVertLevelsP1) ;
	double timeDaily_avg_RediKappaScaling(Time, nCells, nVertLevelsP1) ;
	double timeDaily_avg_velocityZonalTimesTemperature_GM(Time, nCells, nVertLevels) ;
	double timeDaily_avg_velocityMeridionalTimesTemperature_GM(Time, nCells, nVertLevels) ;
	double timeDaily_avg_vertNonLocalFlux_vertNonLocalFluxTemp(Time, nCells, nVertLevelsP1) ;
	double timeDaily_avg_vertDiffTopOfCell(Time, nCells, nVertLevelsP1) ;
	double timeDaily_avg_vertViscTopOfCell(Time, nCells, nVertLevelsP1) ;
	double timeDaily_avg_bulkRichardsonNumber(Time, nCells, nVertLevels) ;
	double timeDaily_avg_tendLayerThickness(Time, nCells, nVertLevels) ;
	double timeDaily_avg_activeTracerHorizontalAdvectionTendency_temperatureHorizontalAdvectionTendency(Time, nCells, nVertLevels) ;
	double timeDaily_avg_activeTracerHorizontalAdvectionTendency_salinityHorizontalAdvectionTendency(Time, nCells, nVertLevels) ;
	double timeDaily_avg_activeTracerVerticalAdvectionTendency_temperatureVerticalAdvectionTendency(Time, nCells, nVertLevels) ;
	double timeDaily_avg_activeTracerVerticalAdvectionTendency_salinityVerticalAdvectionTendency(Time, nCells, nVertLevels) ;
	double timeDaily_avg_activeTracerVertMixTendency_temperatureVertMixTendency(Time, nCells, nVertLevels) ;
	double timeDaily_avg_activeTracerVertMixTendency_salinityVertMixTendency(Time, nCells, nVertLevels) ;
	double timeDaily_avg_activeTracerSurfaceFluxTendency_temperatureSurfaceFluxTendency(Time, nCells, nVertLevels) ;
	double timeDaily_avg_activeTracerSurfaceFluxTendency_salinitySurfaceFluxTendency(Time, nCells, nVertLevels) ;
	double timeDaily_avg_temperatureShortWaveTendency(Time, nCells, nVertLevels) ;
	double timeDaily_avg_activeTracerNonLocalTendency_temperatureNonLocalTendency(Time, nCells, nVertLevels) ;
	double timeDaily_avg_activeTracerNonLocalTendency_salinityNonLocalTendency(Time, nCells, nVertLevels) ;
	double timeDaily_avg_activeTracerVerticalAdvectionTopFlux_temperatureVerticalAdvectionTopFlux(Time, nCells, nVertLevels) ;
	double timeDaily_avg_activeTracerVerticalAdvectionTopFlux_salinityVerticalAdvectionTopFlux(Time, nCells, nVertLevels) ;
	double timeDaily_avg_activeTracerHorizontalAdvectionEdgeFlux_temperatureHorizontalAdvectionEdgeFlux(Time, nEdges, nVertLevels) ;
	double timeDaily_avg_activeTracerHorizontalAdvectionEdgeFlux_salinityHorizontalAdvectionEdgeFlux(Time, nEdges, nVertLevels) ;

@wenshanw, I think you mentioned on at least two different calls that you thought all the variables from analysis_members/mpaso.hist.am.timeSeriesStatsDaily.0001-01-01.nc that needed them had _FillValue attributes already. I am wondering if there was some miscommunication about which variables were relevant. I recall mentioning that "3D" variables needed fill values. By that, I meant variables with both a horizontal (nCells, nEdges or nVertices) and a vertical (nVertLevels or nVertLevelsP1) dimension. But you might have assumed it was variables with 3D arrays, which is entirely reasonable. I tried to clear that up at one point but I don't think I was very successful.

In any case, after the rebase, I think there's a considerable amount of work to do before timeSeriesStatsDaily (and Monthly) is ready to go. We could merge this PR first, taking care of tracers (once the tracer tendencies get fixed one way or another) and do the remaining variables in a new PR. I think that might be best, since the branch this PR is no is not very descriptive and it would be better to do the remaining work on a new branch.

@xylar
Copy link
Collaborator

xylar commented Aug 26, 2020

@wenshanw, could you change the name of the PR to something like "Add _FillValue to all active and debug tracer fields"? In the description of the PR at the top, could you edit to change "active tracers" to "active and debug tracers" in both items?

@wenshanw
Copy link
Author

wenshanw commented Aug 26, 2020

@xylar I am sorry I somehow had the impression to use this version. I have another version that I added _FillValue to all 3D variables. I will switch to that version in the next PR with a more specific branch name.

So we've done rebased here, right? (after I force-pushed your add_fill_value branch. Now if I create a new worktree/branch from my master branch, I will be working on the new base?

@wenshanw
Copy link
Author

@xylar I remove the _FillValue attribute from the activetracersTend variable group for now since I did not find where they were assigned zeros. I grepped 0.0_RKIND, Tend, and Tracer in core_ocean/ and tried all the places I found but none of them remove zeros in the final output.
BTW, how did you figure out the invalid value of timeDaily_avg_activeTracersTend_temperatureTend is zero?

@wenshanw wenshanw changed the title Replace -1e34 with _FillValue in active tracers Add _FillValue to all active and debug tracer fields Aug 26, 2020
@xylar
Copy link
Collaborator

xylar commented Aug 27, 2020

So we've done rebased here, right? (after I force-pushed your add_fill_value branch.

Yes, by resetting to my branch and force-pushing, these commits are now "based" off of the current ocean/develop rather than whatever version of ocean/develop you had originally started with. So they have been "rebased".

Now if I create a new worktree/branch from my master branch, I will be working on the new base?

Yes, that's right.

@xylar I remove the _FillValue attribute from the activetracersTend variable group for now since I did not find where they were assigned zeros. I grepped 0.0_RKIND, Tend, and Tracer in core_ocean/ and tried all the places I found but none of them remove zeros in the final output.
BTW, how did you figure out the invalid value of timeDaily_avg_activeTracersTend_temperatureTend is zero?

That's something for us to look into. One possibility is that MPAS variables default to being filled with zeros unless a different default value is set. But setting the fill value is supposed to also set that as the new default. So there must be somewhere that tendency variables get set to zero explicitly. @mark-petersen, could you help us track down where that is?

@xylar
Copy link
Collaborator

xylar commented Aug 27, 2020

@mark-petersen, I think this is ready to review. I think it might make sense to add fill values to just these 5 variables as a starting point and have a follow-up PR for the remaining variables. Does that seem okay to you?

Copy link
Collaborator

@xylar xylar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR does, indeed, add _FillValues to the following five variables in timeSeriesStatsDaily output:

		timeDaily_avg_activeTracers_temperature:_FillValue = 9.96920996838687e+36 ;
		timeDaily_avg_activeTracers_salinity:_FillValue = 9.96920996838687e+36 ;
		timeDaily_avg_debugTracers_tracer1:_FillValue = 9.96920996838687e+36 ;
		timeDaily_avg_debugTracers_tracer2:_FillValue = 9.96920996838687e+36 ;
		timeDaily_avg_debugTracers_tracer3:_FillValue = 9.96920996838687e+36 ;

I want to do some additional testing (including checking the EC60to30 mesh and timeSeriesStatsMonthly) once fill values are in all variables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants