コード例 #1
0
 def test_run_model_ExB_files(self):
     """Test to ensure that the ExB files are copied properly
     """
     sami2py.run_model(tag='test', lon=0, year=2012, day=211, test=True,
                       fmtout=self.format,
                       fejer=False, ExB_drifts=np.zeros((10, 2)))
     assert os.stat(os.path.join(self.model_path, 'exb.inp'))
コード例 #2
0
 def test_run_model_ExB_wrong_size(self):
     """Test to ensure that the ExB has proper shape
     """
     with pytest.raises(Exception):
         sami2py.run_model(year=2012, day=211, test=True,
                           fmtout=self.format, fejer=False,
                           ExB_drifts=np.zeros((1, 2)))
コード例 #3
0
ファイル: test_core.py プロジェクト: scivision/sami2py
 def test_run_model_namelist(self):
     """The test to ensure that the namelist file is generated properly
     """
     sami2py.run_model(year=2012, day=211, test=True, fmtout=self.format)
     namelist_file = self.model_path + 'sami2py-1.00.namelist'
     ref_namelist = os.path.join(test_data_dir, self.ref_file)
     assert filecmp.cmp(namelist_file, ref_namelist)
コード例 #4
0
 def test_run_model_namelist_w_invalid_hwm(self):
     """The test to ensure that the invalid hwm reverts to 14
     """
     sami2py.run_model(tag='test', lon=0, year=2012, day=211, test=True,
                       fmtout=self.format, hwm_model=15)
     namelist_file = os.path.join(self.model_path, 'sami2py-1.00.namelist')
     ref_namelist = os.path.join(test_data_dir, self.ref_file)
     assert cmp_lines(namelist_file, ref_namelist)
コード例 #5
0
 def test_run_model_namelist(self):
     """The test to ensure that the namelist file is generated properly
     """
     sami2py.run_model(tag='test', lon=0, year=2012, day=211, test=True,
                       fmtout=self.format)
     namelist_file = os.path.join(self.model_path, 'sami2py-1.00.namelist')
     ref_namelist = os.path.join(test_data_dir, self.ref_file)
     assert cmp_lines(namelist_file, ref_namelist)
コード例 #6
0
 def test_input_format(self):
     """Test for error output upon incorrect input format
        file.write should throw the error when using string formatting to
        create the file name. Will happen for any variable in the namelist
        set with the wrong type
     """
     with pytest.raises(ValueError):
         sami2py.run_model(tag='test', year='2012', day='211', test=True,
                           fmtout=self.format)
コード例 #7
0
ファイル: test_core.py プロジェクト: scivision/sami2py
 def test_run_model_dat_files(self):
     """Test to ensure that the dat files are copied properly
     """
     sami2py.run_model(year=2012, day=211, test=True, fmtout=self.format)
     if self.format:
         fname = 'glonf.dat'
     else:
         fname = 'glonu.dat'
     assert os.stat(self.model_path + fname)
コード例 #8
0
 def test_run_model_dat_files(self):
     """Test to ensure that the dat files are copied properly
     """
     sami2py.run_model(tag='test', lon=0, year=2012, day=211, test=True,
                       fmtout=self.format, outn=True)
     if self.format:
         fname = 'glonf.dat'
     else:
         fname = 'glonu.dat'
     assert os.stat(os.path.join(self.model_path, fname))
コード例 #9
0
 def test_fortran_executable(self):
     """Short run of fortran executable to ensure the code compiles
        and runs
     """
     tmp_archive_dir = sami2py.archive_dir
     sami2py.utils.set_archive_dir(path=test_data_dir)
     sami2py.run_model(tag='test', year=2012, day=211, fmtout=self.format,
                       dthr=0.05, hrinit=0.0, hrpr=0.0, hrmax=.11)
     if os.path.isdir(tmp_archive_dir):
         sami2py.utils.set_archive_dir(path=tmp_archive_dir)
     else:
         with open(sami2py.archive_path, 'w') as archive_file:
             archive_file.write('')
             sami2py.archive_dir = ''
コード例 #10
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) 2017, JK & JH
# Full license can be found in License.md
# -----------------------------------------------------------------------------
"""
sami2py
-----------


Functions
---------------------------------------------------------------------------
run_model(year, day, lat=0, lon=0, alt=300,
              f107=120, f107a=120, ap=0,
              rmin=100, rmax=2000, gams=3, gamp=3, altmin=85.,
              dthr=0.25, hrinit=0., hrpr=24., hrmax=48.,
              dt0=30., maxstep=100000000, denmin=1.e-6,
              nion1=1, nion2=7, mmass=48, h_scale=1, o_scale=1,
              no_scale=1, o2_scale=1, he_scale=1, n2_scale=1, n_scale=1,
              Tinf_scale=1, Tn_scale=1., euv_scale=1,
              wind_scale=1, hwm_model=14,
              fejer=True, ExB_drifts=np.zeros((10,2)), ve01=0., exb_scale=1,
              alt_crit=150., cqe=7.e-14,
              tag='test', clean=False, test=False)

    Initializes a run of the SAMI2 model and archives the data.
---------------------------------------------------------------------------

Classes
---------------------------------------------------------------------------
model