Provides download functions for FTP/SFTP, HTTP and local data sources.
Download data via SFTP
| Parameters: | download_path : str, optional
host : str
directory : str
port : int
username : str
password : str
filedate : dict
dirstruct : list of str
begin : datetime.datetime
end : datetime.datetime, optional
|
|---|---|
| Returns: | bool
|
Download data via HTTP
| Parameters: | download_path : str, optional
host : str
directory : str
filename : str
filedate : dict
dirstruct : list of str
begin : datetime.date
end : datetime.date, optional
|
|---|---|
| Returns: | bool
|
Download data via SFTP
| Parameters: | download_path : str, optional
host : str
directory : str
port : int
username : str
password : str
filedate : dict
dirstruct : list of str
begin : datetime.datetime
end : datetime.datetime, optional
|
|---|---|
| Returns: | bool
|
Bases: object
Base Class for data sources.
| Parameters: | name : str
filename : str
filedate : dict
temp_res : str
rootpath : str
host : str
protocol : str
username : str, optional
password : str, optional
port : int, optional
directory : str, optional
dirstruct : list of strings
begin_date : datetime, optional
variables : string or list of strings, optional
nan_value : int, float, optional
dest_nan_value : int, float, optional
dest_regions : list of str, optional
dest_sp_res : int, float, optional
dest_temp_res : string, optional
dest_start_date : datetime, optional
|
|---|
Attributes
| name | (str) Name of the data source. |
| filename | (str) Structure/convention of the file name. |
| filedate | (dict) Position of date fields in filename, given as tuple. |
| temp_res | (str) Temporal resolution of the source. |
| host | (str) Link to data host. |
| protocol | (str) Protocol for data transfer. |
| username | (str) Username for data access. |
| password | (str) Password for data access. |
| port | (int) Port to data host. |
| directory | (str) Path to data on host. |
| dirstruct | (list of strings) Structure of source directory, each list item represents a subdirectory. |
| begin_date | (datetime) Date from which on data is available. |
| variables | (list of strings) Variables used from data source. |
| nan_value | (int, float) N a number value of the original data as given by the data provider. |
| dest_nan_value | (int, float, optional) NaN value in the final NetCDF file. |
| tmp_path | (str) Path where temporary files are stored. |
| rawdata_path | (str) Path where original files are stored. |
| data_path | (str) Path where resampled NetCDF file is stored. |
| dest_regions | (list of str) Regions of interest where data is resampled to. |
| dest_sp_res | (int, float) Spatial resolution of the destination NetCDF file. |
| dest_temp_res | (string) Temporal resolution of the destination NetCDF file. |
Methods
“Download data
| Parameters: | begin : datetime, optional
end : datetime, optional
|
|---|
Downloads and resamples data.
| Parameters: | download_path : str
begin : datetime.date, optional
end : datetime.date, optional
delete_rawdata : bool, optional
shapefile : str, optional
|
|---|
Gets all variables from source given in the NetCDF file.
| Returns: | variables : list of str
|
|---|
Gets images from netCDF file for certain date
| Parameters: | date : datetime
region : str, optional
variable : str, optional
|
|---|---|
| Returns: | img : numpy.ndarray
lon : numpy.array
lat : numpy.array
|
Gets timeseries from netCDF file for a gridpoint.
| Parameters: | location : int or tuple of floats
region : str, optional
variable : str, optional
|
|---|---|
| Returns: | df : pd.DataFrame
|
Resamples source data to given spatial and temporal resolution.
Writes resampled images into a netCDF data file. Deletes original files if flag delete_rawdata is set True.
| Parameters: | begin : datetime
end : datetime
delete_rawdata : bool
shapefile : str, optional
|
|---|