loads.py 836 Bytes
Newer Older
BorjaEst's avatar
BorjaEst committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""
Module in charge of data loading.
"""
import logging

from o3skim import standardization
from o3skim import utils
import xarray as xr


logger = logging.getLogger('load')


def tco3(name, paths, coordinates, metadata={}):
    logger.debug("Loading tco3 data from: %s", paths)
    with xr.open_mfdataset(paths) as dataset:
        datarray = standardization.tco3(
            array=dataset[name],
            coord=coordinates)
        ds_attrs = dataset.attrs
    return datarray, ds_attrs, metadata


def vmro3(name, paths, coordinates, metadata={}):
    logger.debug("Loading vmro3 data from: %s", paths)
    with xr.open_mfdataset(paths) as dataset:
        datarray = standardization.vmro3(
            array=dataset[name],
            coord=coordinates)
        ds_attrs = dataset.attrs
    return datarray, ds_attrs, metadata