ReadInputs raw date and climate data

Share:

Description

Load raw date and climate data, perform pre-processing, check for missing and error entries and then compile data list of daily time step.

Usage

1
2
3
4
5
6
ReadInputs(climatedata, constants, stopmissing, timestep,
                        interp_missing_days = F, 
                        interp_missing_entries = F, 
                        interp_abnormal = F, 
                        missing_method = NULL, 
                        abnormal_method = NULL)

Arguments

climatedata

A data frame named "climatedata" containing the raw data of date and climate variables.
The data frame contain objects named as "Year", "Month" and "Day" to indicate the date.
The climate variables will be of the following names while it is not compulsory to have all of them:

Tmax.daily - daily maximum temperature in degree Celcius,
Tmin.daily - daily minimum temperature in degree Celcius,
Temp.subdaily - subdaily temperature in degree Celcius,
Tdew.subdaily - subdaily dew point temperature in degree Celcius,
RHmax.daily - daily maximum relative humidity in percentage,
RHmin.daily - daily minimum relative humidity in percentage,
RH.subdaily - subdaily relative humidity in degree Celcius,
Rs.daily - daily incoming solar radiation in Megajoules per square metres per day,
n.daily - daily sunshine hour in hours,
Cd.daily - daily cloud cover in oktas,
Precip.daily - daily precipitation in millimitres,
u2.subdaily - subdaily wind speed measured at 2 metres from the ground surface in metres per second,
uz.subdaily - subdaily wind speed in metres per second,
Epan.daily - daily Class-A pan evaporation in millimitres,
Vp.daily - daily vapour pressure in hectopascal,
Vp.subdaily - subdaily vapour pressure in hectopascal.

In order to determine which variables to include in "climatedata", please see ET for the specific data requirements for different formulations.

constants

A list named "constants" consists of constants required for data pre-processing which may contain the following items:
a_0, b_0, c_0, d_0.
These four constants which are constants required to calculate daily sunshine hours from daily cloud cover (see Equation S3.10 in McMahon et al., 2012) - if the user requires such calculation these constants must be included in "constants".
The suggested values for various Australian locations are presented in Chiew and McMahon (1991), in which the four constants are named as a0, b0, c0, d0.

stopmissing

A numeric vector of length 3:
- the first value represents the maximum percentage of missing data that the user can tolerate;
- the second value represents the maximum percentage of the duration of missing data to the total data duaration that the user can toleratre;
- the third value represents the maximum percentage of missing days (within the date data, as a fraction of the total number of days) that the user can tolerate.
All values should be numbers between 1 and 99.
The percentages of the number and duration of missing data in the date data and each input variable are compared to the corresponding threshold; if any of the threshold is exceeded the program will be terminated due to unsatisfactory data quality.

interp_missing_days

T or F, indicating if missing days (within the date data) should be interpolated, with a default of F which assigns NA to data at the missing days.

interp_missing_entries

T or F, indicating if missing data entries within individual climate variables should be interpolated, with a default of F which assigns NA to the missing entries.

interp_abnormal

T or F, if abnormal values within individual climate variables should be interpolated, with a default of F which leaves the abnormal values unchanged.
Abnormal values are defined differently according to the input variable, as following:

- Tmax.daily > 100 degree Celcius
- Tmin.daily > Tmax.daily
- Temp.subdaily > 100 degree Celcius
- Tdew.daily/Tdew.subdaily > 100 degree Celcius
- RHmax.daily > 100 per cent
- RHmin.daily > RHmax.daily
- RH.subdaily > 100 per cent
- Rs.daily/Rs.subdaily < 0 MJ.m^2
- n.daily < 0 hour
- Cd.daily < 0 Okta
- Precip.daily < 0 mm
- uz.daily/uz.subdaily < 0 m/s
- u2.daily/u2.subdaily < 0 m/s
- Epan.daily < 0 mm
- Vp.daily/Vp.subdaily < 0 hPa

missing_method

A character string for the name of the interpolated methods chosen for filling in missing days and missing data entries. Can be either:

monthly average - replacement with same-month average (adapted from Narapusetty et al., 2009);
seasonal average - replacement with same-season average (adapted from Narapusetty et al., 2009);
DoY average - replacement with same day-of-the-year average (Narapusetty et al., 2009);
neighbouring average - interpolation between the two bounding values, which is only suitable for time increments in which values are available at adjacent increments (McMahon et al., 2013). When there is more than one consecutive missing entry, this interpolation fails, with a warning given.

abnormal_method

A character string for the name of the interpolated methods chosen for replacing data entries with abnormal values. Can be either:

monthly average - replacement with same-month average (adapted from Narapusetty et al., 2009);
seasonal average - replacement with same-season average (adapted from Narapusetty et al., 2009);
DoY average - replacement with same day-of-the-year average (Narapusetty et al., 2009);
neighbouring average - interpolation between the two bounding values, which is only suitable for time increments in which non-abnormal values are available at adjacent increments (McMahon et al., 2013). When there is more than one consecutive abnormal entry, this interpolation fails, with a warning given.

timestep

Should be either daily or subdaily to specify the time step of raw climate data used.

Value

This function returns a list with all components of class zoo which have been processed from the raw data, including:

Date.daily

A zoo object containing the date in daily step in the format of yyyy-mm-dd.

Date.monthly

A zoo object containing the date in daily step in the format of mmm-yyyy.

J

A zoo object containing the Julian Day for every day during the period that the data spans.

i

A zoo object containing the month number for every day during the period that the data spans.

ndays

A zoo object containing the number of days for every month during the period that the data spans.

Tmax

A zoo object containing the daily maximum temperatures in degree Celcius.

Tmin

A zoo object containing the daily minimum temperatures in degree Celcius.

u2

A zoo object containing the daily wind speed at 2m from the ground in m/s.

uz

A zoo object containing the daily wind speed measured at the height of wind instrument in m/s.

Rs

A zoo object containing the daily solar radiation in MJ/m^2/day.

n

A zoo object containing the daily sunshine hours.

Cd

A zoo object containing the daily cloud cover in oktas.

Precip

A zoo object containing the daily precipitation in mm.

Epan

A zoo object containing the daily Class-A pan evaporation in mm.

RHmax

A zoo object containing the daily maximum relative humidity in percentage.

RHmin

A zoo object containing the daily minimum relative humidity in percentage.

Tdew

A zoo object containing the average daily dew temperatures in degree Celcius.

Note that the components might have value of NULL when the corresponding input variable cannot be found in the raw data (i.e. "climatedata").

Author(s)

Danlu Guo

References

McMahon, T., Peel, M., Lowe, L., Srikanthan, R. & McVicar, T. 2012. Estimating actual, potential, reference crop and pan evaporation using standard meteorological data: a pragmatic synthesis. Hydrology and Earth System Sciences Discussions, 9, 11829-11910.

Chiew, F. H. & McMahon, T. A. 1991. The applicability of Morton's and Penman's evapotranspiration estimates in rainfall-runoff modeling1. JAWRA Journal of the American Water Resources Association, 27, 611-620.

Narapusetty, B., DelSole, T.Tippett, M.K. 2009, Optimal Estimation of the Climatological Mean. Journal of Climate, vol. 22, no. 18, pp. 4845-4859.

See Also

ET,climatedata,data

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
# ReadInputs climate data
data("climatedata")
data("constants")
data <- ReadInputs(climatedata, constants, 
stopmissing=c(10,10,3),
timestep="subdaily", 
interp_missing_days = TRUE, 
interp_missing_entries = TRUE, 
interp_abnormal = TRUE, 
missing_method = "DoY average", 
abnormal_method = "DoY average")

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.