_skip_meta_check (bool, optional) – Should the check if the station is in the database meta file get skiped.
Pay attention, when skipping this, because it can lead to problems.
This is for computational reasons, because it makes the initialization faster.
Is used by the stations classes, because the only initialize objects that are in the meta table.
The default is False
Raises:
NotImplementedError – If the class is initiated with a station ID that is not in the database.
To prevent this error, set _skip_meta_check=True.
Public Methods:
__init__(id, **kwargs)
Create a Station object.
update_horizon([skip_if_exist])
Update the horizon angle (Horizontabschirmung) in the meta table.
update_richter_class([skip_if_exist])
Update the richter class in the meta table.
richter_correct([period])
Do the richter correction on the filled data for the given period.
Do the richter correction on the filled data for the given period.
Parameters:
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeseries.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
**kwargs (dict, optional) – Additional keyword arguments catch all, but unused here.
Raises:
Exception – If no richter class was found for this station.
_last_imp_period (weatherDB.utils.TimestampPeriod, optional) – Give the overall period of the last import.
This is only for intern use of the stationsN method to not compute over and over again the period.
The default is None.
**kwargs (dict, optional) – Additional keyword arguments passed to the richter_correct method.
update_if_fails (bool, optional) – Should the richter class get updatet if no exposition class is found in the meta table?
If False and no exposition class was found None is returned.
The default is True.
Count holes in timeseries depending on there length.
Parameters:
weeks (list, optional) – A list of hole length to count.
Every hole longer than the duration of weeks specified is counted.
The default is [2, 4, 8, 12, 16, 20, 24]
kind (str) – The kind of the timeserie to analyze.
Should be one of [‘raw’, ‘qc’, ‘filled’].
For N also “corr” is possible.
Normally only “raw” and “qc” make sense, because the other timeseries should not have holes.
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to analyze the timeseries.
If None is given, the maximum and minimal possible Timestamp is taken.
The default is (None, None).
between_meta_period (bool, optional) – Only check between the respective period that is defined in the meta table.
If “qc” is chosen as kind, then the “raw” meta period is taken.
The default is True.
crop_period (bool, optional) – should the period get cropped to the maximum filled period.
This will result in holes being ignored when they are at the end or at the beginning of the timeserie.
If period = (None, None) is given, then this parameter is set to True.
The default is False.
Returns:
A Pandas Dataframe, with station_id as index and one column per week.
The numbers in the table are the amount of NA-periods longer than the respective amount of weeks.
This function only returns the timeserie, but is not updating the database.
Parameters:
only_new (bool, optional) – Get only the files that are not yet in the database?
If False all the available files are loaded again.
The default is False.
Returns:
The Timeseries as a DataFrame with a Timestamp Index.
Fill up missing data with measurements from nearby stations.
Parameters:
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to gap fill the timeseries.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
**kwargs (dict, optional) – Additional arguments for the fillup function.
e.g. p_elev to consider the elevation to select nearest stations. (only for T and ET)
The timeserie get adjusted to match the multi-annual value over the given period.
So the yearly variability is kept and only the whole period is adjusted.
The basis for the adjusted timeseries is the filled data and not the richter corrected data,
as the ma values are also uncorrected vallues.
Returns:
The adjusted timeserie with the timestamp as index.
Get the regionalisation coefficients due to the height.
Those are the values from the dwd grid, HYRAS or REGNIE grids.
Parameters:
other_stid (int) – The Station Id of the other station from wich to regionalise for own station.
in_db_unit (bool, optional) – Should the coefficients be returned in the unit as stored in the database?
This is only relevant for the temperature.
The default is False.
Returns:
A list of coefficients.
For T, ET and N-daily only the the yearly coefficient is returned.
For N the winter and summer half yearly coefficient is returned in tuple.
None is returned if either the own or other stations multi-annual value is not available.
kinds (str or list of str) – The data kinds to update.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”, “filled_by”, “filled_share”.
For the precipitation also “qn” and “corr” are valid.
If “filled_by” is given together with an aggregation step, the “filled_by” is replaced by the “filled_share”.
The “filled_share” gives the share of filled values in the aggregation group in percent.
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeseries.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
agg_to (str or None, optional) – Aggregate to a given timespan.
If more than 20% of missing values in the aggregation group, the aggregated value will be None.
Can be anything smaller than the maximum timespan of the saved data.
If a Timeperiod smaller than the saved data is given, than the maximum possible timeperiod is returned.
For T and ET it can be “month”, “year”.
For N it can also be “hour”.
If None than the maximum timeperiod is taken.
The default is None.
nas_allowed (bool, optional) – Should NAs be allowed?
If True, then the maximum possible period is returned, even if there are NAs in the timeserie.
If False, then the minimal filled period is returned.
The default is True.
add_na_share (bool, optional) – Should one or several columns be added to the Dataframe with the share of NAs in the data.
This is especially important, when the stations data get aggregated, because the aggregation doesn’t make sense if there are a lot of NAs in the original data.
If True, one column per asked kind is added with the respective share of NAs, if the aggregation step is not the smallest.
The “kind”_na_share column is in percentage.
The default is False.
db_unit (bool, optional) – Should the result be in the Database unit.
If False the unit is getting converted to normal unit, like mm or °C.
The numbers are saved as integer in the database and got therefor multiplied by 10 or 100 to get to an integer.
The default is False.
sql_add_where (str or None, optional) – additional sql where statement to filter the output.
E.g. “EXTRACT(MONTH FROM timestamp) == 2”
The default is None
Get the timeserie with the infomation from which station the data got filled and the corresponding distance to this station.
Parameters:
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeserie.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
Returns:
The timeserie for this station and the given period with the station_id and the distance in meters from which the data got filled from.
Either only the timeserie is returned or also the id of the station from which the station data got filled, together with the distance to this station in m.
Parameters:
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeserie.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
with_dist (bool, optional) – Should the distance to the stations from which the timeseries got filled be added.
The default is False.
Returns:
The filled timeserie for this station and the given period.
Get the min and max Timestamp for which there is data in the corresponding timeserie.
Computes the period from the timeserie or meta table.
Parameters:
kind (str) – The data kind to look for filled period.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”.
If “best” is given, then depending on the parameter of the station the best kind is selected.
For Precipitation this is “corr” and for the other this is “filled”.
For the precipitation also “qn” and “corr” are valid.
from_meta (bool, optional) – Should the period be from the meta table?
If False: the period is returned from the timeserie. In this case this function is only a wrapper for .get_period_meta.
The default is False.
crs (str, int or None, optional) – The coordinate reference system of the geometry.
If None, then the geometry is returned in WGS84 (EPSG:4326).
If string, then it should be in a pyproj readable format.
If int, then it should be the EPSG code.
The default is None.
Returns:
The location of the station as shapely Point in the given coordinate reference system.
Get the geometry of the station as a shapely Point object.
Deprecated since version 1.0.0: get_geom_shp is deprecated and will be removed in future releases.
It is replaced by get_geom.
Parameters:
crs (str, int or None, optional) – If None, then the geometry is returned in WGS84 (EPSG:4326).
If string, then it should be one of “WGS84” or “UTM”.
If int, then it should be the EPSG code.
all (bool, optional) – Should the maximum Timespan for all the last imports be returned.
If False only the period for this station is returned.
The default is False.
Get the maximum available period for this stations timeseries.
If nas_allowed is True, then the maximum range of the timeserie is returned.
Else the minimal filled period is returned
Parameters:
kinds (str or list of str) – The data kinds to update.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”.
For the precipitation also “qn” and “corr” are valid.
nas_allowed (bool, optional) – Should NAs be allowed?
If True, then the maximum possible period is returned, even if there are NAs in the timeserie.
If False, then the minimal filled period is returned.
The default is False.
infos (list of str or str, optional) – A list of the information to get from the database.
If “all” then all the information are returned.
The default is “all”.
Returns:
dict with the meta information.
The first level has one entry per parameter.
The second level has one entry per information, asked for.
If only one information is asked for, then it is returned as single value and not as subdict.
Get the explanations of the available meta fields.
Parameters:
infos (list or string, optional) – The infos you wish to get an explanation for.
If “all” then all the available information get returned.
The default is “all”
Returns:
a pandas Series with the information names as index and the explanation as values.
Get the multi annual raster value(s) for this station.
Returns:
The corresponding multi annual value.
For T en ET the yearly value is returned.
For N the winter and summer half yearly sum is returned in tuple.
The returned unit is mm or °C.
The parameters (P_1, P_2) to weight the height differences between stations.
The elevation difference is considered with the formula from LARSIM (equation 3-18 & 3-19 from the LARSIM manual [1]_ ):
If None, then the height difference is not considered and only the nearest stations are returned.
The default is None.
period (TimestampPeriod or None, optional) – The period for which the nearest neighboors are returned.
The neighboor station needs to have raw data for at least one half of the period.
If None, then the availability of the data is not checked.
The default is None.
Returns:
A list of station Ids in order of distance.
The closest station is the first in the list.
Get a specific period from the meta information table.
This functions returns the information from the meta table.
In this table there are several periods saved, like the period of the last import.
Parameters:
kind (str) – The kind of period to return.
Should be one of [‘filled’, ‘raw’, ‘last_imp’].
filled: the maximum filled period of the filled timeserie.
raw: the maximum filled timeperiod of the raw data.
last_imp: the maximum filled timeperiod of the last import.
all (bool, optional) – Should the maximum Timespan for all the filled periods be returned.
If False only the period for this station is returned.
The default is False.
Returns:
The TimestampPeriod of the station or of all the stations if all=True.
kinds_num (list of str or str) – The timeseries kinds of the numerators.
Should be one of [‘raw’, ‘qc’, ‘filled’].
For precipitation also “corr” is possible.
The timeseries kinds of the denominator or the multi annual raster key.
If the denominator is a multi annual raster key, then the result is the quotient of the timeserie and the raster value.
Possible values are:
for timeserie kinds: ‘raw’, ‘qc’, ‘filled’ or for precipitation also “corr”.
for raster keys: ‘hyras’, ‘dwd’ or ‘regnie’, depending on your defined raster files.
return_as (str, optional) – The format of the return value.
If “df” then a pandas DataFrame is returned.
If “json” then a list with dictionaries is returned.
Returns:
The quotient of the two timeseries as DataFrame or list of dictionaries (JSON) depending on the return_as parameter.
The default is pd.DataFrame.
Get the zipfiles on the CDC server with the raw data.
Parameters:
only_new (bool, optional) – Get only the files that are not yet in the database?
If False all the available files are loaded again.
The default is True
ftp_file_list (list of (strings, datetime), optional) – A list of files on the FTP server together with their modification time.
If None, then the list is fetched from the server.
The default is None
Returns:
A DataFrame of zipfiles and the corresponding modification time on the CDC server to import.
Is the last import for the given kind already worked in?
Parameters:
kind (str) – The data kind to look for filled period.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”, “best”.
If “best” is given, then depending on the parameter of the station the best kind is selected.
For Precipitation this is “corr” and for the other this is “filled”.
For the precipitation also “qn” and “corr” are valid.
Returns:
True if the last import of the given kind is already treated.
Check if the station is a real station or only a virtual one.
Real means that the DWD is measuring here.
Virtual means, that there are no measurements here, but the station got created to have timeseries for every parameter for every precipitation station.
Returns:
true if the station is real, false if it is virtual.
Check if the station is a real station or only a virtual one.
Real means that the DWD is measuring here.
Virtual means, that there are no measurements here, but the station got created to have timeseries for every parameter for every precipitation station.
Returns:
true if the station is virtual, false if it is real.
_last_imp_period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to do the gap filling.
If None is given, the last import period is taken.
This is only for internal use, to speed up the process if run in a batch.
The default is None.
**kwargs (dict, optional) – Additional keyword arguments passed to the fillup function.
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeseries.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
kind (str, optional) – The data kind to plot.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”.
For the precipitation also “qn” and “corr” are valid.
The default is “filled.
agg_to (str or None, optional) – Aggregate to a given timespan.
Can be anything smaller than the maximum timespan of the saved data.
If a Timeperiod smaller than the saved data is given, than the maximum possible timeperiod is returned.
For T and ET it can be “month”, “year”.
For N it can also be “hour”.
If None than the maximum timeperiod is taken.
The default is None.
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeseries.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
**kwargs (dict, optional) – Additional keyword arguments catch all, but unused here.
Update the mean annual value from the station timeserie.
Parameters:
kind (str or list of str) – The timeseries data kind to update theire multi annual value.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”.
For the precipitation also “corr” is valid.
**kwargs (dict, optional) – Additional keyword arguments catch all, but unused here.
Compute teh filled period of a timeserie and save in the meta table.
Parameters:
kind (str) – The data kind to look for filled period.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”.
If “best” is given, then depending on the parameter of the station the best kind is selected.
For Precipitation this is “corr” and for the other this is “filled”.
For the precipitation also “corr” are valid.
**kwargs (dict, optional) – Additional keyword arguments catch all, but unused here.
only_new (bool, optional) – Get only the files that are not yet in the database?
If False all the available files are loaded again.
The default is True
ftp_file_list (list of (strings, datetime), optional) – A list of files on the FTP server together with their modification time.
If None, then the list is fetched from the server.
The default is None
remove_nas (bool, optional) – Remove the NAs from the downloaded data before updating it to the database.
This has computational advantages.
The default is True.
**kwargs (dict) – Additional keyword arguments catch all, but unused here.
_skip_meta_check (bool, optional) – Should the check if the station is in the database meta file get skiped.
Pay attention, when skipping this, because it can lead to problems.
This is for computational reasons, because it makes the initialization faster.
Is used by the stations classes, because the only initialize objects that are in the meta table.
The default is False
Raises:
NotImplementedError – If the class is initiated with a station ID that is not in the database.
To prevent this error, set _skip_meta_check=True.
Public Methods:
__init__(id, **kwargs)
Create a Station object.
get_multi_annual_raster()
Get the multi annual raster value(s) for this station.
get_adj(**kwargs)
Get the adjusted timeserie.
get_quotient(**kwargs)
Get the quotient of multi-annual means of two different kinds or the timeserie and the multi annual raster value.
Get the multi annual raster value(s) for this station.
Returns:
The corresponding multi annual value.
For T en ET the yearly value is returned.
For N the winter and summer half yearly sum is returned in tuple.
The returned unit is mm or °C.
The timeserie get adjusted to match the multi-annual value over the given period.
So the yearly variability is kept and only the whole period is adjusted.
Returns:
The adjusted timeserie with the timestamp as index.
kinds_num (list of str or str) – The timeseries kinds of the numerators.
Should be one of [‘raw’, ‘qc’, ‘filled’].
For precipitation also “corr” is possible.
The timeseries kinds of the denominator or the multi annual raster key.
If the denominator is a multi annual raster key, then the result is the quotient of the timeserie and the raster value.
Possible values are:
for timeserie kinds: ‘raw’, ‘qc’, ‘filled’ or for precipitation also “corr”.
for raster keys: ‘hyras’, ‘dwd’ or ‘regnie’, depending on your defined raster files.
return_as (str, optional) – The format of the return value.
If “df” then a pandas DataFrame is returned.
If “json” then a list with dictionaries is returned.
Returns:
The quotient of the two timeseries as DataFrame or list of dictionaries (JSON) depending on the return_as parameter.
The default is pd.DataFrame.
Count holes in timeseries depending on there length.
Parameters:
weeks (list, optional) – A list of hole length to count.
Every hole longer than the duration of weeks specified is counted.
The default is [2, 4, 8, 12, 16, 20, 24]
kind (str) – The kind of the timeserie to analyze.
Should be one of [‘raw’, ‘qc’, ‘filled’].
For N also “corr” is possible.
Normally only “raw” and “qc” make sense, because the other timeseries should not have holes.
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to analyze the timeseries.
If None is given, the maximum and minimal possible Timestamp is taken.
The default is (None, None).
between_meta_period (bool, optional) – Only check between the respective period that is defined in the meta table.
If “qc” is chosen as kind, then the “raw” meta period is taken.
The default is True.
crop_period (bool, optional) – should the period get cropped to the maximum filled period.
This will result in holes being ignored when they are at the end or at the beginning of the timeserie.
If period = (None, None) is given, then this parameter is set to True.
The default is False.
Returns:
A Pandas Dataframe, with station_id as index and one column per week.
The numbers in the table are the amount of NA-periods longer than the respective amount of weeks.
This function only returns the timeserie, but is not updating the database.
Parameters:
only_new (bool, optional) – Get only the files that are not yet in the database?
If False all the available files are loaded again.
The default is False.
Returns:
The Timeseries as a DataFrame with a Timestamp Index.
Get the regionalisation coefficients due to the height.
Those are the values from the dwd grid, HYRAS or REGNIE grids.
Parameters:
other_stid (int) – The Station Id of the other station from wich to regionalise for own station.
in_db_unit (bool, optional) – Should the coefficients be returned in the unit as stored in the database?
This is only relevant for the temperature.
The default is False.
Returns:
A list of coefficients.
For T, ET and N-daily only the the yearly coefficient is returned.
For N the winter and summer half yearly coefficient is returned in tuple.
None is returned if either the own or other stations multi-annual value is not available.
kinds (str or list of str) – The data kinds to update.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”, “filled_by”, “filled_share”.
For the precipitation also “qn” and “corr” are valid.
If “filled_by” is given together with an aggregation step, the “filled_by” is replaced by the “filled_share”.
The “filled_share” gives the share of filled values in the aggregation group in percent.
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeseries.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
agg_to (str or None, optional) – Aggregate to a given timespan.
If more than 20% of missing values in the aggregation group, the aggregated value will be None.
Can be anything smaller than the maximum timespan of the saved data.
If a Timeperiod smaller than the saved data is given, than the maximum possible timeperiod is returned.
For T and ET it can be “month”, “year”.
For N it can also be “hour”.
If None than the maximum timeperiod is taken.
The default is None.
nas_allowed (bool, optional) – Should NAs be allowed?
If True, then the maximum possible period is returned, even if there are NAs in the timeserie.
If False, then the minimal filled period is returned.
The default is True.
add_na_share (bool, optional) – Should one or several columns be added to the Dataframe with the share of NAs in the data.
This is especially important, when the stations data get aggregated, because the aggregation doesn’t make sense if there are a lot of NAs in the original data.
If True, one column per asked kind is added with the respective share of NAs, if the aggregation step is not the smallest.
The “kind”_na_share column is in percentage.
The default is False.
db_unit (bool, optional) – Should the result be in the Database unit.
If False the unit is getting converted to normal unit, like mm or °C.
The numbers are saved as integer in the database and got therefor multiplied by 10 or 100 to get to an integer.
The default is False.
sql_add_where (str or None, optional) – additional sql where statement to filter the output.
E.g. “EXTRACT(MONTH FROM timestamp) == 2”
The default is None
Get the timeserie with the infomation from which station the data got filled and the corresponding distance to this station.
Parameters:
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeserie.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
Returns:
The timeserie for this station and the given period with the station_id and the distance in meters from which the data got filled from.
Either only the timeserie is returned or also the id of the station from which the station data got filled, together with the distance to this station in m.
Parameters:
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeserie.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
with_dist (bool, optional) – Should the distance to the stations from which the timeseries got filled be added.
The default is False.
Returns:
The filled timeserie for this station and the given period.
Get the min and max Timestamp for which there is data in the corresponding timeserie.
Computes the period from the timeserie or meta table.
Parameters:
kind (str) – The data kind to look for filled period.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”.
If “best” is given, then depending on the parameter of the station the best kind is selected.
For Precipitation this is “corr” and for the other this is “filled”.
For the precipitation also “qn” and “corr” are valid.
from_meta (bool, optional) – Should the period be from the meta table?
If False: the period is returned from the timeserie. In this case this function is only a wrapper for .get_period_meta.
The default is False.
crs (str, int or None, optional) – The coordinate reference system of the geometry.
If None, then the geometry is returned in WGS84 (EPSG:4326).
If string, then it should be in a pyproj readable format.
If int, then it should be the EPSG code.
The default is None.
Returns:
The location of the station as shapely Point in the given coordinate reference system.
Get the geometry of the station as a shapely Point object.
Deprecated since version 1.0.0: get_geom_shp is deprecated and will be removed in future releases.
It is replaced by get_geom.
Parameters:
crs (str, int or None, optional) – If None, then the geometry is returned in WGS84 (EPSG:4326).
If string, then it should be one of “WGS84” or “UTM”.
If int, then it should be the EPSG code.
all (bool, optional) – Should the maximum Timespan for all the last imports be returned.
If False only the period for this station is returned.
The default is False.
Get the maximum available period for this stations timeseries.
If nas_allowed is True, then the maximum range of the timeserie is returned.
Else the minimal filled period is returned
Parameters:
kinds (str or list of str) – The data kinds to update.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”.
For the precipitation also “qn” and “corr” are valid.
nas_allowed (bool, optional) – Should NAs be allowed?
If True, then the maximum possible period is returned, even if there are NAs in the timeserie.
If False, then the minimal filled period is returned.
The default is False.
infos (list of str or str, optional) – A list of the information to get from the database.
If “all” then all the information are returned.
The default is “all”.
Returns:
dict with the meta information.
The first level has one entry per parameter.
The second level has one entry per information, asked for.
If only one information is asked for, then it is returned as single value and not as subdict.
Get the explanations of the available meta fields.
Parameters:
infos (list or string, optional) – The infos you wish to get an explanation for.
If “all” then all the available information get returned.
The default is “all”
Returns:
a pandas Series with the information names as index and the explanation as values.
In Larsim those parameters are defined as $P_1 = 500$ and $P_2 = 1$.
Stoelzle et al. (2016) found that $P_1 = 100$ and $P_2 = 4$ is better for Baden-Würtemberg to consider the quick changes in topographie.
For all of germany, those parameter values are giving too much weight to the elevation difference, which can result in getting neighboor stations from the border of the Tschec Republic for the Feldberg station. Therefor the values $P_1 = 250$ and $P_2 = 1.5$ are used as default values.
literature:
Stoelzle, Michael & Weiler, Markus & Steinbrich, Andreas. (2016) Starkregengefährdung in Baden-Württemberg – von der Methodenentwicklung zur Starkregenkartierung. Tag der Hydrologie.
Get a specific period from the meta information table.
This functions returns the information from the meta table.
In this table there are several periods saved, like the period of the last import.
Parameters:
kind (str) – The kind of period to return.
Should be one of [‘filled’, ‘raw’, ‘last_imp’].
filled: the maximum filled period of the filled timeserie.
raw: the maximum filled timeperiod of the raw data.
last_imp: the maximum filled timeperiod of the last import.
all (bool, optional) – Should the maximum Timespan for all the filled periods be returned.
If False only the period for this station is returned.
The default is False.
Returns:
The TimestampPeriod of the station or of all the stations if all=True.
Get the zipfiles on the CDC server with the raw data.
Parameters:
only_new (bool, optional) – Get only the files that are not yet in the database?
If False all the available files are loaded again.
The default is True
ftp_file_list (list of (strings, datetime), optional) – A list of files on the FTP server together with their modification time.
If None, then the list is fetched from the server.
The default is None
Returns:
A DataFrame of zipfiles and the corresponding modification time on the CDC server to import.
Is the last import for the given kind already worked in?
Parameters:
kind (str) – The data kind to look for filled period.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”, “best”.
If “best” is given, then depending on the parameter of the station the best kind is selected.
For Precipitation this is “corr” and for the other this is “filled”.
For the precipitation also “qn” and “corr” are valid.
Returns:
True if the last import of the given kind is already treated.
Check if the station is a real station or only a virtual one.
Real means that the DWD is measuring here.
Virtual means, that there are no measurements here, but the station got created to have timeseries for every parameter for every precipitation station.
Returns:
true if the station is real, false if it is virtual.
Check if the station is a real station or only a virtual one.
Real means that the DWD is measuring here.
Virtual means, that there are no measurements here, but the station got created to have timeseries for every parameter for every precipitation station.
Returns:
true if the station is virtual, false if it is real.
_last_imp_period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to do the gap filling.
If None is given, the last import period is taken.
This is only for internal use, to speed up the process if run in a batch.
The default is None.
**kwargs (dict, optional) – Additional keyword arguments passed to the fillup function.
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeseries.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
kind (str, optional) – The data kind to plot.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”.
For the precipitation also “qn” and “corr” are valid.
The default is “filled.
agg_to (str or None, optional) – Aggregate to a given timespan.
Can be anything smaller than the maximum timespan of the saved data.
If a Timeperiod smaller than the saved data is given, than the maximum possible timeperiod is returned.
For T and ET it can be “month”, “year”.
For N it can also be “hour”.
If None than the maximum timeperiod is taken.
The default is None.
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeseries.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
**kwargs (dict, optional) – Additional keyword arguments catch all, but unused here.
Update the mean annual value from the station timeserie.
Parameters:
kind (str or list of str) – The timeseries data kind to update theire multi annual value.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”.
For the precipitation also “corr” is valid.
**kwargs (dict, optional) – Additional keyword arguments catch all, but unused here.
Compute teh filled period of a timeserie and save in the meta table.
Parameters:
kind (str) – The data kind to look for filled period.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”.
If “best” is given, then depending on the parameter of the station the best kind is selected.
For Precipitation this is “corr” and for the other this is “filled”.
For the precipitation also “corr” are valid.
**kwargs (dict, optional) – Additional keyword arguments catch all, but unused here.
only_new (bool, optional) – Get only the files that are not yet in the database?
If False all the available files are loaded again.
The default is True
ftp_file_list (list of (strings, datetime), optional) – A list of files on the FTP server together with their modification time.
If None, then the list is fetched from the server.
The default is None
remove_nas (bool, optional) – Remove the NAs from the downloaded data before updating it to the database.
This has computational advantages.
The default is True.
**kwargs (dict) – Additional keyword arguments catch all, but unused here.
_skip_meta_check (bool, optional) – Should the check if the station is in the database meta file get skiped.
Pay attention, when skipping this, because it can lead to problems.
This is for computational reasons, because it makes the initialization faster.
Is used by the stations classes, because the only initialize objects that are in the meta table.
The default is False
Raises:
NotImplementedError – If the class is initiated with a station ID that is not in the database.
To prevent this error, set _skip_meta_check=True.
The timeserie get adjusted to match the multi-annual value over the given period.
So the yearly variability is kept and only the whole period is adjusted.
Returns:
The adjusted timeserie with the timestamp as index.
Count holes in timeseries depending on there length.
Parameters:
weeks (list, optional) – A list of hole length to count.
Every hole longer than the duration of weeks specified is counted.
The default is [2, 4, 8, 12, 16, 20, 24]
kind (str) – The kind of the timeserie to analyze.
Should be one of [‘raw’, ‘qc’, ‘filled’].
For N also “corr” is possible.
Normally only “raw” and “qc” make sense, because the other timeseries should not have holes.
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to analyze the timeseries.
If None is given, the maximum and minimal possible Timestamp is taken.
The default is (None, None).
between_meta_period (bool, optional) – Only check between the respective period that is defined in the meta table.
If “qc” is chosen as kind, then the “raw” meta period is taken.
The default is True.
crop_period (bool, optional) – should the period get cropped to the maximum filled period.
This will result in holes being ignored when they are at the end or at the beginning of the timeserie.
If period = (None, None) is given, then this parameter is set to True.
The default is False.
Returns:
A Pandas Dataframe, with station_id as index and one column per week.
The numbers in the table are the amount of NA-periods longer than the respective amount of weeks.
This function only returns the timeserie, but is not updating the database.
Parameters:
only_new (bool, optional) – Get only the files that are not yet in the database?
If False all the available files are loaded again.
The default is False.
Returns:
The Timeseries as a DataFrame with a Timestamp Index.
Get the regionalisation coefficients due to the height.
Those are the values from the dwd grid, HYRAS or REGNIE grids.
Parameters:
other_stid (int) – The Station Id of the other station from wich to regionalise for own station.
in_db_unit (bool, optional) – Should the coefficients be returned in the unit as stored in the database?
This is only relevant for the temperature.
The default is False.
Returns:
A list of coefficients.
For T, ET and N-daily only the the yearly coefficient is returned.
For N the winter and summer half yearly coefficient is returned in tuple.
None is returned if either the own or other stations multi-annual value is not available.
kinds (str or list of str) – The data kinds to update.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”, “filled_by”, “filled_share”.
For the precipitation also “qn” and “corr” are valid.
If “filled_by” is given together with an aggregation step, the “filled_by” is replaced by the “filled_share”.
The “filled_share” gives the share of filled values in the aggregation group in percent.
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeseries.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
agg_to (str or None, optional) – Aggregate to a given timespan.
If more than 20% of missing values in the aggregation group, the aggregated value will be None.
Can be anything smaller than the maximum timespan of the saved data.
If a Timeperiod smaller than the saved data is given, than the maximum possible timeperiod is returned.
For T and ET it can be “month”, “year”.
For N it can also be “hour”.
If None than the maximum timeperiod is taken.
The default is None.
nas_allowed (bool, optional) – Should NAs be allowed?
If True, then the maximum possible period is returned, even if there are NAs in the timeserie.
If False, then the minimal filled period is returned.
The default is True.
add_na_share (bool, optional) – Should one or several columns be added to the Dataframe with the share of NAs in the data.
This is especially important, when the stations data get aggregated, because the aggregation doesn’t make sense if there are a lot of NAs in the original data.
If True, one column per asked kind is added with the respective share of NAs, if the aggregation step is not the smallest.
The “kind”_na_share column is in percentage.
The default is False.
db_unit (bool, optional) – Should the result be in the Database unit.
If False the unit is getting converted to normal unit, like mm or °C.
The numbers are saved as integer in the database and got therefor multiplied by 10 or 100 to get to an integer.
The default is False.
sql_add_where (str or None, optional) – additional sql where statement to filter the output.
E.g. “EXTRACT(MONTH FROM timestamp) == 2”
The default is None
Get the timeserie with the infomation from which station the data got filled and the corresponding distance to this station.
Parameters:
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeserie.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
Returns:
The timeserie for this station and the given period with the station_id and the distance in meters from which the data got filled from.
Either only the timeserie is returned or also the id of the station from which the station data got filled, together with the distance to this station in m.
Parameters:
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeserie.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
with_dist (bool, optional) – Should the distance to the stations from which the timeseries got filled be added.
The default is False.
Returns:
The filled timeserie for this station and the given period.
Get the min and max Timestamp for which there is data in the corresponding timeserie.
Computes the period from the timeserie or meta table.
Parameters:
kind (str) – The data kind to look for filled period.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”.
If “best” is given, then depending on the parameter of the station the best kind is selected.
For Precipitation this is “corr” and for the other this is “filled”.
For the precipitation also “qn” and “corr” are valid.
from_meta (bool, optional) – Should the period be from the meta table?
If False: the period is returned from the timeserie. In this case this function is only a wrapper for .get_period_meta.
The default is False.
crs (str, int or None, optional) – The coordinate reference system of the geometry.
If None, then the geometry is returned in WGS84 (EPSG:4326).
If string, then it should be in a pyproj readable format.
If int, then it should be the EPSG code.
The default is None.
Returns:
The location of the station as shapely Point in the given coordinate reference system.
Get the geometry of the station as a shapely Point object.
Deprecated since version 1.0.0: get_geom_shp is deprecated and will be removed in future releases.
It is replaced by get_geom.
Parameters:
crs (str, int or None, optional) – If None, then the geometry is returned in WGS84 (EPSG:4326).
If string, then it should be one of “WGS84” or “UTM”.
If int, then it should be the EPSG code.
all (bool, optional) – Should the maximum Timespan for all the last imports be returned.
If False only the period for this station is returned.
The default is False.
Get the maximum available period for this stations timeseries.
If nas_allowed is True, then the maximum range of the timeserie is returned.
Else the minimal filled period is returned
Parameters:
kinds (str or list of str) – The data kinds to update.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”.
For the precipitation also “qn” and “corr” are valid.
nas_allowed (bool, optional) – Should NAs be allowed?
If True, then the maximum possible period is returned, even if there are NAs in the timeserie.
If False, then the minimal filled period is returned.
The default is False.
infos (list of str or str, optional) – A list of the information to get from the database.
If “all” then all the information are returned.
The default is “all”.
Returns:
dict with the meta information.
The first level has one entry per parameter.
The second level has one entry per information, asked for.
If only one information is asked for, then it is returned as single value and not as subdict.
Get the explanations of the available meta fields.
Parameters:
infos (list or string, optional) – The infos you wish to get an explanation for.
If “all” then all the available information get returned.
The default is “all”
Returns:
a pandas Series with the information names as index and the explanation as values.
Get the multi annual raster value(s) for this station.
Returns:
The corresponding multi annual value.
For T en ET the yearly value is returned.
For N the winter and summer half yearly sum is returned in tuple.
The returned unit is mm or °C.
In Larsim those parameters are defined as $P_1 = 500$ and $P_2 = 1$.
Stoelzle et al. (2016) found that $P_1 = 100$ and $P_2 = 4$ is better for Baden-Würtemberg to consider the quick changes in topographie.
For all of germany, those parameter values are giving too much weight to the elevation difference, which can result in getting neighboor stations from the border of the Tschec Republic for the Feldberg station. Therefor the values $P_1 = 250$ and $P_2 = 1.5$ are used as default values.
literature:
Stoelzle, Michael & Weiler, Markus & Steinbrich, Andreas. (2016) Starkregengefährdung in Baden-Württemberg – von der Methodenentwicklung zur Starkregenkartierung. Tag der Hydrologie.
Get a specific period from the meta information table.
This functions returns the information from the meta table.
In this table there are several periods saved, like the period of the last import.
Parameters:
kind (str) – The kind of period to return.
Should be one of [‘filled’, ‘raw’, ‘last_imp’].
filled: the maximum filled period of the filled timeserie.
raw: the maximum filled timeperiod of the raw data.
last_imp: the maximum filled timeperiod of the last import.
all (bool, optional) – Should the maximum Timespan for all the filled periods be returned.
If False only the period for this station is returned.
The default is False.
Returns:
The TimestampPeriod of the station or of all the stations if all=True.
kinds_num (list of str or str) – The timeseries kinds of the numerators.
Should be one of [‘raw’, ‘qc’, ‘filled’].
For precipitation also “corr” is possible.
The timeseries kinds of the denominator or the multi annual raster key.
If the denominator is a multi annual raster key, then the result is the quotient of the timeserie and the raster value.
Possible values are:
for timeserie kinds: ‘raw’, ‘qc’, ‘filled’ or for precipitation also “corr”.
for raster keys: ‘hyras’, ‘dwd’ or ‘regnie’, depending on your defined raster files.
return_as (str, optional) – The format of the return value.
If “df” then a pandas DataFrame is returned.
If “json” then a list with dictionaries is returned.
Returns:
The quotient of the two timeseries as DataFrame or list of dictionaries (JSON) depending on the return_as parameter.
The default is pd.DataFrame.
Get the zipfiles on the CDC server with the raw data.
Parameters:
only_new (bool, optional) – Get only the files that are not yet in the database?
If False all the available files are loaded again.
The default is True
ftp_file_list (list of (strings, datetime), optional) – A list of files on the FTP server together with their modification time.
If None, then the list is fetched from the server.
The default is None
Returns:
A DataFrame of zipfiles and the corresponding modification time on the CDC server to import.
Is the last import for the given kind already worked in?
Parameters:
kind (str) – The data kind to look for filled period.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”, “best”.
If “best” is given, then depending on the parameter of the station the best kind is selected.
For Precipitation this is “corr” and for the other this is “filled”.
For the precipitation also “qn” and “corr” are valid.
Returns:
True if the last import of the given kind is already treated.
Check if the station is a real station or only a virtual one.
Real means that the DWD is measuring here.
Virtual means, that there are no measurements here, but the station got created to have timeseries for every parameter for every precipitation station.
Returns:
true if the station is real, false if it is virtual.
Check if the station is a real station or only a virtual one.
Real means that the DWD is measuring here.
Virtual means, that there are no measurements here, but the station got created to have timeseries for every parameter for every precipitation station.
Returns:
true if the station is virtual, false if it is real.
_last_imp_period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to do the gap filling.
If None is given, the last import period is taken.
This is only for internal use, to speed up the process if run in a batch.
The default is None.
**kwargs (dict, optional) – Additional keyword arguments passed to the fillup function.
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeseries.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
kind (str, optional) – The data kind to plot.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”.
For the precipitation also “qn” and “corr” are valid.
The default is “filled.
agg_to (str or None, optional) – Aggregate to a given timespan.
Can be anything smaller than the maximum timespan of the saved data.
If a Timeperiod smaller than the saved data is given, than the maximum possible timeperiod is returned.
For T and ET it can be “month”, “year”.
For N it can also be “hour”.
If None than the maximum timeperiod is taken.
The default is None.
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeseries.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
**kwargs (dict, optional) – Additional keyword arguments catch all, but unused here.
Update the mean annual value from the station timeserie.
Parameters:
kind (str or list of str) – The timeseries data kind to update theire multi annual value.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”.
For the precipitation also “corr” is valid.
**kwargs (dict, optional) – Additional keyword arguments catch all, but unused here.
Compute teh filled period of a timeserie and save in the meta table.
Parameters:
kind (str) – The data kind to look for filled period.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”.
If “best” is given, then depending on the parameter of the station the best kind is selected.
For Precipitation this is “corr” and for the other this is “filled”.
For the precipitation also “corr” are valid.
**kwargs (dict, optional) – Additional keyword arguments catch all, but unused here.
only_new (bool, optional) – Get only the files that are not yet in the database?
If False all the available files are loaded again.
The default is True
ftp_file_list (list of (strings, datetime), optional) – A list of files on the FTP server together with their modification time.
If None, then the list is fetched from the server.
The default is None
remove_nas (bool, optional) – Remove the NAs from the downloaded data before updating it to the database.
This has computational advantages.
The default is True.
**kwargs (dict) – Additional keyword arguments catch all, but unused here.
alias of <module ‘weatherDB.station.GroupStation’ from ‘/home/docs/checkouts/readthedocs.org/user_builds/weatherdb/checkouts/stable/weatherDB/station/GroupStation.py’>
Those are the base station classes on which the real station classes above depend on.
None of them is working on its own, because the class variables are not yet set correctly.
_skip_meta_check (bool, optional) – Should the check if the station is in the database meta file get skiped.
Pay attention, when skipping this, because it can lead to problems.
This is for computational reasons, because it makes the initialization faster.
Is used by the stations classes, because the only initialize objects that are in the meta table.
The default is False
Raises:
NotImplementedError – If the class is initiated with a station ID that is not in the database.
To prevent this error, set _skip_meta_check=True.
Check if the station is a real station or only a virtual one.
Real means that the DWD is measuring here.
Virtual means, that there are no measurements here, but the station got created to have timeseries for every parameter for every precipitation station.
Returns:
true if the station is virtual, false if it is real.
Check if the station is a real station or only a virtual one.
Real means that the DWD is measuring here.
Virtual means, that there are no measurements here, but the station got created to have timeseries for every parameter for every precipitation station.
Returns:
true if the station is real, false if it is virtual.
Is the last import for the given kind already worked in?
Parameters:
kind (str) – The data kind to look for filled period.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”, “best”.
If “best” is given, then depending on the parameter of the station the best kind is selected.
For Precipitation this is “corr” and for the other this is “filled”.
For the precipitation also “qn” and “corr” are valid.
Returns:
True if the last import of the given kind is already treated.
Compute teh filled period of a timeserie and save in the meta table.
Parameters:
kind (str) – The data kind to look for filled period.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”.
If “best” is given, then depending on the parameter of the station the best kind is selected.
For Precipitation this is “corr” and for the other this is “filled”.
For the precipitation also “corr” are valid.
**kwargs (dict, optional) – Additional keyword arguments catch all, but unused here.
Update the mean annual value from the station timeserie.
Parameters:
kind (str or list of str) – The timeseries data kind to update theire multi annual value.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”.
For the precipitation also “corr” is valid.
**kwargs (dict, optional) – Additional keyword arguments catch all, but unused here.
only_new (bool, optional) – Get only the files that are not yet in the database?
If False all the available files are loaded again.
The default is True
ftp_file_list (list of (strings, datetime), optional) – A list of files on the FTP server together with their modification time.
If None, then the list is fetched from the server.
The default is None
remove_nas (bool, optional) – Remove the NAs from the downloaded data before updating it to the database.
This has computational advantages.
The default is True.
**kwargs (dict) – Additional keyword arguments catch all, but unused here.
Get the zipfiles on the CDC server with the raw data.
Parameters:
only_new (bool, optional) – Get only the files that are not yet in the database?
If False all the available files are loaded again.
The default is True
ftp_file_list (list of (strings, datetime), optional) – A list of files on the FTP server together with their modification time.
If None, then the list is fetched from the server.
The default is None
Returns:
A DataFrame of zipfiles and the corresponding modification time on the CDC server to import.
This function only returns the timeserie, but is not updating the database.
Parameters:
only_new (bool, optional) – Get only the files that are not yet in the database?
If False all the available files are loaded again.
The default is False.
Returns:
The Timeseries as a DataFrame with a Timestamp Index.
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeseries.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
**kwargs (dict, optional) – Additional keyword arguments catch all, but unused here.
Fill up missing data with measurements from nearby stations.
Parameters:
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to gap fill the timeseries.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
**kwargs (dict, optional) – Additional arguments for the fillup function.
e.g. p_elev to consider the elevation to select nearest stations. (only for T and ET)
_last_imp_period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to do the gap filling.
If None is given, the last import period is taken.
This is only for internal use, to speed up the process if run in a batch.
The default is None.
**kwargs (dict, optional) – Additional keyword arguments passed to the fillup function.
Get the explanations of the available meta fields.
Parameters:
infos (list or string, optional) – The infos you wish to get an explanation for.
If “all” then all the available information get returned.
The default is “all”
Returns:
a pandas Series with the information names as index and the explanation as values.
infos (list of str or str, optional) – A list of the information to get from the database.
If “all” then all the information are returned.
The default is “all”.
Returns:
dict with the meta information.
The first level has one entry per parameter.
The second level has one entry per information, asked for.
If only one information is asked for, then it is returned as single value and not as subdict.
crs (str, int or None, optional) – The coordinate reference system of the geometry.
If None, then the geometry is returned in WGS84 (EPSG:4326).
If string, then it should be in a pyproj readable format.
If int, then it should be the EPSG code.
The default is None.
Returns:
The location of the station as shapely Point in the given coordinate reference system.
Get the geometry of the station as a shapely Point object.
Deprecated since version 1.0.0: get_geom_shp is deprecated and will be removed in future releases.
It is replaced by get_geom.
Parameters:
crs (str, int or None, optional) – If None, then the geometry is returned in WGS84 (EPSG:4326).
If string, then it should be one of “WGS84” or “UTM”.
If int, then it should be the EPSG code.
kinds_num (list of str or str) – The timeseries kinds of the numerators.
Should be one of [‘raw’, ‘qc’, ‘filled’].
For precipitation also “corr” is possible.
The timeseries kinds of the denominator or the multi annual raster key.
If the denominator is a multi annual raster key, then the result is the quotient of the timeserie and the raster value.
Possible values are:
for timeserie kinds: ‘raw’, ‘qc’, ‘filled’ or for precipitation also “corr”.
for raster keys: ‘hyras’, ‘dwd’ or ‘regnie’, depending on your defined raster files.
return_as (str, optional) – The format of the return value.
If “df” then a pandas DataFrame is returned.
If “json” then a list with dictionaries is returned.
Returns:
The quotient of the two timeseries as DataFrame or list of dictionaries (JSON) depending on the return_as parameter.
The default is pd.DataFrame.
Count holes in timeseries depending on there length.
Parameters:
weeks (list, optional) – A list of hole length to count.
Every hole longer than the duration of weeks specified is counted.
The default is [2, 4, 8, 12, 16, 20, 24]
kind (str) – The kind of the timeserie to analyze.
Should be one of [‘raw’, ‘qc’, ‘filled’].
For N also “corr” is possible.
Normally only “raw” and “qc” make sense, because the other timeseries should not have holes.
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to analyze the timeseries.
If None is given, the maximum and minimal possible Timestamp is taken.
The default is (None, None).
between_meta_period (bool, optional) – Only check between the respective period that is defined in the meta table.
If “qc” is chosen as kind, then the “raw” meta period is taken.
The default is True.
crop_period (bool, optional) – should the period get cropped to the maximum filled period.
This will result in holes being ignored when they are at the end or at the beginning of the timeserie.
If period = (None, None) is given, then this parameter is set to True.
The default is False.
Returns:
A Pandas Dataframe, with station_id as index and one column per week.
The numbers in the table are the amount of NA-periods longer than the respective amount of weeks.
Get a specific period from the meta information table.
This functions returns the information from the meta table.
In this table there are several periods saved, like the period of the last import.
Parameters:
kind (str) – The kind of period to return.
Should be one of [‘filled’, ‘raw’, ‘last_imp’].
filled: the maximum filled period of the filled timeserie.
raw: the maximum filled timeperiod of the raw data.
last_imp: the maximum filled timeperiod of the last import.
all (bool, optional) – Should the maximum Timespan for all the filled periods be returned.
If False only the period for this station is returned.
The default is False.
Returns:
The TimestampPeriod of the station or of all the stations if all=True.
Get the min and max Timestamp for which there is data in the corresponding timeserie.
Computes the period from the timeserie or meta table.
Parameters:
kind (str) – The data kind to look for filled period.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”.
If “best” is given, then depending on the parameter of the station the best kind is selected.
For Precipitation this is “corr” and for the other this is “filled”.
For the precipitation also “qn” and “corr” are valid.
from_meta (bool, optional) – Should the period be from the meta table?
If False: the period is returned from the timeserie. In this case this function is only a wrapper for .get_period_meta.
The default is False.
Get the maximum available period for this stations timeseries.
If nas_allowed is True, then the maximum range of the timeserie is returned.
Else the minimal filled period is returned
Parameters:
kinds (str or list of str) – The data kinds to update.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”.
For the precipitation also “qn” and “corr” are valid.
nas_allowed (bool, optional) – Should NAs be allowed?
If True, then the maximum possible period is returned, even if there are NAs in the timeserie.
If False, then the minimal filled period is returned.
The default is False.
all (bool, optional) – Should the maximum Timespan for all the last imports be returned.
If False only the period for this station is returned.
The default is False.
The parameters (P_1, P_2) to weight the height differences between stations.
The elevation difference is considered with the formula from LARSIM (equation 3-18 & 3-19 from the LARSIM manual [1]_ ):
If None, then the height difference is not considered and only the nearest stations are returned.
The default is None.
period (TimestampPeriod or None, optional) – The period for which the nearest neighboors are returned.
The neighboor station needs to have raw data for at least one half of the period.
If None, then the availability of the data is not checked.
The default is None.
Returns:
A list of station Ids in order of distance.
The closest station is the first in the list.
Get the multi annual raster value(s) for this station.
Returns:
The corresponding multi annual value.
For T en ET the yearly value is returned.
For N the winter and summer half yearly sum is returned in tuple.
The returned unit is mm or °C.
Get the regionalisation coefficients due to the height.
Those are the values from the dwd grid, HYRAS or REGNIE grids.
Parameters:
other_stid (int) – The Station Id of the other station from wich to regionalise for own station.
in_db_unit (bool, optional) – Should the coefficients be returned in the unit as stored in the database?
This is only relevant for the temperature.
The default is False.
Returns:
A list of coefficients.
For T, ET and N-daily only the the yearly coefficient is returned.
For N the winter and summer half yearly coefficient is returned in tuple.
None is returned if either the own or other stations multi-annual value is not available.
kinds (str or list of str) – The data kinds to update.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”, “filled_by”, “filled_share”.
For the precipitation also “qn” and “corr” are valid.
If “filled_by” is given together with an aggregation step, the “filled_by” is replaced by the “filled_share”.
The “filled_share” gives the share of filled values in the aggregation group in percent.
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeseries.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
agg_to (str or None, optional) – Aggregate to a given timespan.
If more than 20% of missing values in the aggregation group, the aggregated value will be None.
Can be anything smaller than the maximum timespan of the saved data.
If a Timeperiod smaller than the saved data is given, than the maximum possible timeperiod is returned.
For T and ET it can be “month”, “year”.
For N it can also be “hour”.
If None than the maximum timeperiod is taken.
The default is None.
nas_allowed (bool, optional) – Should NAs be allowed?
If True, then the maximum possible period is returned, even if there are NAs in the timeserie.
If False, then the minimal filled period is returned.
The default is True.
add_na_share (bool, optional) – Should one or several columns be added to the Dataframe with the share of NAs in the data.
This is especially important, when the stations data get aggregated, because the aggregation doesn’t make sense if there are a lot of NAs in the original data.
If True, one column per asked kind is added with the respective share of NAs, if the aggregation step is not the smallest.
The “kind”_na_share column is in percentage.
The default is False.
db_unit (bool, optional) – Should the result be in the Database unit.
If False the unit is getting converted to normal unit, like mm or °C.
The numbers are saved as integer in the database and got therefor multiplied by 10 or 100 to get to an integer.
The default is False.
sql_add_where (str or None, optional) – additional sql where statement to filter the output.
E.g. “EXTRACT(MONTH FROM timestamp) == 2”
The default is None
Get the timeserie with the infomation from which station the data got filled and the corresponding distance to this station.
Parameters:
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeserie.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
Returns:
The timeserie for this station and the given period with the station_id and the distance in meters from which the data got filled from.
Either only the timeserie is returned or also the id of the station from which the station data got filled, together with the distance to this station in m.
Parameters:
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeserie.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
with_dist (bool, optional) – Should the distance to the stations from which the timeseries got filled be added.
The default is False.
Returns:
The filled timeserie for this station and the given period.
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeseries.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
kind (str, optional) – The data kind to plot.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”.
For the precipitation also “qn” and “corr” are valid.
The default is “filled.
agg_to (str or None, optional) – Aggregate to a given timespan.
Can be anything smaller than the maximum timespan of the saved data.
If a Timeperiod smaller than the saved data is given, than the maximum possible timeperiod is returned.
For T and ET it can be “month”, “year”.
For N it can also be “hour”.
If None than the maximum timeperiod is taken.
The default is None.
_skip_meta_check (bool, optional) – Should the check if the station is in the database meta file get skiped.
Pay attention, when skipping this, because it can lead to problems.
This is for computational reasons, because it makes the initialization faster.
Is used by the stations classes, because the only initialize objects that are in the meta table.
The default is False
Raises:
NotImplementedError – If the class is initiated with a station ID that is not in the database.
To prevent this error, set _skip_meta_check=True.
Count holes in timeseries depending on there length.
Parameters:
weeks (list, optional) – A list of hole length to count.
Every hole longer than the duration of weeks specified is counted.
The default is [2, 4, 8, 12, 16, 20, 24]
kind (str) – The kind of the timeserie to analyze.
Should be one of [‘raw’, ‘qc’, ‘filled’].
For N also “corr” is possible.
Normally only “raw” and “qc” make sense, because the other timeseries should not have holes.
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to analyze the timeseries.
If None is given, the maximum and minimal possible Timestamp is taken.
The default is (None, None).
between_meta_period (bool, optional) – Only check between the respective period that is defined in the meta table.
If “qc” is chosen as kind, then the “raw” meta period is taken.
The default is True.
crop_period (bool, optional) – should the period get cropped to the maximum filled period.
This will result in holes being ignored when they are at the end or at the beginning of the timeserie.
If period = (None, None) is given, then this parameter is set to True.
The default is False.
Returns:
A Pandas Dataframe, with station_id as index and one column per week.
The numbers in the table are the amount of NA-periods longer than the respective amount of weeks.
This function only returns the timeserie, but is not updating the database.
Parameters:
only_new (bool, optional) – Get only the files that are not yet in the database?
If False all the available files are loaded again.
The default is False.
Returns:
The Timeseries as a DataFrame with a Timestamp Index.
Fill up missing data with measurements from nearby stations.
Parameters:
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to gap fill the timeseries.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
**kwargs (dict, optional) – Additional arguments for the fillup function.
e.g. p_elev to consider the elevation to select nearest stations. (only for T and ET)
The timeserie get adjusted to match the multi-annual value over the given period.
So the yearly variability is kept and only the whole period is adjusted.
The basis for the adjusted timeseries is the filled data and not the richter corrected data,
as the ma values are also uncorrected vallues.
Returns:
The adjusted timeserie with the timestamp as index.
Get the regionalisation coefficients due to the height.
Those are the values from the dwd grid, HYRAS or REGNIE grids.
Parameters:
other_stid (int) – The Station Id of the other station from wich to regionalise for own station.
in_db_unit (bool, optional) – Should the coefficients be returned in the unit as stored in the database?
This is only relevant for the temperature.
The default is False.
Returns:
A list of coefficients.
For T, ET and N-daily only the the yearly coefficient is returned.
For N the winter and summer half yearly coefficient is returned in tuple.
None is returned if either the own or other stations multi-annual value is not available.
kinds (str or list of str) – The data kinds to update.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”, “filled_by”, “filled_share”.
For the precipitation also “qn” and “corr” are valid.
If “filled_by” is given together with an aggregation step, the “filled_by” is replaced by the “filled_share”.
The “filled_share” gives the share of filled values in the aggregation group in percent.
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeseries.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
agg_to (str or None, optional) – Aggregate to a given timespan.
If more than 20% of missing values in the aggregation group, the aggregated value will be None.
Can be anything smaller than the maximum timespan of the saved data.
If a Timeperiod smaller than the saved data is given, than the maximum possible timeperiod is returned.
For T and ET it can be “month”, “year”.
For N it can also be “hour”.
If None than the maximum timeperiod is taken.
The default is None.
nas_allowed (bool, optional) – Should NAs be allowed?
If True, then the maximum possible period is returned, even if there are NAs in the timeserie.
If False, then the minimal filled period is returned.
The default is True.
add_na_share (bool, optional) – Should one or several columns be added to the Dataframe with the share of NAs in the data.
This is especially important, when the stations data get aggregated, because the aggregation doesn’t make sense if there are a lot of NAs in the original data.
If True, one column per asked kind is added with the respective share of NAs, if the aggregation step is not the smallest.
The “kind”_na_share column is in percentage.
The default is False.
db_unit (bool, optional) – Should the result be in the Database unit.
If False the unit is getting converted to normal unit, like mm or °C.
The numbers are saved as integer in the database and got therefor multiplied by 10 or 100 to get to an integer.
The default is False.
sql_add_where (str or None, optional) – additional sql where statement to filter the output.
E.g. “EXTRACT(MONTH FROM timestamp) == 2”
The default is None
Get the timeserie with the infomation from which station the data got filled and the corresponding distance to this station.
Parameters:
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeserie.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
Returns:
The timeserie for this station and the given period with the station_id and the distance in meters from which the data got filled from.
Either only the timeserie is returned or also the id of the station from which the station data got filled, together with the distance to this station in m.
Parameters:
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeserie.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
with_dist (bool, optional) – Should the distance to the stations from which the timeseries got filled be added.
The default is False.
Returns:
The filled timeserie for this station and the given period.
Get the min and max Timestamp for which there is data in the corresponding timeserie.
Computes the period from the timeserie or meta table.
Parameters:
kind (str) – The data kind to look for filled period.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”.
If “best” is given, then depending on the parameter of the station the best kind is selected.
For Precipitation this is “corr” and for the other this is “filled”.
For the precipitation also “qn” and “corr” are valid.
from_meta (bool, optional) – Should the period be from the meta table?
If False: the period is returned from the timeserie. In this case this function is only a wrapper for .get_period_meta.
The default is False.
crs (str, int or None, optional) – The coordinate reference system of the geometry.
If None, then the geometry is returned in WGS84 (EPSG:4326).
If string, then it should be in a pyproj readable format.
If int, then it should be the EPSG code.
The default is None.
Returns:
The location of the station as shapely Point in the given coordinate reference system.
Get the geometry of the station as a shapely Point object.
Deprecated since version 1.0.0: get_geom_shp is deprecated and will be removed in future releases.
It is replaced by get_geom.
Parameters:
crs (str, int or None, optional) – If None, then the geometry is returned in WGS84 (EPSG:4326).
If string, then it should be one of “WGS84” or “UTM”.
If int, then it should be the EPSG code.
all (bool, optional) – Should the maximum Timespan for all the last imports be returned.
If False only the period for this station is returned.
The default is False.
Get the maximum available period for this stations timeseries.
If nas_allowed is True, then the maximum range of the timeserie is returned.
Else the minimal filled period is returned
Parameters:
kinds (str or list of str) – The data kinds to update.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”.
For the precipitation also “qn” and “corr” are valid.
nas_allowed (bool, optional) – Should NAs be allowed?
If True, then the maximum possible period is returned, even if there are NAs in the timeserie.
If False, then the minimal filled period is returned.
The default is False.
infos (list of str or str, optional) – A list of the information to get from the database.
If “all” then all the information are returned.
The default is “all”.
Returns:
dict with the meta information.
The first level has one entry per parameter.
The second level has one entry per information, asked for.
If only one information is asked for, then it is returned as single value and not as subdict.
Get the explanations of the available meta fields.
Parameters:
infos (list or string, optional) – The infos you wish to get an explanation for.
If “all” then all the available information get returned.
The default is “all”
Returns:
a pandas Series with the information names as index and the explanation as values.
Get the multi annual raster value(s) for this station.
Returns:
The corresponding multi annual value.
For T en ET the yearly value is returned.
For N the winter and summer half yearly sum is returned in tuple.
The returned unit is mm or °C.
The parameters (P_1, P_2) to weight the height differences between stations.
The elevation difference is considered with the formula from LARSIM (equation 3-18 & 3-19 from the LARSIM manual [1]_ ):
If None, then the height difference is not considered and only the nearest stations are returned.
The default is None.
period (TimestampPeriod or None, optional) – The period for which the nearest neighboors are returned.
The neighboor station needs to have raw data for at least one half of the period.
If None, then the availability of the data is not checked.
The default is None.
Returns:
A list of station Ids in order of distance.
The closest station is the first in the list.
Get a specific period from the meta information table.
This functions returns the information from the meta table.
In this table there are several periods saved, like the period of the last import.
Parameters:
kind (str) – The kind of period to return.
Should be one of [‘filled’, ‘raw’, ‘last_imp’].
filled: the maximum filled period of the filled timeserie.
raw: the maximum filled timeperiod of the raw data.
last_imp: the maximum filled timeperiod of the last import.
all (bool, optional) – Should the maximum Timespan for all the filled periods be returned.
If False only the period for this station is returned.
The default is False.
Returns:
The TimestampPeriod of the station or of all the stations if all=True.
kinds_num (list of str or str) – The timeseries kinds of the numerators.
Should be one of [‘raw’, ‘qc’, ‘filled’].
For precipitation also “corr” is possible.
The timeseries kinds of the denominator or the multi annual raster key.
If the denominator is a multi annual raster key, then the result is the quotient of the timeserie and the raster value.
Possible values are:
for timeserie kinds: ‘raw’, ‘qc’, ‘filled’ or for precipitation also “corr”.
for raster keys: ‘hyras’, ‘dwd’ or ‘regnie’, depending on your defined raster files.
return_as (str, optional) – The format of the return value.
If “df” then a pandas DataFrame is returned.
If “json” then a list with dictionaries is returned.
Returns:
The quotient of the two timeseries as DataFrame or list of dictionaries (JSON) depending on the return_as parameter.
The default is pd.DataFrame.
Get the zipfiles on the CDC server with the raw data.
Parameters:
only_new (bool, optional) – Get only the files that are not yet in the database?
If False all the available files are loaded again.
The default is True
ftp_file_list (list of (strings, datetime), optional) – A list of files on the FTP server together with their modification time.
If None, then the list is fetched from the server.
The default is None
Returns:
A DataFrame of zipfiles and the corresponding modification time on the CDC server to import.
Is the last import for the given kind already worked in?
Parameters:
kind (str) – The data kind to look for filled period.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”, “best”.
If “best” is given, then depending on the parameter of the station the best kind is selected.
For Precipitation this is “corr” and for the other this is “filled”.
For the precipitation also “qn” and “corr” are valid.
Returns:
True if the last import of the given kind is already treated.
Check if the station is a real station or only a virtual one.
Real means that the DWD is measuring here.
Virtual means, that there are no measurements here, but the station got created to have timeseries for every parameter for every precipitation station.
Returns:
true if the station is real, false if it is virtual.
Check if the station is a real station or only a virtual one.
Real means that the DWD is measuring here.
Virtual means, that there are no measurements here, but the station got created to have timeseries for every parameter for every precipitation station.
Returns:
true if the station is virtual, false if it is real.
_last_imp_period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to do the gap filling.
If None is given, the last import period is taken.
This is only for internal use, to speed up the process if run in a batch.
The default is None.
**kwargs (dict, optional) – Additional keyword arguments passed to the fillup function.
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeseries.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
kind (str, optional) – The data kind to plot.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”.
For the precipitation also “qn” and “corr” are valid.
The default is “filled.
agg_to (str or None, optional) – Aggregate to a given timespan.
Can be anything smaller than the maximum timespan of the saved data.
If a Timeperiod smaller than the saved data is given, than the maximum possible timeperiod is returned.
For T and ET it can be “month”, “year”.
For N it can also be “hour”.
If None than the maximum timeperiod is taken.
The default is None.
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeseries.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
**kwargs (dict, optional) – Additional keyword arguments catch all, but unused here.
Update the mean annual value from the station timeserie.
Parameters:
kind (str or list of str) – The timeseries data kind to update theire multi annual value.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”.
For the precipitation also “corr” is valid.
**kwargs (dict, optional) – Additional keyword arguments catch all, but unused here.
Compute teh filled period of a timeserie and save in the meta table.
Parameters:
kind (str) – The data kind to look for filled period.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”.
If “best” is given, then depending on the parameter of the station the best kind is selected.
For Precipitation this is “corr” and for the other this is “filled”.
For the precipitation also “corr” are valid.
**kwargs (dict, optional) – Additional keyword arguments catch all, but unused here.
only_new (bool, optional) – Get only the files that are not yet in the database?
If False all the available files are loaded again.
The default is True
ftp_file_list (list of (strings, datetime), optional) – A list of files on the FTP server together with their modification time.
If None, then the list is fetched from the server.
The default is None
remove_nas (bool, optional) – Remove the NAs from the downloaded data before updating it to the database.
This has computational advantages.
The default is True.
**kwargs (dict) – Additional keyword arguments catch all, but unused here.
A class to add the methods for stations that can also be virtual.
Virtual means, that there is no real DWD station with measurements.
But to have data for every parameter at every 10 min precipitation station location, it is necessary to add stations and fill the gaps with data from neighboors.
_skip_meta_check (bool, optional) – Should the check if the station is in the database meta file get skiped.
Pay attention, when skipping this, because it can lead to problems.
This is for computational reasons, because it makes the initialization faster.
Is used by the stations classes, because the only initialize objects that are in the meta table.
The default is False
Raises:
NotImplementedError – If the class is initiated with a station ID that is not in the database.
To prevent this error, set _skip_meta_check=True.
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeseries.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
**kwargs (dict, optional) – Additional keyword arguments catch all, but unused here.
Count holes in timeseries depending on there length.
Parameters:
weeks (list, optional) – A list of hole length to count.
Every hole longer than the duration of weeks specified is counted.
The default is [2, 4, 8, 12, 16, 20, 24]
kind (str) – The kind of the timeserie to analyze.
Should be one of [‘raw’, ‘qc’, ‘filled’].
For N also “corr” is possible.
Normally only “raw” and “qc” make sense, because the other timeseries should not have holes.
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to analyze the timeseries.
If None is given, the maximum and minimal possible Timestamp is taken.
The default is (None, None).
between_meta_period (bool, optional) – Only check between the respective period that is defined in the meta table.
If “qc” is chosen as kind, then the “raw” meta period is taken.
The default is True.
crop_period (bool, optional) – should the period get cropped to the maximum filled period.
This will result in holes being ignored when they are at the end or at the beginning of the timeserie.
If period = (None, None) is given, then this parameter is set to True.
The default is False.
Returns:
A Pandas Dataframe, with station_id as index and one column per week.
The numbers in the table are the amount of NA-periods longer than the respective amount of weeks.
This function only returns the timeserie, but is not updating the database.
Parameters:
only_new (bool, optional) – Get only the files that are not yet in the database?
If False all the available files are loaded again.
The default is False.
Returns:
The Timeseries as a DataFrame with a Timestamp Index.
Fill up missing data with measurements from nearby stations.
Parameters:
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to gap fill the timeseries.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
**kwargs (dict, optional) – Additional arguments for the fillup function.
e.g. p_elev to consider the elevation to select nearest stations. (only for T and ET)
Get the regionalisation coefficients due to the height.
Those are the values from the dwd grid, HYRAS or REGNIE grids.
Parameters:
other_stid (int) – The Station Id of the other station from wich to regionalise for own station.
in_db_unit (bool, optional) – Should the coefficients be returned in the unit as stored in the database?
This is only relevant for the temperature.
The default is False.
Returns:
A list of coefficients.
For T, ET and N-daily only the the yearly coefficient is returned.
For N the winter and summer half yearly coefficient is returned in tuple.
None is returned if either the own or other stations multi-annual value is not available.
kinds (str or list of str) – The data kinds to update.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”, “filled_by”, “filled_share”.
For the precipitation also “qn” and “corr” are valid.
If “filled_by” is given together with an aggregation step, the “filled_by” is replaced by the “filled_share”.
The “filled_share” gives the share of filled values in the aggregation group in percent.
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeseries.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
agg_to (str or None, optional) – Aggregate to a given timespan.
If more than 20% of missing values in the aggregation group, the aggregated value will be None.
Can be anything smaller than the maximum timespan of the saved data.
If a Timeperiod smaller than the saved data is given, than the maximum possible timeperiod is returned.
For T and ET it can be “month”, “year”.
For N it can also be “hour”.
If None than the maximum timeperiod is taken.
The default is None.
nas_allowed (bool, optional) – Should NAs be allowed?
If True, then the maximum possible period is returned, even if there are NAs in the timeserie.
If False, then the minimal filled period is returned.
The default is True.
add_na_share (bool, optional) – Should one or several columns be added to the Dataframe with the share of NAs in the data.
This is especially important, when the stations data get aggregated, because the aggregation doesn’t make sense if there are a lot of NAs in the original data.
If True, one column per asked kind is added with the respective share of NAs, if the aggregation step is not the smallest.
The “kind”_na_share column is in percentage.
The default is False.
db_unit (bool, optional) – Should the result be in the Database unit.
If False the unit is getting converted to normal unit, like mm or °C.
The numbers are saved as integer in the database and got therefor multiplied by 10 or 100 to get to an integer.
The default is False.
sql_add_where (str or None, optional) – additional sql where statement to filter the output.
E.g. “EXTRACT(MONTH FROM timestamp) == 2”
The default is None
Get the timeserie with the infomation from which station the data got filled and the corresponding distance to this station.
Parameters:
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeserie.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
Returns:
The timeserie for this station and the given period with the station_id and the distance in meters from which the data got filled from.
Either only the timeserie is returned or also the id of the station from which the station data got filled, together with the distance to this station in m.
Parameters:
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeserie.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
with_dist (bool, optional) – Should the distance to the stations from which the timeseries got filled be added.
The default is False.
Returns:
The filled timeserie for this station and the given period.
Get the min and max Timestamp for which there is data in the corresponding timeserie.
Computes the period from the timeserie or meta table.
Parameters:
kind (str) – The data kind to look for filled period.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”.
If “best” is given, then depending on the parameter of the station the best kind is selected.
For Precipitation this is “corr” and for the other this is “filled”.
For the precipitation also “qn” and “corr” are valid.
from_meta (bool, optional) – Should the period be from the meta table?
If False: the period is returned from the timeserie. In this case this function is only a wrapper for .get_period_meta.
The default is False.
crs (str, int or None, optional) – The coordinate reference system of the geometry.
If None, then the geometry is returned in WGS84 (EPSG:4326).
If string, then it should be in a pyproj readable format.
If int, then it should be the EPSG code.
The default is None.
Returns:
The location of the station as shapely Point in the given coordinate reference system.
Get the geometry of the station as a shapely Point object.
Deprecated since version 1.0.0: get_geom_shp is deprecated and will be removed in future releases.
It is replaced by get_geom.
Parameters:
crs (str, int or None, optional) – If None, then the geometry is returned in WGS84 (EPSG:4326).
If string, then it should be one of “WGS84” or “UTM”.
If int, then it should be the EPSG code.
all (bool, optional) – Should the maximum Timespan for all the last imports be returned.
If False only the period for this station is returned.
The default is False.
Get the maximum available period for this stations timeseries.
If nas_allowed is True, then the maximum range of the timeserie is returned.
Else the minimal filled period is returned
Parameters:
kinds (str or list of str) – The data kinds to update.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”.
For the precipitation also “qn” and “corr” are valid.
nas_allowed (bool, optional) – Should NAs be allowed?
If True, then the maximum possible period is returned, even if there are NAs in the timeserie.
If False, then the minimal filled period is returned.
The default is False.
infos (list of str or str, optional) – A list of the information to get from the database.
If “all” then all the information are returned.
The default is “all”.
Returns:
dict with the meta information.
The first level has one entry per parameter.
The second level has one entry per information, asked for.
If only one information is asked for, then it is returned as single value and not as subdict.
Get the explanations of the available meta fields.
Parameters:
infos (list or string, optional) – The infos you wish to get an explanation for.
If “all” then all the available information get returned.
The default is “all”
Returns:
a pandas Series with the information names as index and the explanation as values.
Get the multi annual raster value(s) for this station.
Returns:
The corresponding multi annual value.
For T en ET the yearly value is returned.
For N the winter and summer half yearly sum is returned in tuple.
The returned unit is mm or °C.
The parameters (P_1, P_2) to weight the height differences between stations.
The elevation difference is considered with the formula from LARSIM (equation 3-18 & 3-19 from the LARSIM manual [1]_ ):
If None, then the height difference is not considered and only the nearest stations are returned.
The default is None.
period (TimestampPeriod or None, optional) – The period for which the nearest neighboors are returned.
The neighboor station needs to have raw data for at least one half of the period.
If None, then the availability of the data is not checked.
The default is None.
Returns:
A list of station Ids in order of distance.
The closest station is the first in the list.
Get a specific period from the meta information table.
This functions returns the information from the meta table.
In this table there are several periods saved, like the period of the last import.
Parameters:
kind (str) – The kind of period to return.
Should be one of [‘filled’, ‘raw’, ‘last_imp’].
filled: the maximum filled period of the filled timeserie.
raw: the maximum filled timeperiod of the raw data.
last_imp: the maximum filled timeperiod of the last import.
all (bool, optional) – Should the maximum Timespan for all the filled periods be returned.
If False only the period for this station is returned.
The default is False.
Returns:
The TimestampPeriod of the station or of all the stations if all=True.
kinds_num (list of str or str) – The timeseries kinds of the numerators.
Should be one of [‘raw’, ‘qc’, ‘filled’].
For precipitation also “corr” is possible.
The timeseries kinds of the denominator or the multi annual raster key.
If the denominator is a multi annual raster key, then the result is the quotient of the timeserie and the raster value.
Possible values are:
for timeserie kinds: ‘raw’, ‘qc’, ‘filled’ or for precipitation also “corr”.
for raster keys: ‘hyras’, ‘dwd’ or ‘regnie’, depending on your defined raster files.
return_as (str, optional) – The format of the return value.
If “df” then a pandas DataFrame is returned.
If “json” then a list with dictionaries is returned.
Returns:
The quotient of the two timeseries as DataFrame or list of dictionaries (JSON) depending on the return_as parameter.
The default is pd.DataFrame.
Get the zipfiles on the CDC server with the raw data.
Parameters:
only_new (bool, optional) – Get only the files that are not yet in the database?
If False all the available files are loaded again.
The default is True
ftp_file_list (list of (strings, datetime), optional) – A list of files on the FTP server together with their modification time.
If None, then the list is fetched from the server.
The default is None
Returns:
A DataFrame of zipfiles and the corresponding modification time on the CDC server to import.
Is the last import for the given kind already worked in?
Parameters:
kind (str) – The data kind to look for filled period.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”, “best”.
If “best” is given, then depending on the parameter of the station the best kind is selected.
For Precipitation this is “corr” and for the other this is “filled”.
For the precipitation also “qn” and “corr” are valid.
Returns:
True if the last import of the given kind is already treated.
Check if the station is a real station or only a virtual one.
Real means that the DWD is measuring here.
Virtual means, that there are no measurements here, but the station got created to have timeseries for every parameter for every precipitation station.
Returns:
true if the station is real, false if it is virtual.
Check if the station is a real station or only a virtual one.
Real means that the DWD is measuring here.
Virtual means, that there are no measurements here, but the station got created to have timeseries for every parameter for every precipitation station.
Returns:
true if the station is virtual, false if it is real.
_last_imp_period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to do the gap filling.
If None is given, the last import period is taken.
This is only for internal use, to speed up the process if run in a batch.
The default is None.
**kwargs (dict, optional) – Additional keyword arguments passed to the fillup function.
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeseries.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
kind (str, optional) – The data kind to plot.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”.
For the precipitation also “qn” and “corr” are valid.
The default is “filled.
agg_to (str or None, optional) – Aggregate to a given timespan.
Can be anything smaller than the maximum timespan of the saved data.
If a Timeperiod smaller than the saved data is given, than the maximum possible timeperiod is returned.
For T and ET it can be “month”, “year”.
For N it can also be “hour”.
If None than the maximum timeperiod is taken.
The default is None.
Update the mean annual value from the station timeserie.
Parameters:
kind (str or list of str) – The timeseries data kind to update theire multi annual value.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”.
For the precipitation also “corr” is valid.
**kwargs (dict, optional) – Additional keyword arguments catch all, but unused here.
Compute teh filled period of a timeserie and save in the meta table.
Parameters:
kind (str) – The data kind to look for filled period.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”.
If “best” is given, then depending on the parameter of the station the best kind is selected.
For Precipitation this is “corr” and for the other this is “filled”.
For the precipitation also “corr” are valid.
**kwargs (dict, optional) – Additional keyword arguments catch all, but unused here.
only_new (bool, optional) – Get only the files that are not yet in the database?
If False all the available files are loaded again.
The default is True
ftp_file_list (list of (strings, datetime), optional) – A list of files on the FTP server together with their modification time.
If None, then the list is fetched from the server.
The default is None
remove_nas (bool, optional) – Remove the NAs from the downloaded data before updating it to the database.
This has computational advantages.
The default is True.
**kwargs (dict) – Additional keyword arguments catch all, but unused here.
_skip_meta_check (bool, optional) – Should the check if the station is in the database meta file get skiped.
Pay attention, when skipping this, because it can lead to problems.
This is for computational reasons, because it makes the initialization faster.
Is used by the stations classes, because the only initialize objects that are in the meta table.
The default is False
Raises:
NotImplementedError – If the class is initiated with a station ID that is not in the database.
To prevent this error, set _skip_meta_check=True.
In Larsim those parameters are defined as $P_1 = 500$ and $P_2 = 1$.
Stoelzle et al. (2016) found that $P_1 = 100$ and $P_2 = 4$ is better for Baden-Würtemberg to consider the quick changes in topographie.
For all of germany, those parameter values are giving too much weight to the elevation difference, which can result in getting neighboor stations from the border of the Tschec Republic for the Feldberg station. Therefor the values $P_1 = 250$ and $P_2 = 1.5$ are used as default values.
literature:
Stoelzle, Michael & Weiler, Markus & Steinbrich, Andreas. (2016) Starkregengefährdung in Baden-Württemberg – von der Methodenentwicklung zur Starkregenkartierung. Tag der Hydrologie.
The timeserie get adjusted to match the multi-annual value over the given period.
So the yearly variability is kept and only the whole period is adjusted.
Returns:
The adjusted timeserie with the timestamp as index.
Count holes in timeseries depending on there length.
Parameters:
weeks (list, optional) – A list of hole length to count.
Every hole longer than the duration of weeks specified is counted.
The default is [2, 4, 8, 12, 16, 20, 24]
kind (str) – The kind of the timeserie to analyze.
Should be one of [‘raw’, ‘qc’, ‘filled’].
For N also “corr” is possible.
Normally only “raw” and “qc” make sense, because the other timeseries should not have holes.
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to analyze the timeseries.
If None is given, the maximum and minimal possible Timestamp is taken.
The default is (None, None).
between_meta_period (bool, optional) – Only check between the respective period that is defined in the meta table.
If “qc” is chosen as kind, then the “raw” meta period is taken.
The default is True.
crop_period (bool, optional) – should the period get cropped to the maximum filled period.
This will result in holes being ignored when they are at the end or at the beginning of the timeserie.
If period = (None, None) is given, then this parameter is set to True.
The default is False.
Returns:
A Pandas Dataframe, with station_id as index and one column per week.
The numbers in the table are the amount of NA-periods longer than the respective amount of weeks.
This function only returns the timeserie, but is not updating the database.
Parameters:
only_new (bool, optional) – Get only the files that are not yet in the database?
If False all the available files are loaded again.
The default is False.
Returns:
The Timeseries as a DataFrame with a Timestamp Index.
Get the regionalisation coefficients due to the height.
Those are the values from the dwd grid, HYRAS or REGNIE grids.
Parameters:
other_stid (int) – The Station Id of the other station from wich to regionalise for own station.
in_db_unit (bool, optional) – Should the coefficients be returned in the unit as stored in the database?
This is only relevant for the temperature.
The default is False.
Returns:
A list of coefficients.
For T, ET and N-daily only the the yearly coefficient is returned.
For N the winter and summer half yearly coefficient is returned in tuple.
None is returned if either the own or other stations multi-annual value is not available.
kinds (str or list of str) – The data kinds to update.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”, “filled_by”, “filled_share”.
For the precipitation also “qn” and “corr” are valid.
If “filled_by” is given together with an aggregation step, the “filled_by” is replaced by the “filled_share”.
The “filled_share” gives the share of filled values in the aggregation group in percent.
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeseries.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
agg_to (str or None, optional) – Aggregate to a given timespan.
If more than 20% of missing values in the aggregation group, the aggregated value will be None.
Can be anything smaller than the maximum timespan of the saved data.
If a Timeperiod smaller than the saved data is given, than the maximum possible timeperiod is returned.
For T and ET it can be “month”, “year”.
For N it can also be “hour”.
If None than the maximum timeperiod is taken.
The default is None.
nas_allowed (bool, optional) – Should NAs be allowed?
If True, then the maximum possible period is returned, even if there are NAs in the timeserie.
If False, then the minimal filled period is returned.
The default is True.
add_na_share (bool, optional) – Should one or several columns be added to the Dataframe with the share of NAs in the data.
This is especially important, when the stations data get aggregated, because the aggregation doesn’t make sense if there are a lot of NAs in the original data.
If True, one column per asked kind is added with the respective share of NAs, if the aggregation step is not the smallest.
The “kind”_na_share column is in percentage.
The default is False.
db_unit (bool, optional) – Should the result be in the Database unit.
If False the unit is getting converted to normal unit, like mm or °C.
The numbers are saved as integer in the database and got therefor multiplied by 10 or 100 to get to an integer.
The default is False.
sql_add_where (str or None, optional) – additional sql where statement to filter the output.
E.g. “EXTRACT(MONTH FROM timestamp) == 2”
The default is None
Get the timeserie with the infomation from which station the data got filled and the corresponding distance to this station.
Parameters:
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeserie.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
Returns:
The timeserie for this station and the given period with the station_id and the distance in meters from which the data got filled from.
Either only the timeserie is returned or also the id of the station from which the station data got filled, together with the distance to this station in m.
Parameters:
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeserie.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
with_dist (bool, optional) – Should the distance to the stations from which the timeseries got filled be added.
The default is False.
Returns:
The filled timeserie for this station and the given period.
Get the min and max Timestamp for which there is data in the corresponding timeserie.
Computes the period from the timeserie or meta table.
Parameters:
kind (str) – The data kind to look for filled period.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”.
If “best” is given, then depending on the parameter of the station the best kind is selected.
For Precipitation this is “corr” and for the other this is “filled”.
For the precipitation also “qn” and “corr” are valid.
from_meta (bool, optional) – Should the period be from the meta table?
If False: the period is returned from the timeserie. In this case this function is only a wrapper for .get_period_meta.
The default is False.
crs (str, int or None, optional) – The coordinate reference system of the geometry.
If None, then the geometry is returned in WGS84 (EPSG:4326).
If string, then it should be in a pyproj readable format.
If int, then it should be the EPSG code.
The default is None.
Returns:
The location of the station as shapely Point in the given coordinate reference system.
Get the geometry of the station as a shapely Point object.
Deprecated since version 1.0.0: get_geom_shp is deprecated and will be removed in future releases.
It is replaced by get_geom.
Parameters:
crs (str, int or None, optional) – If None, then the geometry is returned in WGS84 (EPSG:4326).
If string, then it should be one of “WGS84” or “UTM”.
If int, then it should be the EPSG code.
all (bool, optional) – Should the maximum Timespan for all the last imports be returned.
If False only the period for this station is returned.
The default is False.
Get the maximum available period for this stations timeseries.
If nas_allowed is True, then the maximum range of the timeserie is returned.
Else the minimal filled period is returned
Parameters:
kinds (str or list of str) – The data kinds to update.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”.
For the precipitation also “qn” and “corr” are valid.
nas_allowed (bool, optional) – Should NAs be allowed?
If True, then the maximum possible period is returned, even if there are NAs in the timeserie.
If False, then the minimal filled period is returned.
The default is False.
infos (list of str or str, optional) – A list of the information to get from the database.
If “all” then all the information are returned.
The default is “all”.
Returns:
dict with the meta information.
The first level has one entry per parameter.
The second level has one entry per information, asked for.
If only one information is asked for, then it is returned as single value and not as subdict.
Get the explanations of the available meta fields.
Parameters:
infos (list or string, optional) – The infos you wish to get an explanation for.
If “all” then all the available information get returned.
The default is “all”
Returns:
a pandas Series with the information names as index and the explanation as values.
Get the multi annual raster value(s) for this station.
Returns:
The corresponding multi annual value.
For T en ET the yearly value is returned.
For N the winter and summer half yearly sum is returned in tuple.
The returned unit is mm or °C.
Get a specific period from the meta information table.
This functions returns the information from the meta table.
In this table there are several periods saved, like the period of the last import.
Parameters:
kind (str) – The kind of period to return.
Should be one of [‘filled’, ‘raw’, ‘last_imp’].
filled: the maximum filled period of the filled timeserie.
raw: the maximum filled timeperiod of the raw data.
last_imp: the maximum filled timeperiod of the last import.
all (bool, optional) – Should the maximum Timespan for all the filled periods be returned.
If False only the period for this station is returned.
The default is False.
Returns:
The TimestampPeriod of the station or of all the stations if all=True.
kinds_num (list of str or str) – The timeseries kinds of the numerators.
Should be one of [‘raw’, ‘qc’, ‘filled’].
For precipitation also “corr” is possible.
The timeseries kinds of the denominator or the multi annual raster key.
If the denominator is a multi annual raster key, then the result is the quotient of the timeserie and the raster value.
Possible values are:
for timeserie kinds: ‘raw’, ‘qc’, ‘filled’ or for precipitation also “corr”.
for raster keys: ‘hyras’, ‘dwd’ or ‘regnie’, depending on your defined raster files.
return_as (str, optional) – The format of the return value.
If “df” then a pandas DataFrame is returned.
If “json” then a list with dictionaries is returned.
Returns:
The quotient of the two timeseries as DataFrame or list of dictionaries (JSON) depending on the return_as parameter.
The default is pd.DataFrame.
Get the zipfiles on the CDC server with the raw data.
Parameters:
only_new (bool, optional) – Get only the files that are not yet in the database?
If False all the available files are loaded again.
The default is True
ftp_file_list (list of (strings, datetime), optional) – A list of files on the FTP server together with their modification time.
If None, then the list is fetched from the server.
The default is None
Returns:
A DataFrame of zipfiles and the corresponding modification time on the CDC server to import.
Is the last import for the given kind already worked in?
Parameters:
kind (str) – The data kind to look for filled period.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”, “best”.
If “best” is given, then depending on the parameter of the station the best kind is selected.
For Precipitation this is “corr” and for the other this is “filled”.
For the precipitation also “qn” and “corr” are valid.
Returns:
True if the last import of the given kind is already treated.
Check if the station is a real station or only a virtual one.
Real means that the DWD is measuring here.
Virtual means, that there are no measurements here, but the station got created to have timeseries for every parameter for every precipitation station.
Returns:
true if the station is real, false if it is virtual.
Check if the station is a real station or only a virtual one.
Real means that the DWD is measuring here.
Virtual means, that there are no measurements here, but the station got created to have timeseries for every parameter for every precipitation station.
Returns:
true if the station is virtual, false if it is real.
_last_imp_period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to do the gap filling.
If None is given, the last import period is taken.
This is only for internal use, to speed up the process if run in a batch.
The default is None.
**kwargs (dict, optional) – Additional keyword arguments passed to the fillup function.
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeseries.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
kind (str, optional) – The data kind to plot.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”, “adj”.
For the precipitation also “qn” and “corr” are valid.
The default is “filled.
agg_to (str or None, optional) – Aggregate to a given timespan.
Can be anything smaller than the maximum timespan of the saved data.
If a Timeperiod smaller than the saved data is given, than the maximum possible timeperiod is returned.
For T and ET it can be “month”, “year”.
For N it can also be “hour”.
If None than the maximum timeperiod is taken.
The default is None.
period (TimestampPeriod or (tuple or list of datetime.datetime or None), optional) – The minimum and maximum Timestamp for which to get the timeseries.
If None is given, the maximum or minimal possible Timestamp is taken.
The default is (None, None).
**kwargs (dict, optional) – Additional keyword arguments catch all, but unused here.
Update the mean annual value from the station timeserie.
Parameters:
kind (str or list of str) – The timeseries data kind to update theire multi annual value.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”.
For the precipitation also “corr” is valid.
**kwargs (dict, optional) – Additional keyword arguments catch all, but unused here.
Compute teh filled period of a timeserie and save in the meta table.
Parameters:
kind (str) – The data kind to look for filled period.
Must be a column in the timeseries DB.
Must be one of “raw”, “qc”, “filled”.
If “best” is given, then depending on the parameter of the station the best kind is selected.
For Precipitation this is “corr” and for the other this is “filled”.
For the precipitation also “corr” are valid.
**kwargs (dict, optional) – Additional keyword arguments catch all, but unused here.
only_new (bool, optional) – Get only the files that are not yet in the database?
If False all the available files are loaded again.
The default is True
ftp_file_list (list of (strings, datetime), optional) – A list of files on the FTP server together with their modification time.
If None, then the list is fetched from the server.
The default is None
remove_nas (bool, optional) – Remove the NAs from the downloaded data before updating it to the database.
This has computational advantages.
The default is True.
**kwargs (dict) – Additional keyword arguments catch all, but unused here.