Exemplo n.º 1
0
def load_test_data_file(filename):
    """helper function to open test file regardless of invocation"""

    try:
        return load(filename)
    except IOError:
        return load('tests/{}'.format(filename))
Exemplo n.º 2
0
def load_test_data_file(filename):
    """helper function to open test file regardless of invocation"""

    try:
        return load(filename)
    except IOError:
        return load('tests/{}'.format(filename))

allFiles = sorted(glob.glob(path + "*06*testwoudc.csv"))

# /home/poyraden/Analysis/Homogenization_Analysis/Files/Nilu/Sodankyl/version2/DQA/20050406_testwoudc.csv


list_data = []
list_udata = []
dfm = pd.DataFrame()
fi = 0

for filename in allFiles:
    print(filename)
    # try except is applied for the cases when there is formatting error: WOUDCExtCSVReaderError
    extcsv_to = load(filename)

    try:
        extcsv_to = load(filename)
        # access all tables
        tables = extcsv_to.sections.keys()
        ## first copy the profile data and delete this from the keys to save the metadata. For Praha data it is 'PORFILE',
        # watch out that this naming may change from station to station
        profile_keys = extcsv_to.sections['PROFILE'].keys()
        Profile = extcsv_to.sections['PROFILE']['_raw']
        del extcsv_to.sections['PROFILE']
        # profile_uncertainity = extcsv_to.sections['PROFILE_UNCERTAINTY']['_raw']
        # del extcsv_to.sections['PROFILE_UNCERTAINTY']

    except WOUDCExtCSVReaderError:
        print('error')
Exemplo n.º 4
0
    def test_load_file(self):
        """Test file loading"""

        with self.assertRaises(TypeError):
            load()
Exemplo n.º 5
0
    def test_load_file(self):
        """Test file loading"""

        with self.assertRaises(TypeError):
            load()
Exemplo n.º 6
0
2006-12-30,0,0,260,,,,,25,,05
2006-12-31,0,0,270,,,,,35,,04

*  MEAN  235  ::S=8 CLOUDY SKY/HAZE:XXX=OZONE                    1  2  153

#TIMESTAMP
UTCOffset,Date,Time
+00:00:00,2006-12-31,

#MONTHLY
Date,ColumnO3,StdDevO3,Npts
2006-12-01,235,21.4,23
'''

# load file into memory from local path
extcsv_to = load('../tests/data/20061201.brewer.mkiv.153.imd.csv')

# access all tables
# multiple occurance of tables are indexed as per order of occurance
tables = extcsv_to.sections.keys()
print('All tables:')
print(tables)
print('')
# get fields for a talbe
CONTENT = extcsv_to.sections['CONTENT'].keys()
print('CONTENT fields:')
print(CONTENT)
print('')
# get field value
CONTENT_Category = extcsv_to.sections['CONTENT']['Category']
print('CONTENT.Category value:')
Exemplo n.º 7
0
def load(filename):
    """stub to woudc_extcsv.load"""
    return woudc_extcsv.load(filename)
2006-12-30,0,0,260,,,,,25,,05
2006-12-31,0,0,270,,,,,35,,04

*  MEAN  235  ::S=8 CLOUDY SKY/HAZE:XXX=OZONE                    1  2  153

#TIMESTAMP
UTCOffset,Date,Time
+00:00:00,2006-12-31,

#MONTHLY
Date,ColumnO3,StdDevO3,Npts
2006-12-01,235,21.4,23
'''

# load file into memory from local path
extcsv_to = load('../tests/data/20061201.brewer.mkiv.153.imd.csv')

# access all tables
# multiple occurance of tables are indexed as per order of occurance
tables = extcsv_to.sections.keys()
print('All tables:')
print(tables)
print('')
# get fields for a talbe
CONTENT = extcsv_to.sections['CONTENT'].keys()
print('CONTENT fields:')
print(CONTENT)
print('')
# get field value
CONTENT_Category = extcsv_to.sections['CONTENT']['Category']
print('CONTENT.Category value:')
Exemplo n.º 9
0
def load(filename):
    """stub to woudc_extcsv.load"""
    return woudc_extcsv.load(filename)