Exemple #1
0
    def validate(self):
        """
        Test cases can override this method to perform validation of variables
        and timers
        """
        config = self.config
        work_dir = self.work_dir

        failed = list()
        for filename, variables in self.variables.items():
            try:
                compare_variables(test_case=self,
                                  variables=variables,
                                  filename1=os.path.join('forward', filename))
            except ValueError:
                traceback.print_exc()
                failed.append(filename)

        if len(failed) > 0:
            raise ValueError('Comparison failed, see above, for the following '
                             'files:\n{}.'.format('\n'.join(failed)))

        timers = [
            'compute_globalStats', 'write_globalStats',
            'compute_debugDiagnostics', 'write_debugDiagnostics',
            'compute_eliassenPalm', 'write_eliassenPalm',
            'compute_highFrequency', 'write_highFrequency',
            'compute_layerVolumeWeightedAverage',
            'write_layerVolumeWeightedAverage',
            'compute_meridionalHeatTransport', 'write_meridionalHeatTransport',
            'compute_mixedLayerDepths', 'write_mixedLayerDepths',
            'compute_okuboWeiss', 'write_okuboWeiss',
            'compute_surfaceAreaWeightedAverages',
            'write_surfaceAreaWeightedAverages', 'compute_waterMassCensus',
            'write_waterMassCensus', 'compute_zonalMean', 'write_zonalMean',
            'compute_eddyProductVariables', 'write_eddyProductVariables',
            'compute_oceanHeatContent', 'write_oceanHeatContent',
            'compute_mixedLayerHeatBudget', 'write_mixedLayerHeatBudget'
        ]
        compare_timers(self, timers, rundir1='forward')

        variables = [
            'temperature', 'salinity', 'layerThickness', 'normalVelocity'
        ]
        if self.init.with_bgc:
            variables.extend([
                'PO4', 'NO3', 'SiO3', 'NH4', 'Fe', 'O2', 'DIC', 'DIC_ALT_CO2',
                'ALK', 'DOC', 'DON', 'DOFe', 'DOP', 'DOPr', 'DONr', 'zooC',
                'spChl', 'spC', 'spFe', 'spCaCO3', 'diatChl', 'diatC',
                'diatFe', 'diatSi', 'diazChl', 'diazC', 'diazFe', 'phaeoChl',
                'phaeoC', 'phaeoFe'
            ])

        compare_variables(test_case=self,
                          variables=variables,
                          filename1='forward/output.nc')

        timers = ['time integration']
        compare_timers(self, timers, rundir1='forward')
Exemple #2
0
 def validate(self):
     """
     Test cases can override this method to perform validation of variables
     and timers
     """
     variables = ['thickness', 'surfaceSpeed']
     compare_variables(test_case=self, variables=variables,
                       filename1='full_run/output.nc',
                       filename2='restart_run/output.nc')
Exemple #3
0
 def validate(self):
     """
     Test cases can override this method to perform validation of variables
     and timers
     """
     variables = ['xCell', 'yCell', 'zCell']
     compare_variables(test_case=self,
                       variables=variables,
                       filename1='mesh/culled_mesh.nc')
Exemple #4
0
 def validate(self):
     """
     Test cases can override this method to perform validation of variables
     and timers
     """
     variables = [
         'thickness', 'temperature', 'basalTemperature', 'heatDissipation'
     ]
     compare_variables(test_case=self,
                       variables=variables,
                       filename1='1proc_run/output.nc',
                       filename2='4proc_run/output.nc')
Exemple #5
0
    def validate(self):
        """
        Test cases can override this method to perform validation of variables
        and timers
        """
        variables = [
            'timeDaily_avg_activeTracers_temperature',
            'timeDaily_avg_activeTracers_salinity',
            'timeDaily_avg_layerThickness', 'timeDaily_avg_normalVelocity',
            'timeDaily_avg_ssh'
        ]

        compare_variables(test_case=self,
                          variables=variables,
                          filename1='forward/analysis_members/'
                          'mpaso.hist.am.timeSeriesStatsDaily.0001-01-01.nc')
Exemple #6
0
    def validate(self):
        """
        Test cases can override this method to perform validation of variables
        and timers
        """
        variables = ['temperature', 'layerThickness']
        compare_variables(
            test_case=self, variables=variables,
            filename1='forward/output/output.0001-01-01_00.00.00.nc')

        variables = ['accumulatedFrazilIceMass',
                     'accumulatedFrazilIceSalinity',
                     'seaIceEnergy', 'frazilLayerThicknessTendency',
                     'frazilTemperatureTendency', 'frazilSalinityTendency',
                     'frazilSurfacePressure',
                     'accumulatedLandIceFrazilMass']
        compare_variables(test_case=self, variables=variables,
                          filename1='forward/frazil.nc')
Exemple #7
0
    def validate(self):
        """
        Test cases can override this method to perform validation of variables
        and timers
        """
        variables = ['temperature', 'salinity', 'layerThickness',
                     'normalVelocity']
        compare_variables(test_case=self, variables=variables,
                          filename1='forward/output.nc')

        variables = \
            ['ssh', 'landIcePressure', 'landIceDraft', 'landIceFraction',
             'landIceMask', 'landIceFrictionVelocity', 'topDrag',
             'topDragMagnitude', 'landIceFreshwaterFlux',
             'landIceHeatFlux', 'heatFluxToLandIce',
             'landIceBoundaryLayerTemperature', 'landIceBoundaryLayerSalinity',
             'landIceHeatTransferVelocity', 'landIceSaltTransferVelocity',
             'landIceInterfaceTemperature', 'landIceInterfaceSalinity',
             'accumulatedLandIceMass', 'accumulatedLandIceHeat']
        compare_variables(test_case=self, variables=variables,
                          filename1='forward/land_ice_fluxes.nc')
Exemple #8
0
    def validate(self):
        """
        Test cases can override this method to perform validation of variables
        and timers
        """
        variables = ['temperature', 'salinity', 'layerThickness']
        compare_variables(test_case=self,
                          variables=variables,
                          filename1='initial_state/initial_state.nc')

        if self.with_bgc:
            variables = [
                'temperature', 'salinity', 'layerThickness', 'PO4', 'NO3',
                'SiO3', 'NH4', 'Fe', 'O2', 'DIC', 'DIC_ALT_CO2', 'ALK', 'DOC',
                'DON', 'DOFe', 'DOP', 'DOPr', 'DONr', 'zooC', 'spChl', 'spC',
                'spFe', 'spCaCO3', 'diatChl', 'diatC', 'diatFe', 'diatSi',
                'diazChl', 'diazC', 'diazFe', 'phaeoChl', 'phaeoC', 'phaeoFe',
                'DMS', 'DMSP', 'PROT', 'POLY', 'LIP'
            ]
            compare_variables(test_case=self,
                              variables=variables,
                              filename1='initial_state/initial_state.nc')

        if self.mesh.with_ice_shelf_cavities:
            variables = ['ssh', 'landIcePressure']
            compare_variables(test_case=self,
                              variables=variables,
                              filename1='ssh_adjustment/adjusted_init.nc')
Exemple #9
0
    def validate(self):
        """
        Test cases can override this method to perform validation of variables
        and timers
        """
        variables = [
            'temperature', 'salinity', 'layerThickness', 'normalVelocity'
        ]
        if self.init.with_bgc:
            variables.extend([
                'PO4', 'NO3', 'SiO3', 'NH4', 'Fe', 'O2', 'DIC', 'DIC_ALT_CO2',
                'ALK', 'DOC', 'DON', 'DOFe', 'DOP', 'DOPr', 'DONr', 'zooC',
                'spChl', 'spC', 'spFe', 'spCaCO3', 'diatChl', 'diatC',
                'diatFe', 'diatSi', 'diazChl', 'diazC', 'diazFe', 'phaeoChl',
                'phaeoC', 'phaeoFe'
            ])

        compare_variables(test_case=self,
                          variables=variables,
                          filename1='forward/output.nc')

        if self.mesh.with_ice_shelf_cavities:
            variables = [
                'ssh', 'landIcePressure', 'landIceDraft', 'landIceFraction',
                'landIceMask', 'landIceFrictionVelocity', 'topDrag',
                'topDragMagnitude', 'landIceFreshwaterFlux', 'landIceHeatFlux',
                'heatFluxToLandIce', 'landIceBoundaryLayerTemperature',
                'landIceBoundaryLayerSalinity', 'landIceHeatTransferVelocity',
                'landIceSaltTransferVelocity', 'landIceInterfaceTemperature',
                'landIceInterfaceSalinity', 'accumulatedLandIceMass',
                'accumulatedLandIceHeat'
            ]

            compare_variables(test_case=self,
                              variables=variables,
                              filename1='forward/land_ice_fluxes.nc')

        timers = ['time integration']
        compare_timers(self, timers, rundir1='forward')
Exemple #10
0
    def validate(self):
        """
        Test cases can override this method to perform validation of variables
        and timers
        """
        variables = ['bottomDepth', 'ssh', 'layerThickness', 'zMid',
                     'maxLevelCell', 'temperature', 'salinity']
        compare_variables(
            test_case=self, variables=variables,
            filename1='initial_state/initial_state.nc')

        variables = ['temperature', 'salinity', 'layerThickness',
                     'normalVelocity']
        compare_variables(test_case=self, variables=variables,
                          filename1='full_run/output.nc',
                          filename2='restart_run/output.nc')

        variables = ['ssh', 'landIcePressure', 'landIceDraft',
                     'landIceFraction',
                     'landIceMask', 'landIceFrictionVelocity', 'topDrag',
                     'topDragMagnitude', 'landIceFreshwaterFlux',
                     'landIceHeatFlux', 'heatFluxToLandIce',
                     'landIceBoundaryLayerTemperature',
                     'landIceBoundaryLayerSalinity',
                     'landIceHeatTransferVelocity',
                     'landIceSaltTransferVelocity',
                     'landIceInterfaceTemperature',
                     'landIceInterfaceSalinity', 'accumulatedLandIceMass',
                     'accumulatedLandIceHeat']
        compare_variables(test_case=self, variables=variables,
                          filename1='full_run/land_ice_fluxes.nc',
                          filename2='restart_run/land_ice_fluxes.nc')

        variables = ['accumulatedFrazilIceMass',
                     'accumulatedFrazilIceSalinity',
                     'seaIceEnergy', 'frazilLayerThicknessTendency',
                     'frazilTemperatureTendency', 'frazilSalinityTendency',
                     'frazilSurfacePressure',
                     'accumulatedLandIceFrazilMass']
        compare_variables(test_case=self, variables=variables,
                          filename1='full_run/frazil.nc',
                          filename2='restart_run/frazil.nc')
Exemple #11
0
    def validate(self):
        """
        Test cases can override this method to perform validation of variables
        and timers
        """
        if self.velo_solver == 'sia':
            compare_variables(test_case=self,
                              variables=['thickness', 'normalVelocity'],
                              filename1='1proc_run/output.nc',
                              filename2='4proc_run/output.nc')

        elif self.velo_solver == 'FO':
            # validate thickness
            variable = ['thickness', ]
            if self.mesh_type == 'variable_resolution':
                l1_norm = 1.0e-11
                l2_norm = 1.0e-12
                linf_norm = 1.0e-12
            elif self.mesh_type == '2000m':
                l1_norm = 1.0e-9
                l2_norm = 1.0e-11
                linf_norm = 1.0e-11
            compare_variables(test_case=self, variables=variable,
                              filename1='1proc_run/output.nc',
                              filename2='4proc_run/output.nc',
                              l1_norm=l1_norm, l2_norm=l2_norm,
                              linf_norm=linf_norm, quiet=False)

            # validate normalVelocity
            variable = ['normalVelocity', ]
            if self.mesh_type == 'variable_resolution':
                l1_norm = 1.0e-17
                l2_norm = 1.0e-18
                linf_norm = 1.0e-19
            elif self.mesh_type == '2000m':
                l1_norm = 1.0e-15
                l2_norm = 1.0e-16
                linf_norm = 1.0e-18
            compare_variables(test_case=self, variables=variable,
                              filename1='1proc_run/output.nc',
                              filename2='4proc_run/output.nc',
                              l1_norm=l1_norm, l2_norm=l2_norm,
                              linf_norm=linf_norm, quiet=False)
Exemple #12
0
 def validate(self):
     """
     Test cases can override this method to perform validation of variables
     and timers
     """
     # validate each variable with custom norm
     compare_variables(test_case=self,
                       variables=[
                           'normalVelocity',
                       ],
                       filename1='1proc_run/output.nc',
                       filename2='4proc_run/output.nc',
                       l1_norm=1.0e-3,
                       l2_norm=1.0e-5,
                       linf_norm=1.0e-7,
                       quiet=False)
     compare_variables(test_case=self,
                       variables=[
                           'uReconstructX',
                       ],
                       filename1='1proc_run/output.nc',
                       filename2='4proc_run/output.nc',
                       l1_norm=1.0e-4,
                       l2_norm=2.0e-6,
                       linf_norm=1.0e-7,
                       quiet=False)
     compare_variables(test_case=self,
                       variables=[
                           'uReconstructY',
                       ],
                       filename1='1proc_run/output.nc',
                       filename2='4proc_run/output.nc',
                       l1_norm=1.0e-4,
                       l2_norm=2.0e-6,
                       linf_norm=1.0e-7,
                       quiet=False)