fetch_meteo.py 1.35 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import os
import pandas as pd
import pycif.utils.check as check
from pycif.utils import path
from pycif.utils.netcdf import readnc


def fetch_meteo(meteo,
12
13
14
15
                datei,
                datef,
                workdir,
                **kwargs):
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
    """Fetch meteorology and links to the working directory

    Args:
        meteo (dictionary): dictionary defining the domain. Should include
        dirmeteo to be able to read the meteorology
        datei (datetime.datetime): initial date for the inversion window
        datef (datetime.datetime): end date for the inversion window
        workdir (str): path to the working directory where meteo files
                       should be copied
        logfile (str): path to the log file
        filetypes ([str]): list of file radicals to copy in the working
                           directory
        **kwargs (dictionary): extra arguments

    Return:
        None

    """
    
    check.verbose('Copying meteo files from ' + meteo.dirmeteo + ' to ' +
                  workdir + '/meteo/')
    
    # Create the sub-directory to store meteo files
    path.init_dir('{}/meteo/'.format(workdir))
40
    
41
42
43
    # Linking to file
    target = '{}/meteo/meteo.csv'.format(workdir)
    source = '{}/{}'.format(meteo.dirmeteo, meteo.ficmeteo)
44
        path.link(source, target)