From fa11391f3cf84a139f1a07dcc84a4194244dc909 Mon Sep 17 00:00:00 2001 From: Andrew Benson Date: Wed, 28 Jul 2021 20:26:59 +0000 Subject: [PATCH] fix: Do not output attributes associated with target dataset if no such dataset exists In the "meanFunction1D" analysis class we should not set these attributes in the output if no target dataset exists, as setting them causes analysis scripts to expect to find a target dataset. --- source/galacticus.output.analyses.mean_function_1d.F90 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/galacticus.output.analyses.mean_function_1d.F90 b/source/galacticus.output.analyses.mean_function_1d.F90 index c7e0ac1475..9ac00f5707 100644 --- a/source/galacticus.output.analyses.mean_function_1d.F90 +++ b/source/galacticus.output.analyses.mean_function_1d.F90 @@ -747,9 +747,11 @@ subroutine meanFunction1DFinalize(self) call analysisGroup%writeAttribute( self% yAxisIsLog ,'yAxisIsLog' ) call analysisGroup%writeAttribute( char(self%propertyLabel) ,'xDataset' ) call analysisGroup%writeAttribute( char(self% meanLabel) ,'yDataset' ) - call analysisGroup%writeAttribute( char(self% meanLabel)//"Target" ,'yDatasetTarget' ) call analysisGroup%writeAttribute( char(self% meanLabel)//"Covariance" ,'yCovariance' ) - call analysisGroup%writeAttribute( char(self% meanLabel)//"CovarianceTarget",'yCovarianceTarget' ) + if (allocated(self%meanValueTarget)) then + call analysisGroup%writeAttribute( char(self% meanLabel)//"Target" ,'yDatasetTarget' ) + call analysisGroup%writeAttribute( char(self% meanLabel)//"CovarianceTarget",'yCovarianceTarget' ) + end if ! Write computed datasets. call analysisGroup%writeDataset ( self%binCenter ,char(self%propertyLabel) ,char(self%propertyComment) ,datasetReturned=dataset) call dataset %writeAttribute( char(self%propertyUnits ) ,'units' )