Exemplo n.º 1
0
    def setUpClass(self):
        """
        Runs the short simulation over reynolds mountain east
        """
        run_dir = os.path.abspath(
            os.path.join(os.path.dirname(awsm.__file__), '..', 'tests', 'RME'))

        # Gold paths
        self.gold = os.path.abspath(
            os.path.join(os.path.dirname(awsm.__file__), '..', 'tests', 'RME',
                         'gold'))
        self.gold_em = os.path.join(self.gold, 'em.nc')
        self.gold_snow = os.path.join(self.gold, 'snow.nc')

        # Output
        self.output = os.path.join(
            run_dir, 'output/rme/devel/wy1986/rme_test/runs/run3337_3344')
        self.output_em = os.path.join(self.output, 'em.nc')
        self.output_snow = os.path.join(self.output, 'snow.nc')

        # Remove any potential files to ensure fresh run
        if os.path.isdir(self.output):
            shutil.rmtree(self.output)
            # for f in [self.output_snow,self.output_em]:
            #     if os.path.isfile(f):
            #         os.remove(f)

        config = os.path.join(run_dir, 'config.ini')

        # Run simulation
        can_i_run_awsm(config)
Exemplo n.º 2
0
    def test_base_run(self):
        """
        Test the config for running configurations with different options
        """

        # test the base run with the config file
        result = can_i_run_awsm(self.config_file)
        self.assertTrue(result)
        # self.assertTrue(False)

        # test the base run with the config file
        result = can_i_run_awsm(self.base_config)
        self.assertTrue(result)
Exemplo n.º 3
0
    def test_isnobal_restart(self):
        """ Test standard iSnobal with crash restart """

        config = deepcopy(self.base_config)

        config.raw_cfg['awsm master']['model_type'] = 'isnobal'
        config.raw_cfg['awsm master']['make_nc'] = False

        config.apply_recipes()

        config = cast_all_variables(config, config.mcfg)

        result = can_i_run_awsm(config)

        # run again with restart
        config = deepcopy(self.base_config)

        config.raw_cfg['awsm master']['model_type'] = 'isnobal'
        config.raw_cfg['awsm master']['make_nc'] = False
        config.raw_cfg['isnobal restart']['restart_crash'] = True
        config.raw_cfg['isnobal restart']['wyh_restart_output'] = 1464

        config.apply_recipes()

        config = cast_all_variables(config, config.mcfg)

        self.assertTrue(result)
Exemplo n.º 4
0
    def test_pysnobal_netcdf(self):
        """ Test PySnobal with netCDF Forcing """

        config = deepcopy(self.base_config)

        config.raw_cfg['awsm master']['make_in'] = False
        config.raw_cfg['awsm master']['mask_isnobal'] = True
        config.raw_cfg['ipysnobal']['forcing_data_type'] = 'netcdf'

        config.apply_recipes()
        config = cast_all_variables(config, config.mcfg)

        result = can_i_run_awsm(config)
        self.assertTrue(result)
Exemplo n.º 5
0
    def test_smrf_pysnobal_thread(self):
        """  Test smrf passing variables to PySnobal threaded """

        config = deepcopy(self.base_config)
        config.raw_cfg['awsm master']['run_smrf'] = False
        config.raw_cfg['awsm master']['make_in'] = False
        config.raw_cfg['awsm master']['model_type'] = 'smrf_ipysnobal'
        config.raw_cfg['system']['threading'] = True

        config.apply_recipes()
        config = cast_all_variables(config, config.mcfg)

        result = can_i_run_awsm(config)
        self.assertTrue(result)
Exemplo n.º 6
0
    def test_pysnobal(self):
        """ Test standard Pysnobal """

        config = deepcopy(self.base_config)

        # config.raw_cfg['files']['init_type'] = 'ipw_out'
        # config.raw_cfg['files']['init_file'] = './RME/snow.2538'
        config.apply_recipes()
        config = cast_all_variables(config, config.mcfg)

        # ensure that the recipes are used
        self.assertTrue(config.cfg['awsm master']['model_type'] == 'ipysnobal')

        result = can_i_run_awsm(config)
        self.assertTrue(result)
Exemplo n.º 7
0
    def test_isnobal(self):
        """ Test standard iSnobal """

        config = deepcopy(self.base_config)

        config.raw_cfg['awsm master']['make_nc'] = True
        config.raw_cfg['awsm master']['mask_isnobal'] = True
        config.raw_cfg['awsm master']['model_type'] = 'isnobal'

        config.apply_recipes()

        config = cast_all_variables(config, config.mcfg)

        # ensure that the recipes are used
        self.assertTrue(config.cfg['awsm master']['model_type'] == 'isnobal')

        result = can_i_run_awsm(config)
        self.assertTrue(result)