コード例 #1
0
ファイル: test_cdl.py プロジェクト: mazj/bald
 def atest(self):
     with self.temp_filename('.nc') as tfile:
         subprocess.check_call(['ncgen', '-o', tfile, cdlfile])
         validation = bald.validate_netcdf(tfile, cache=self.acache)
         exns = validation.exceptions()
         self.assertTrue(validation.is_valid(),
                         msg='{} != []'.format(exns))
コード例 #2
0
 def test_process_chain(self):
     with self.temp_filename('.nc') as tfile:
         cdl_file = os.path.join(self.cdl_path, 'ProcessChain0300.cdl')
         subprocess.check_call(['ncgen', '-o', tfile, cdl_file])
         validation = bald.validate_netcdf(tfile)
         exns = validation.exceptions()
         self.assertTrue(validation.is_valid(), msg='{}  != []'.format(exns))
コード例 #3
0
 def test_mismatch_zeroth(self):
     with self.temp_filename('.nc') as tfile:
         f = netCDF4.Dataset(tfile, "w", format="NETCDF4")
         f = _fattrs(f)
         f = _create_parent_child(f, (11, 17), (11, 13))
         f.close()
         validation = bald.validate_netcdf(tfile)
         self.assertFalse(validation.is_valid())
コード例 #4
0
    def test_valid_uri(self):
        with self.temp_filename('.nc') as tfile:
            f = netCDF4.Dataset(tfile, "w", format="NETCDF4")

            f = _fattrs(f)
            f.close()
            validation = bald.validate_netcdf(tfile)
            self.assertTrue(validation.is_valid())
コード例 #5
0
    def test_validate_multi_array_reference(self):

        cdlfile = os.path.join(self.cdl_path, 'multi_array_reference.cdl')
        with self.temp_filename('.nc') as tfile:
            subprocess.check_call(['ncgen', '-o', tfile, cdlfile])
            validation = bald.validate_netcdf(tfile, cache=self.acache)
            exns = validation.exceptions()
            self.assertTrue(validation.is_valid(), msg='{} != []'.format(exns))
コード例 #6
0
ファイル: test_netcdf.py プロジェクト: jjlevit/bald
 def test_match(self):
     with self.temp_filename('.nc') as tfile:
         f = netCDF4.Dataset(tfile, "w", format="NETCDF4")
         f = _fattrs(f)
         f = _create_parent_child(f, (11, 17), (11, 17))
         f.close()
         validation = bald.validate_netcdf(tfile)
         exns = validation.exceptions()
         self.assertTrue(validation.is_valid(), msg='{}  != []'.format(exns))
コード例 #7
0
    def test_invalid_uri(self):
        with self.temp_filename('.nc') as tfile:
            f = netCDF4.Dataset(tfile, "w", format="NETCDF4")

            f = _fattrs(f)
            setattr(f, 'bald__turtle', 'bald__walnut')
            f.close()
            validation = bald.validate_netcdf(tfile)
            self.assertFalse(validation.is_valid())
コード例 #8
0
ファイル: test_netcdf4_classic.py プロジェクト: marqh/bald
    def test_valid_uri(self):
        with self.temp_filename('.nc') as tfile:
            f = netCDF4.Dataset(tfile, "w", format="NETCDF4_CLASSIC")

            f = _fattrs(f)
            f.close()
            validation = bald.validate_netcdf(tfile, cache=self.acache)
            exns = validation.exceptions()
            self.assertTrue(validation.is_valid(), msg='{}  != []'.format(exns))
コード例 #9
0
ファイル: test_netcdf.py プロジェクト: marqh/bald
 def test_match(self):
     with self.temp_filename('.nc') as tfile:
         f = netCDF4.Dataset(tfile, "w", format="NETCDF4")
         f = _fattrs(f)
         f = _create_parent_child(f, (11, 17), (11, 17))
         f.close()
         validation = bald.validate_netcdf(tfile, cache=self.acache)
         exns = validation.exceptions()
         self.assertTrue(validation.is_valid(), msg='{}  != []'.format(exns))
コード例 #10
0
    def test_valid_uri(self):
        with self.temp_filename('.nc') as tfile:
            f = netCDF4.Dataset(tfile, "w", format="NETCDF4")

            f = _fattrs(f)
            f.close()
            validation = bald.validate_netcdf(tfile, cache=self.acache)
            exns = validation.exceptions()
            self.assertTrue(validation.is_valid(), msg='{}  != []'.format(exns))
コード例 #11
0
ファイル: test_netcdf.py プロジェクト: jjlevit/bald
 def test_mismatch_zeroth(self):
     with self.temp_filename('.nc') as tfile:
         f = netCDF4.Dataset(tfile, "w", format="NETCDF4")
         f = _fattrs(f)
         f = _create_parent_child(f, (11, 17), (11, 13))
         f.close()
         validation = bald.validate_netcdf(tfile)
         exns = validation.exceptions()
         expected = ['p declares a child of c but the arrays do not conform to the bald array reference rules']
         self.assertTrue((not validation.is_valid()) and exns == expected,
                          msg='{}  != {}'.format(exns, expected))
コード例 #12
0
ファイル: test_netcdf.py プロジェクト: jjlevit/bald
    def test_invalid_uri(self):
        with self.temp_filename('.nc') as tfile:
            f = netCDF4.Dataset(tfile, "w", format="NETCDF4")

            f = _fattrs(f)
            setattr(f, 'bald__turtle', 'bald__walnut')
            f.close()
            validation = bald.validate_netcdf(tfile)
            exns = validation.exceptions()
            expected = ['http://binary-array-ld.net/latest/turtle is not resolving as a resource (404).',
                        'http://binary-array-ld.net/latest/walnut is not resolving as a resource (404).']
            self.assertTrue((not validation.is_valid()) and exns == expected,
                             msg='{}  != {}'.format(exns, expected))
コード例 #13
0
ファイル: test_netcdf.py プロジェクト: marqh/bald
    def test_invalid_uri(self):
        with self.temp_filename('.nc') as tfile:
            f = netCDF4.Dataset(tfile, "w", format="NETCDF4")

            f = _fattrs(f)
            setattr(f, 'bald__turtle', 'bald__walnut')
            f.close()
            validation = bald.validate_netcdf(tfile, cache=self.acache)
            exns = validation.exceptions()
            expected = ['http://binary-array-ld.net/latest/turtle is not resolving as a resource (404).',
                        'http://binary-array-ld.net/latest/walnut is not resolving as a resource (404).']
            self.assertTrue((not validation.is_valid()) and exns == expected,
                             msg='{}  != {}'.format(exns, expected))
コード例 #14
0
ファイル: test_cdl.py プロジェクト: marqh/bald
def test_grid_OISST_GHRSST(self):
    """Override grid OISST GHRSST test with currently accepted failures"""
    with self.temp_filename('.nc') as tfile:
        cdl_file = os.path.join(self.cdl_path, 'grid_OISST_GHRSST.cdl')
        subprocess.check_call(['ncgen', '-o', tfile, cdl_file])
        validation = bald.validate_netcdf(tfile, cache=self.acache)
        exns = validation.exceptions()
        exns.sort()
        expected = ['http://www.ncdc.noaa.gov/sst is not resolving as a resource (404).',
                    'http://www.ncdc.noaa.gov/sst/ is not resolving as a resource (404).']
        expected.sort()
        self.assertTrue(not validation.is_valid() and exns == expected,
                        msg='{} \n!= \n{}'.format(exns, expected))
コード例 #15
0
def test_grid_OISST_GHRSST(self):
    """Override grid OISST GHRSST test with currently accepted failures"""
    with self.temp_filename('.nc') as tfile:
        cdl_file = os.path.join(self.cdl_path, 'grid_OISST_GHRSST.cdl')
        subprocess.check_call(['ncgen', '-o', tfile, cdl_file])
        validation = bald.validate_netcdf(tfile)
        exns = validation.exceptions()
        exns.sort()
        expected = ['http://www.ncdc.noaa.gov/sst is not resolving as a resource (404).',
                    'http://www.ncdc.noaa.gov/sst/ is not resolving as a resource (404).']
        expected.sort()
        self.assertTrue(not validation.is_valid() and exns == expected,
                        msg='{} \n!= \n{}'.format(exns, expected))
コード例 #16
0
 def test_mismatch_zeroth(self):
     with self.temp_filename('.nc') as tfile:
         f = netCDF4.Dataset(tfile, "w", format="NETCDF4")
         f = _fattrs(f)
         f = _create_parent_child(f, (11, 17), (11, 13))
         f.close()
         validation = bald.validate_netcdf(tfile, cache=self.acache)
         exns = validation.exceptions()
         expected = [('file://{t}/source_variable declares a target of '
                      'file://{t}/target_variable but the arrays do not '
                      'conform to the bald array reference rules'
                      '').format(t=tfile)]
         self.assertTrue((not validation.is_valid()) and exns == expected,
                          msg='{}  != {}'.format(exns, expected))
コード例 #17
0
ファイル: test_netcdf.py プロジェクト: marqh/bald
 def test_mismatch_zeroth(self):
     with self.temp_filename('.nc') as tfile:
         f = netCDF4.Dataset(tfile, "w", format="NETCDF4")
         f = _fattrs(f)
         f = _create_parent_child(f, (11, 17), (11, 13))
         f.close()
         validation = bald.validate_netcdf(tfile, cache=self.acache)
         exns = validation.exceptions()
         expected = [('file://{t}/parent_variable declares a child of '
                      'file://{t}/child_variable but the arrays do not '
                      'conform to the bald array reference rules'
                      '').format(t=tfile)]
         self.assertTrue((not validation.is_valid()) and exns == expected,
                          msg='{}  != {}'.format(exns, expected))
コード例 #18
0
ファイル: test_cdl.py プロジェクト: marqh/bald
def test_ereefs_gbr4_ncld(self):
    """Override ereefs test with currently accepted failures"""
    with self.temp_filename('.nc') as tfile:
        cdl_file = os.path.join(self.cdl_path, 'ereefs_gbr4_ncld.cdl')
        subprocess.check_call(['ncgen', '-o', tfile, cdl_file])
        validation = bald.validate_netcdf(tfile, cache=self.acache)
        exns = validation.exceptions()
        exns.sort()
        expected = ['http://qudt.org/vocab/unit#Meter is not resolving as a resource (404).',
                    'http://qudt.org/vocab/unit#MeterPerSecond is not resolving as a resource (404).',
                    'http://qudt.org/vocab/unit#MeterPerSecond is not resolving as a resource (404).',
                    'http://qudt.org/vocab/unit#DegreeCelsius is not resolving as a resource (404).']
        expected.sort()
        self.assertTrue(not validation.is_valid() and exns == expected,
                        msg='{} \n!= \n{}'.format(exns, expected))
コード例 #19
0
def test_ereefs_gbr4_ncld(self):
    """Override ereefs test with currently accepted failures"""
    with self.temp_filename('.nc') as tfile:
        cdl_file = os.path.join(self.cdl_path, 'ereefs_gbr4_ncld.cdl')
        subprocess.check_call(['ncgen', '-o', tfile, cdl_file])
        validation = bald.validate_netcdf(tfile)
        exns = validation.exceptions()
        exns.sort()
        expected = ['http://qudt.org/vocab/unit#Meter is not resolving as a resource (404).',
                    'http://qudt.org/vocab/unit#MeterPerSecond is not resolving as a resource (404).',
                    'http://qudt.org/vocab/unit#MeterPerSecond is not resolving as a resource (404).',
                    'http://qudt.org/vocab/unit#DegreeCelsius is not resolving as a resource (404).']
        expected.sort()
        self.assertTrue(not validation.is_valid() and exns == expected,
                        msg='{} \n!= \n{}'.format(exns, expected))
コード例 #20
0
ファイル: test_cdl.py プロジェクト: binary-array-ld/bald
 def atest(self):
     with self.temp_filename('.nc') as tfile:
         subprocess.check_call(['ncgen', '-o', tfile, cdlfile])
         validation = bald.validate_netcdf(tfile, cache=self.acache)
         exns = validation.exceptions()
         self.assertTrue(validation.is_valid(), msg='{} != []'.format(exns))