weatherOz for DPIRD

About DPIRD Data

From the DPIRD Weather Website’s “About” Page.

The Department of Primary Industries and Regional Development’s (DPIRD) network of automatic weather stations and radars throughout the state provide timely, relevant and local weather data to assist growers and regional communities make more-informed decisions.

The weather station data includes air temperature, humidity, rainfall, wind speed and direction, with most stations also measuring incoming solar radiation to calculate evaporation. This website includes dashboards for each station to visualise this data.

Data from the DPIRD API are licenced under the Creative Commons Attribution 3.0 Licence (CC BY 3.0 AU).

A Note on API Keys

All examples in this vignette assume that you have stored your API key in your .Renviron file. See Chapter 8 in “What They Forgot to Teach You About R” by Bryan et al. for more on storing details in your .Renviron if you are unfamiliar.

Working With DPIRD Data

Three functions are provided to streamline fetching data from the DPIRD Weather 2.0 API endpoints.

  • get_dpird_extremes(), which returns the recorded extreme values for the given station in the DPIRD weather station network.;
  • get_dpird_minute(), which returns weather data in minute increments for stations in the DPIRD weather station network with only the past two years being available; and
  • get_dpird_summaries(), which returns weather data in 15 and 30 minute, hourly, daily, monthly or yearly summary values for stations in the DPIRD weather station network.

Getting Extreme Weather Values

The get_dpird_extremes() function fetches and returns nicely formatted individual extreme weather summaries from the DPIRD Weather 2.0 API. You must provide a station_code and API_key, the other arguments, values and include_closed are optional.

Available Values for Extreme Weather

  • all (which will return all of the following values),
  • erosionCondition,
  • erosionConditionLast7Days,
  • erosionConditionLast7DaysDays,
  • erosionConditionLast7DaysMinutes,
  • erosionConditionLast14Days,
  • erosionConditionLast14DaysDays,
  • erosionConditionLast14DaysMinutes,
  • erosionConditionMonthToDate,
  • erosionConditionMonthToDateDays,
  • erosionConditionMonthToDateMinutes,
  • erosionConditionMonthToDateStartTime,
  • erosionConditionSince12AM,
  • erosionConditionSince12AMMinutes,
  • erosionConditionSince12AMStartTime,
  • erosionConditionYearToDate,
  • erosionConditionYearToDateDays,
  • erosionConditionYearToDateMinutes,
  • erosionConditionYearToDateStartTime,
  • frostCondition,
  • frostConditionLast7Days,
  • frostConditionLast7DaysDays,
  • frostConditionLast7DaysMinutes,
  • frostConditionLast14Days,
  • frostConditionLast14DaysDays,
  • frostConditionLast14DaysMinutes,
  • frostConditionMonthToDate,
  • frostConditionMonthToDateDays,
  • frostConditionMonthToDateMinutes,
  • frostConditionMonthToDateStartTime,
  • frostConditionSince9AM,
  • frostConditionSince9AMMinutes,
  • frostConditionSince9AMStartTime,
  • frostConditionTo9AM,
  • frostConditionTo9AMMinutes,
  • frostConditionTo9AMStartTime,
  • frostConditionYearToDate,
  • frostConditionYearToDate,
  • frostConditionYearToDateMinutes,
  • frostConditionYearToDateStartTime,
  • heatCondition,
  • heatConditionLast7Days,
  • heatConditionLast7DaysDays,
  • heatConditionLast7DaysMinutes,
  • heatConditionLast14Days,
  • heatConditionLast14DaysDays,
  • heatConditionLast14DaysMinutes,
  • heatConditionMonthToDate,
  • heatConditionMonthToDateDays,
  • heatConditionMonthToDateMinutes,
  • heatConditionMonthToDateStartTime,
  • heatConditionSince12AM,
  • heatConditionSince12AMMinutes,
  • heatConditionSince12AMStartTime,
  • heatConditionYearToDate,
  • heatConditionYearToDateDays,
  • heatConditionYearToDateMinutes, and
  • heatConditionYearToDateStartTime

Example 1: Get All Extremes for Northam, WA

In the first example, we illustrate how to fetch all extreme values available for Northam.

library(weatherOz)

(extremes <- get_dpird_extremes(
  station_code = "NO"
))
#> Key: <station_code>
#>    station_code longitude  latitude frost_condition_since9_am_minutes frost_condition_since9_am_start_time
#>          <fctr>     <num>     <num>                             <int>                               <POSc>
#> 1:           NO  116.6942 -31.65161                                 0                                 <NA>
#>    frost_condition_to9_am_minutes frost_condition_to9_am_start_time frost_condition_last7_days_minutes
#>                             <int>                            <POSc>                              <int>
#> 1:                              0                              <NA>                                  0
#>    frost_condition_last7_days_days frost_condition_last14_days_minutes frost_condition_last14_days_days
#>                              <int>                               <int>                            <int>
#> 1:                               0                                   0                                0
#>    frost_condition_month_to_date_minutes frost_condition_month_to_date_start_time
#>                                    <int>                                   <POSc>
#> 1:                                     0                                     <NA>
#>    frost_condition_month_to_date_days frost_condition_year_to_date_minutes
#>                                 <int>                                <int>
#> 1:                                  0                                 1125
#>    frost_condition_year_to_date_start_time frost_condition_year_to_date_days heat_condition_since12_am_minutes
#>                                     <POSc>                             <int>                             <int>
#> 1:                     2024-05-23 05:59:00                                 9                                 0
#>    heat_condition_since12_am_start_time heat_condition_last7_days_minutes heat_condition_last7_days_days
#>                                  <POSc>                             <int>                          <int>
#> 1:                                 <NA>                                 0                              0
#>    heat_condition_last14_days_minutes heat_condition_last14_days_days heat_condition_month_to_date_minutes
#>                                 <int>                           <int>                                <int>
#> 1:                                334                               1                                  635
#>    heat_condition_month_to_date_start_time heat_condition_month_to_date_days heat_condition_year_to_date_minutes
#>                                     <POSc>                             <int>                               <int>
#> 1:                     2024-10-01 11:05:00                                 3                               41714
#>    heat_condition_year_to_date_start_time heat_condition_year_to_date_days erosion_condition_since12_am_minutes
#>                                    <POSc>                            <int>                                <int>
#> 1:                    2024-01-01 12:06:00                               96                                    0
#>    erosion_condition_since12_am_start_time erosion_condition_last7_days_minutes erosion_condition_last7_days_days
#>                                     <POSc>                                <int>                             <int>
#> 1:                                    <NA>                                    0                                 0
#>    erosion_condition_last14_days_minutes erosion_condition_last14_days_days
#>                                    <int>                              <int>
#> 1:                                     0                                  0
#>    erosion_condition_month_to_date_minutes erosion_condition_month_to_date_start_time
#>                                      <int>                                     <POSc>
#> 1:                                       2                        2024-10-01 12:27:00
#>    erosion_condition_month_to_date_days erosion_condition_year_to_date_minutes
#>                                   <int>                                  <int>
#> 1:                                    1                                     45
#>    erosion_condition_year_to_date_start_time erosion_condition_year_to_date_days
#>                                       <POSc>                               <int>
#> 1:                       2024-01-13 19:11:00                                   7

Example 2: Get Selected Extremes for Northam, WA

Fetch only soil erosion extreme conditions for Northam, WA. The documentation for get_dpird_extremes() contains a full listing of the values that are available to query from this API endpoint.

library(weatherOz)

(
  extremes <- get_dpird_extremes(
    station_code = "NO",
    values = "erosionCondition"
  )
)
#> Key: <station_code>
#>    station_code longitude  latitude erosion_condition_since12_am_minutes erosion_condition_since12_am_start_time
#>          <fctr>     <num>     <num>                                <int>                                  <POSc>
#> 1:           NO  116.6942 -31.65161                                    0                                    <NA>
#>    erosion_condition_last7_days_minutes erosion_condition_last7_days_days erosion_condition_last14_days_minutes
#>                                   <int>                             <int>                                 <int>
#> 1:                                    0                                 0                                     0
#>    erosion_condition_last14_days_days erosion_condition_month_to_date_minutes
#>                                 <int>                                   <int>
#> 1:                                  0                                       2
#>    erosion_condition_month_to_date_start_time erosion_condition_month_to_date_days
#>                                        <POSc>                                <int>
#> 1:                        2024-10-01 12:27:00                                    1
#>    erosion_condition_year_to_date_minutes erosion_condition_year_to_date_start_time
#>                                     <int>                                    <POSc>
#> 1:                                     45                       2024-01-13 19:11:00
#>    erosion_condition_year_to_date_days
#>                                  <int>
#> 1:                                   7

Getting Minute Data

This function fetches nicely formatted minute weather station data from the DPIRD Weather 2.0 API for a maximum 24-hour period. You must provide a station_code and API_key, the other arguments, start_date_time, minutes and values are optional.

Available Values for Minute Data

  • all (which will return all of the following values),
  • airTemperature,
  • dateTime,
  • dewPoint,
  • rainfall,
  • relativeHumidity,
  • soilTemperature,
  • solarIrradiance,
  • wetBulb,
  • wind,
  • windAvgSpeed,
  • windMaxSpeed, and
  • windMinSpeed

Example 3: Get All Minute Data for the Past 24 Hours

library(weatherOz)

(
  min_dat <- get_dpird_minute(
    station_code = "NO"
  )
)
#> Key: <station_code>
#>       station_code           date_time air_temperature relative_humidity soil_temperature solar_irradiance
#>             <fctr>              <POSc>           <num>             <num>            <num>            <int>
#>    1:           NO 2024-10-20 11:02:00            24.0              43.1             27.8              564
#>    2:           NO 2024-10-20 11:03:00            24.0              43.0             27.8              638
#>    3:           NO 2024-10-20 11:04:00            24.0              42.6             27.8              631
#>    4:           NO 2024-10-20 11:05:00            23.9              42.7             27.8              619
#>    5:           NO 2024-10-20 11:06:00            23.7              42.6             27.8              665
#>   ---                                                                                                     
#> 1430:           NO 2024-10-21 10:51:00            19.0              35.9             25.5             1178
#> 1431:           NO 2024-10-21 10:52:00            18.6              35.5             25.5             1140
#> 1432:           NO 2024-10-21 10:53:00            18.3              37.2             25.5             1250
#> 1433:           NO 2024-10-21 10:54:00            18.7              37.9             25.5             1248
#> 1434:           NO 2024-10-21 10:55:00            19.4              35.3             25.5             1249
#>       rainfall dew_point wet_bulb wind_height wind_avg_speed wind_avg_direction_compass_point
#>          <int>     <num>    <num>       <int>          <num>                           <char>
#>    1:        0      10.7     16.7           3           9.72                               NW
#>    2:        0      10.7     16.7           3           9.22                                W
#>    3:        0      10.5     16.6           3           7.70                                W
#>    4:        0      10.5     16.6           3           8.21                                W
#>    5:        0      10.2     16.4           3           9.22                              WSW
#>   ---                                                                                        
#> 1430:        0       3.6     11.7           3           5.69                              WNW
#> 1431:        0       3.1     11.3           3           7.70                              WSW
#> 1432:        0       3.5     11.3           3           9.72                               NW
#> 1433:        0       4.1     11.7           3           6.19                              WNW
#> 1434:        0       3.7     11.9           3           8.21                              WNW
#>       wind_avg_direction_degrees wind_min_speed wind_max_speed
#>                            <int>          <num>          <num>
#>    1:                        304          5.688          14.72
#>    2:                        263          4.176          12.71
#>    3:                        280          3.672          12.20
#>    4:                        260          6.696          16.74
#>    5:                        252          6.192          16.74
#>   ---                                                         
#> 1430:                        295          3.168           8.71
#> 1431:                        255          2.160          12.20
#> 1432:                        306          4.176          18.25
#> 1433:                        300          3.168           9.22
#> 1434:                        290          4.680          11.74

Example 4: Get Specific Time and Date Data for Specific Values

If you wish to supply a specific start date and time and values, you may do so as shown here.

library(weatherOz)

(
  min_dat_t_rad_wind <- get_dpird_minute(
    station_code = "NO",
    start_date_time = "2023-02-01 13:00:00",
    minutes = 1440,
    values = c("airTemperature",
               "solarIrradiance",
               "wind")
  )
)
#> Key: <station_code>
#>       station_code           date_time air_temperature solar_irradiance wind_height wind_avg_speed
#>             <fctr>              <POSc>           <num>            <int>       <int>          <num>
#>    1:           NO 2023-02-01 13:00:00            29.7             1087           3          11.66
#>    2:           NO 2023-02-01 13:00:50            29.4             1086           3          10.80
#>    3:           NO 2023-02-01 13:01:40            29.5             1084           3          11.81
#>    4:           NO 2023-02-01 13:02:30            29.5             1084           3          12.71
#>    5:           NO 2023-02-01 13:03:20            29.6             1084           3          12.96
#>   ---                                                                                             
#> 1436:           NO 2023-02-02 12:55:00            30.2             1105           3           9.54
#> 1437:           NO 2023-02-02 12:55:50            30.1             1104           3           9.90
#> 1438:           NO 2023-02-02 12:56:40            30.0             1102           3          13.03
#> 1439:           NO 2023-02-02 12:57:30            29.9             1102           3          10.91
#> 1440:           NO 2023-02-02 12:58:20            30.1             1104           3          10.40
#>       wind_avg_direction_compass_point wind_avg_direction_degrees wind_min_speed wind_max_speed
#>                                 <char>                      <int>          <num>          <num>
#>    1:                               SE                        139          4.176          26.82
#>    2:                               SE                        136          4.176          19.26
#>    3:                              SSE                        156          6.696          19.26
#>    4:                               SE                        133          6.696          26.82
#>    5:                               SE                        139          6.696          19.26
#>   ---                                                                                          
#> 1436:                              ESE                        112          4.176          16.74
#> 1437:                              ESE                        120          4.176          19.26
#> 1438:                              ESE                        121          4.176          24.30
#> 1439:                                E                         93          6.696          21.78
#> 1440:                                E                         97          4.176          16.74

Getting Summary Data

The function, get_dpird_summary(), fetches nicely formatted minute weather station data from the DPIRD Weather 2.0 API for a maximum 24-hour period. You must provide a station_code and API_key, the other arguments, start_date_time, minutes and values are optional.

Available Values for Summary Data

  • all (which will return all of the following values),
  • airTemperature,
  • airTemperatureAvg,
  • airTemperatureMax,
  • airTemperatureMaxTime,
  • airTemperatureMin,
  • airTemperatureMinTime,
  • apparentAirTemperature,
  • apparentAirTemperatureAvg,
  • apparentAirTemperatureMax,
  • apparentAirTemperatureMaxTime,
  • apparentAirTemperatureMin,
  • apparentAirTemperatureMinTime,
  • barometricPressure,
  • barometricPressureAvg,
  • barometricPressureMax,
  • barometricPressureMaxTime,
  • barometricPressureMin,
  • barometricPressureMinTime,
  • battery,
  • batteryMinVoltage,
  • batteryMinVoltageDateTime,
  • chillHours,
  • deltaT,
  • deltaTAvg,
  • deltaTMax,
  • deltaTMaxTime,
  • deltaTMin,
  • deltaTMinTime,
  • dewPoint,
  • dewPointAvg,
  • dewPointMax,
  • dewPointMaxTime,
  • dewPointMin,
  • dewPointMinTime,
  • erosionCondition,
  • erosionConditionMinutes,
  • erosionConditionStartTime,
  • errors,
  • etoShortCrop,
  • etoTallCrop,
  • evapotranspiration,
  • frostCondition,
  • frostConditionMinutes,
  • frostConditionStartTime,
  • heatCondition,
  • heatConditionMinutes,
  • heatConditionStartTime,
  • observations,
  • observationsCount,
  • observationsPercentage,
  • panEvaporation,
  • rainfall,
  • relativeHumidity,
  • relativeHumidityAvg,
  • relativeHumidityMax,
  • relativeHumidityMaxTime,
  • relativeHumidityMin,
  • relativeHumidityMinTime,
  • richardsonUnits,
  • soilTemperature,
  • soilTemperatureAvg,
  • soilTemperatureMax,
  • soilTemperatureMaxTime,
  • soilTemperatureMin,
  • soilTemperatureMinTime,
  • solarExposure,
  • wetBulb,
  • wetBulbAvg,
  • wetBulbMax,
  • wetBulbMaxTime,
  • wetBulbMin,
  • wetBulbMinTime,
  • wind,
  • windAvgSpeed, and
  • windMaxSpeed

What You Get Back

This function returns a data.table with station_code and the date interval queried together with the requested weather variables in alphabetical order. Please note this function converts date-time columns from Coordinated Universal Time ‘UTC’} to Australian Western Standard Time ‘AWST’. The first ten columns will always be:

  • station_code,
  • station_name,
  • longitude,
  • latitude,
  • year,
  • month,
  • day,
  • hour,
  • minute, and if month or finer is present,
  • date (a combination of year, month, day, hour, minute as appropriate)

Example 5: Get Annual Rainfall Since 2017

Use the default value for end date (current system date) to get annual rainfall since 2017 until current year for Capel.

library(weatherOz)

(
  annual_rain <- get_dpird_summaries(
    station_code = "CL001",
    start_date = "20170101",
    interval = "yearly",
    values = "rainfall"
  )
)
#> Key: <station_code>
#>    station_code station_name longitude  latitude  year rainfall
#>          <fctr>       <char>     <num>     <num> <int>    <num>
#> 1:        CL001        Capel  115.6376 -33.61576  2017    711.4
#> 2:        CL001        Capel  115.6376 -33.61576  2018    822.0
#> 3:        CL001        Capel  115.6376 -33.61576  2019    660.6
#> 4:        CL001        Capel  115.6376 -33.61576  2020    862.4
#> 5:        CL001        Capel  115.6376 -33.61576  2021    928.0
#> 6:        CL001        Capel  115.6376 -33.61576  2022    670.4
#> 7:        CL001        Capel  115.6376 -33.61576  2023    570.0
#> 8:        CL001        Capel  115.6376 -33.61576  2024    757.0

Example 6: Get Monthly Rainfall Since 2017

Use the default value for end date (current system date) to get monthly rainfall since 2017 until current year for Capel.

library(weatherOz)

(
  monthly_rain <- get_dpird_summaries(
    station_code = "CL001",
    start_date = "20170101",
    interval = "monthly",
    values = "rainfall"
  )
)
#> Key: <station_code>
#>     station_code station_name longitude  latitude  year month       date rainfall
#>           <fctr>       <char>     <num>     <num> <int> <int>     <Date>    <num>
#>  1:        CL001        Capel  115.6376 -33.61576  2017     1 2017-01-01      0.0
#>  2:        CL001        Capel  115.6376 -33.61576  2017     2 2017-02-01      0.0
#>  3:        CL001        Capel  115.6376 -33.61576  2017     3 2017-03-01     59.6
#>  4:        CL001        Capel  115.6376 -33.61576  2017     4 2017-04-01      0.0
#>  5:        CL001        Capel  115.6376 -33.61576  2017     5 2017-05-01     84.0
#>  6:        CL001        Capel  115.6376 -33.61576  2017     6 2017-06-01     57.8
#>  7:        CL001        Capel  115.6376 -33.61576  2017     7 2017-07-01    194.4
#>  8:        CL001        Capel  115.6376 -33.61576  2017     8 2017-08-01    175.8
#>  9:        CL001        Capel  115.6376 -33.61576  2017     9 2017-09-01     49.8
#> 10:        CL001        Capel  115.6376 -33.61576  2017    10 2017-10-01     34.0
#> 11:        CL001        Capel  115.6376 -33.61576  2017    11 2017-11-01     14.2
#> 12:        CL001        Capel  115.6376 -33.61576  2017    12 2017-12-01     41.8
#> 13:        CL001        Capel  115.6376 -33.61576  2018     1 2018-01-01     14.4
#> 14:        CL001        Capel  115.6376 -33.61576  2018     2 2018-02-01      0.2
#> 15:        CL001        Capel  115.6376 -33.61576  2018     3 2018-03-01     15.4
#> 16:        CL001        Capel  115.6376 -33.61576  2018     4 2018-04-01     42.8
#> 17:        CL001        Capel  115.6376 -33.61576  2018     5 2018-05-01    115.2
#> 18:        CL001        Capel  115.6376 -33.61576  2018     6 2018-06-01    168.8
#> 19:        CL001        Capel  115.6376 -33.61576  2018     7 2018-07-01    214.6
#> 20:        CL001        Capel  115.6376 -33.61576  2018     8 2018-08-01    156.8
#> 21:        CL001        Capel  115.6376 -33.61576  2018     9 2018-09-01     29.6
#> 22:        CL001        Capel  115.6376 -33.61576  2018    10 2018-10-01     45.8
#> 23:        CL001        Capel  115.6376 -33.61576  2018    11 2018-11-01     11.2
#> 24:        CL001        Capel  115.6376 -33.61576  2018    12 2018-12-01      7.2
#> 25:        CL001        Capel  115.6376 -33.61576  2019     1 2019-01-01      6.0
#> 26:        CL001        Capel  115.6376 -33.61576  2019     2 2019-02-01      0.0
#> 27:        CL001        Capel  115.6376 -33.61576  2019     3 2019-03-01     29.4
#> 28:        CL001        Capel  115.6376 -33.61576  2019     4 2019-04-01     33.0
#> 29:        CL001        Capel  115.6376 -33.61576  2019     5 2019-05-01     27.0
#> 30:        CL001        Capel  115.6376 -33.61576  2019     6 2019-06-01    239.6
#> 31:        CL001        Capel  115.6376 -33.61576  2019     7 2019-07-01     85.4
#> 32:        CL001        Capel  115.6376 -33.61576  2019     8 2019-08-01    117.8
#> 33:        CL001        Capel  115.6376 -33.61576  2019     9 2019-09-01     45.8
#> 34:        CL001        Capel  115.6376 -33.61576  2019    10 2019-10-01     67.0
#> 35:        CL001        Capel  115.6376 -33.61576  2019    11 2019-11-01      7.8
#> 36:        CL001        Capel  115.6376 -33.61576  2019    12 2019-12-01      1.8
#> 37:        CL001        Capel  115.6376 -33.61576  2020     1 2020-01-01      2.0
#> 38:        CL001        Capel  115.6376 -33.61576  2020     2 2020-02-01     31.8
#> 39:        CL001        Capel  115.6376 -33.61576  2020     3 2020-03-01     40.8
#> 40:        CL001        Capel  115.6376 -33.61576  2020     4 2020-04-01     41.6
#> 41:        CL001        Capel  115.6376 -33.61576  2020     5 2020-05-01    156.2
#> 42:        CL001        Capel  115.6376 -33.61576  2020     6 2020-06-01    132.4
#> 43:        CL001        Capel  115.6376 -33.61576  2020     7 2020-07-01    125.8
#> 44:        CL001        Capel  115.6376 -33.61576  2020     8 2020-08-01     96.0
#> 45:        CL001        Capel  115.6376 -33.61576  2020     9 2020-09-01    110.0
#> 46:        CL001        Capel  115.6376 -33.61576  2020    10 2020-10-01     32.6
#> 47:        CL001        Capel  115.6376 -33.61576  2020    11 2020-11-01     88.0
#> 48:        CL001        Capel  115.6376 -33.61576  2020    12 2020-12-01      5.2
#> 49:        CL001        Capel  115.6376 -33.61576  2021     1 2021-01-01      0.0
#> 50:        CL001        Capel  115.6376 -33.61576  2021     2 2021-02-01     76.2
#> 51:        CL001        Capel  115.6376 -33.61576  2021     3 2021-03-01     27.4
#> 52:        CL001        Capel  115.6376 -33.61576  2021     4 2021-04-01     92.0
#> 53:        CL001        Capel  115.6376 -33.61576  2021     5 2021-05-01    160.6
#> 54:        CL001        Capel  115.6376 -33.61576  2021     6 2021-06-01     81.2
#> 55:        CL001        Capel  115.6376 -33.61576  2021     7 2021-07-01    187.6
#> 56:        CL001        Capel  115.6376 -33.61576  2021     8 2021-08-01     90.4
#> 57:        CL001        Capel  115.6376 -33.61576  2021     9 2021-09-01     93.4
#> 58:        CL001        Capel  115.6376 -33.61576  2021    10 2021-10-01    109.4
#> 59:        CL001        Capel  115.6376 -33.61576  2021    11 2021-11-01      5.4
#> 60:        CL001        Capel  115.6376 -33.61576  2021    12 2021-12-01      4.4
#> 61:        CL001        Capel  115.6376 -33.61576  2022     1 2022-01-01      0.0
#> 62:        CL001        Capel  115.6376 -33.61576  2022     2 2022-02-01      4.4
#> 63:        CL001        Capel  115.6376 -33.61576  2022     3 2022-03-01      4.6
#> 64:        CL001        Capel  115.6376 -33.61576  2022     4 2022-04-01     44.0
#> 65:        CL001        Capel  115.6376 -33.61576  2022     5 2022-05-01    105.6
#> 66:        CL001        Capel  115.6376 -33.61576  2022     6 2022-06-01    103.8
#> 67:        CL001        Capel  115.6376 -33.61576  2022     7 2022-07-01    169.0
#> 68:        CL001        Capel  115.6376 -33.61576  2022     8 2022-08-01    121.4
#> 69:        CL001        Capel  115.6376 -33.61576  2022     9 2022-09-01     69.4
#> 70:        CL001        Capel  115.6376 -33.61576  2022    10 2022-10-01     29.0
#> 71:        CL001        Capel  115.6376 -33.61576  2022    11 2022-11-01     18.0
#> 72:        CL001        Capel  115.6376 -33.61576  2022    12 2022-12-01      1.2
#> 73:        CL001        Capel  115.6376 -33.61576  2023     1 2023-01-01      0.8
#> 74:        CL001        Capel  115.6376 -33.61576  2023     2 2023-02-01      0.0
#> 75:        CL001        Capel  115.6376 -33.61576  2023     3 2023-03-01     27.8
#> 76:        CL001        Capel  115.6376 -33.61576  2023     4 2023-04-01     81.2
#> 77:        CL001        Capel  115.6376 -33.61576  2023     5 2023-05-01     31.8
#> 78:        CL001        Capel  115.6376 -33.61576  2023     6 2023-06-01    130.0
#> 79:        CL001        Capel  115.6376 -33.61576  2023     7 2023-07-01    123.2
#> 80:        CL001        Capel  115.6376 -33.61576  2023     8 2023-08-01     74.8
#> 81:        CL001        Capel  115.6376 -33.61576  2023     9 2023-09-01     80.2
#> 82:        CL001        Capel  115.6376 -33.61576  2023    10 2023-10-01     17.2
#> 83:        CL001        Capel  115.6376 -33.61576  2023    11 2023-11-01      2.4
#> 84:        CL001        Capel  115.6376 -33.61576  2023    12 2023-12-01      0.6
#> 85:        CL001        Capel  115.6376 -33.61576  2024     1 2024-01-01      1.4
#> 86:        CL001        Capel  115.6376 -33.61576  2024     2 2024-02-01      0.6
#> 87:        CL001        Capel  115.6376 -33.61576  2024     3 2024-03-01      0.2
#> 88:        CL001        Capel  115.6376 -33.61576  2024     4 2024-04-01      0.0
#> 89:        CL001        Capel  115.6376 -33.61576  2024     5 2024-05-01     60.6
#> 90:        CL001        Capel  115.6376 -33.61576  2024     6 2024-06-01    202.2
#> 91:        CL001        Capel  115.6376 -33.61576  2024     7 2024-07-01    182.8
#> 92:        CL001        Capel  115.6376 -33.61576  2024     8 2024-08-01    226.8
#> 93:        CL001        Capel  115.6376 -33.61576  2024     9 2024-09-01     34.0
#> 94:        CL001        Capel  115.6376 -33.61576  2024    10 2024-10-01     48.4
#>     station_code station_name longitude  latitude  year month       date rainfall

Example 7: Get Daily Rainfall and Wind From Beginning of 2017 to End of 2018

Use the default value for end date (current system date) to get daily rainfall and wind records from 2017-01-01 to 2018-12-31 for Binnu. Note that the Binnu station has two wind heights, 3m and 10m.

library(weatherOz)

(
  daily_wind_rain <- get_dpird_summaries(
    station_code = "BI",
    start_date = "20170101",
    end_date = "2018-12-31",
    interval = "daily",
    values = c("rainfall",
               "wind")
  )
)
#> Key: <station_code>
#>       station_code station_name longitude latitude  year month   day       date rainfall wind_avg_speed
#>             <fctr>       <char>     <num>    <num> <int> <int> <int>     <Date>    <num>          <num>
#>    1:           BI        Binnu  114.6958  -28.051  2017     1     1 2017-01-01        0          17.61
#>    2:           BI        Binnu  114.6958  -28.051  2017     1     1 2017-01-01        0          20.25
#>    3:           BI        Binnu  114.6958  -28.051  2017     1     2 2017-01-02        0          23.30
#>    4:           BI        Binnu  114.6958  -28.051  2017     1     2 2017-01-02        0          25.59
#>    5:           BI        Binnu  114.6958  -28.051  2017     1     3 2017-01-03        0          16.89
#>   ---                                                                                                  
#> 1456:           BI        Binnu  114.6958  -28.051  2018    12    29 2018-12-29        0          26.38
#> 1457:           BI        Binnu  114.6958  -28.051  2018    12    30 2018-12-30        0          17.37
#> 1458:           BI        Binnu  114.6958  -28.051  2018    12    30 2018-12-30        0          19.32
#> 1459:           BI        Binnu  114.6958  -28.051  2018    12    31 2018-12-31        0          22.30
#> 1460:           BI        Binnu  114.6958  -28.051  2018    12    31 2018-12-31        0          24.58
#>       wind_height wind_max_direction_compass_point wind_max_direction_degrees wind_max_speed       wind_max_time
#>             <int>                           <char>                      <int>          <num>              <POSc>
#>    1:           3                               SW                        220          42.73 2017-01-01 17:56:00
#>    2:           3                              SSW                        200          42.73 2018-01-01 17:25:00
#>    3:          10                              ESE                        104          46.30 2017-01-01 08:08:00
#>    4:          10                              SSW                        208          44.64 2018-01-01 17:42:00
#>    5:           3                              SSW                        198          47.77 2017-01-02 17:02:00
#>   ---                                                                                                           
#> 1456:          10                              SSW                        193          50.15 2018-12-30 16:13:00
#> 1457:           3                              SSW                        201          47.77 2017-12-31 16:41:00
#> 1458:           3                              SSW                        196          41.90 2018-12-31 17:13:00
#> 1459:          10                              SSW                        198          51.73 2017-12-31 16:19:00
#> 1460:          10                              SSW                        197          44.78 2018-12-31 18:12:00

Example 8: Get Hourly Rainfall and Wind From Beginning of 2022 to Current

Use the default value for end date (current system date) to get hourly rainfall and wind records from 2022-01-01 to Current Date for Binnu. Note that the Binnu station has two wind heights, 3m and 10m.

library(weatherOz)

(
  hourly_wind_rain <- get_dpird_summaries(
    station_code = "BI",
    start_date = "20220101",
    interval = "hourly",
    values = c("rainfall",
               "wind")
  )
)
#> Key: <station_code>
#>        station_code station_name longitude latitude  year month   day  hour                date rainfall
#>              <fctr>       <char>     <num>    <num> <int> <int> <int> <int>              <POSc>    <num>
#>     1:           BI        Binnu  114.6958  -28.051  2022     1     1     0 2022-01-01 00:00:00      0.0
#>     2:           BI        Binnu  114.6958  -28.051  2022     1     1     0 2022-01-01 00:00:00      0.0
#>     3:           BI        Binnu  114.6958  -28.051  2022     1     1     1 2022-01-01 01:00:00      0.0
#>     4:           BI        Binnu  114.6958  -28.051  2022     1     1     1 2022-01-01 01:00:00      0.0
#>     5:           BI        Binnu  114.6958  -28.051  2022     1     1     2 2022-01-01 02:00:00      0.0
#>    ---                                                                                                  
#> 49150:           BI        Binnu  114.6958  -28.051  2024    10    20    22 2024-10-20 22:00:00      0.0
#> 49151:           BI        Binnu  114.6958  -28.051  2024    10    20    23 2024-10-20 23:00:00      0.0
#> 49152:           BI        Binnu  114.6958  -28.051  2024    10    20    23 2024-10-20 23:00:00      0.0
#> 49153:           BI        Binnu  114.6958  -28.051  2024    10    21     0 2024-10-21 00:00:00      0.2
#> 49154:           BI        Binnu  114.6958  -28.051  2024    10    21     0 2024-10-21 00:00:00      0.2
#>        wind_avg_direction_compass_point wind_avg_direction_degrees wind_avg_speed wind_height
#>                                  <char>                      <int>          <num>       <int>
#>     1:                                S                        190          16.66           3
#>     2:                                E                         97          16.36          10
#>     3:                                S                        189          22.23          10
#>     4:                              ESE                        102          11.37           3
#>     5:                                S                        190          22.65           3
#>    ---                                                                                       
#> 49150:                              SSW                        202          19.56          10
#> 49151:                              ESE                        107          15.94          10
#> 49152:                              SSW                        201          15.56           3
#> 49153:                                E                        101           9.98           3
#> 49154:                              SSW                        193          21.49          10
#>        wind_max_direction_compass_point wind_max_direction_degrees wind_max_speed       wind_max_time
#>                                  <char>                      <int>          <num>              <POSc>
#>     1:                                S                        184          30.13 2021-12-31 23:58:00
#>     2:                                E                         99          20.23 2023-05-27 23:55:00
#>     3:                                S                        180          32.08 2021-12-31 23:58:00
#>     4:                                E                         99          17.57 2023-05-28 00:44:00
#>     5:                              SSW                        192          32.65 2022-01-01 00:29:00
#>    ---                                                                                               
#> 49150:                              SSW                        206          33.12 2024-10-20 22:09:00
#> 49151:                                E                         97          21.46 2023-05-27 22:41:00
#> 49152:                              SSW                        196          29.16 2024-10-21 00:00:00
#> 49153:                                E                         98          15.88 2023-05-27 23:25:00
#> 49154:                              SSW                        198          42.41 2024-10-20 23:57:00

Getting APSIM-ready Data

For work with APSIM, you can use get_dpird_apsim() to get an object of DPIRD weather data in your R session that’s ready for saving using write_apsim_met(), which is re-exported from the CRAN package [apsimx] for your convenience. This function only needs the station_code, start_date, end_date and your api_key values to return the necessary values.

What You Get Back

An object of {apsimx} ‘met’ class, compatible with a data.frame, that has daily data that include year, day, radiation, max temperature, min temperature, rainfall, relative humidity, evaporation and windspeed.

Example 9: Get APSIM Formatted Data for Binnu From 2022-04-01 to 2022-11-01

library(weatherOz)

(
  binnu <- get_dpird_apsim(
    station_code = "BI",
    start_date = "20220101",
    end_date = "20221231"
  )
)
#> weather.met.met 
#> site = Binnu 
#> latitude = -28.051 
#> longitude = 114.69575 
#> tav = 20.5987671232877 (oC) ! calculated annual average ambient temperature 2024-10-21 11:02:58.339889 
#> amp = 15.3 !calculated with the apsimx R package: 2024-10-21 11:02:58.3442 
#> year day radn maxt mint rain evap rh windspeed 
#> () () (MJ/m2/day) (oC) (oC) (mm) (mm) (%) (m/s) 
#>   year day    radn maxt mint rain evap   rh windspeed
#> 1 2022   1 33137.3 35.3 18.5 10.6    0 63.9     20.52
#> 2 2022   2 33419.1 38.3 15.2 11.1    0 54.6     15.03
#> 3 2022   3 33467.9 34.8 17.1 11.0    0 65.6     18.62
#> 4 2022   4 32784.2 39.9 17.6 11.2    0 64.2     18.44
#> 5 2022   5 32981.1 45.7 19.1 14.4    0 37.1     18.09
#> 6 2022   6 33182.6 39.1 18.3 11.3    0 60.5     18.37
#> Warning in check_apsim_met(x): Radiation is greater than 40 (MJ/m2/day)
#> weather.met.met 
#> site = Binnu 
#> latitude = -28.051 
#> longitude = 114.69575 
#> tav = 20.5987671232877 (oC) ! calculated annual average ambient temperature 2024-10-21 11:02:58.339889 
#> amp = 15.3 !calculated with the apsimx R package: 2024-10-21 11:02:58.3442 
#> year day radn maxt mint rain evap rh windspeed 
#> () () (MJ/m2/day) (oC) (oC) (mm) (mm) (%) (m/s) 
#>   year day    radn maxt mint rain evap   rh windspeed
#> 1 2022   1 33137.3 35.3 18.5 10.6    0 63.9     20.52
#> 2 2022   2 33419.1 38.3 15.2 11.1    0 54.6     15.03
#> 3 2022   3 33467.9 34.8 17.1 11.0    0 65.6     18.62
#> 4 2022   4 32784.2 39.9 17.6 11.2    0 64.2     18.44
#> 5 2022   5 32981.1 45.7 19.1 14.4    0 37.1     18.09
#> 6 2022   6 33182.6 39.1 18.3 11.3    0 60.5     18.37

Working With DPIRD Metadata

Three functions are provided to assist in fetching metadata about the stations.

  • find_nearby_stations(), which returns a data.table with the nearest weather stations to a given geographic point or known station in either the DPIRD or BOM (from SILO) networks.
  • find_stations_in(), which returns a data.table with the weather stations falling within a given geographic area in either the DPIRD or BOM (from SILO) networks.
  • get_dpird_availability(), which returns a data.table with the availability for weather stations in the DPIRD network providing the up time and data availability for a given period of time.
  • get_stations_metadata(), which returns a data.table with the latest and most up-to-date information available from the Weather 2.0 API on the stations’ geographic locations, hardware details, e.g., wind mast height, and recording capabilities.

Finding Nearby Stations

Example 10: Finding Stations Nearby a Known Station

Query WA only stations and return DPIRD’s stations nearest to the Northam, WA station, “NO”, returning stations with 50 km of this station.

library(weatherOz)

(
  wa_stn <- find_nearby_stations(
    station_code = "NO",
    distance_km = 50,
    which_api = "dpird"
  )
)
#>    station_code       station_name longitude  latitude  state elev_m
#>          <fctr>             <char>     <num>     <num> <char>  <int>
#> 1:           NO            Northam  116.6942 -31.65161     WA    163
#> 2:           MK             Muresk  116.6913 -31.72772     WA    251
#> 3:        YE001          York East  116.9211 -31.83588     WA    229
#> 4:         BTSB DFES-B Talbot West  116.6898 -31.96060     WA    352
#>                                                                   owner distance_km
#>                                                                  <char>       <num>
#> 1: WA Department of Primary Industries and Regional Development (DPIRD)        0.00
#> 2: WA Department of Primary Industries and Regional Development (DPIRD)        7.62
#> 3: WA Department of Primary Industries and Regional Development (DPIRD)       29.23
#> 4:                  WA Department of Fire and Emergency Services (DFES)       30.90

Example 11: Finding Stations Nearby a Given Longitude and Latitude

Using the longitude and latitude for Northam, WA, find all DPIRD stations within a 50km radius of this geographic point.

library(weatherOz)

(
  wa_stn_lonlat <- find_nearby_stations(
    longitude = 116.6620,
    latitude = -31.6540,
    distance_km = 50,
    which_api = "dpird"
  )
)
#>    station_code       station_name longitude  latitude  state elev_m
#>          <fctr>             <char>     <num>     <num> <char>  <int>
#> 1:           NO            Northam  116.6942 -31.65161     WA    163
#> 2:           MK             Muresk  116.6913 -31.72772     WA    251
#> 3:         BTSB DFES-B Talbot West  116.6898 -31.96060     WA    352
#> 4:        YE001          York East  116.9211 -31.83588     WA    229
#>                                                                   owner distance_km
#>                                                                  <char>       <num>
#> 1: WA Department of Primary Industries and Regional Development (DPIRD)        3.23
#> 2: WA Department of Primary Industries and Regional Development (DPIRD)        7.93
#> 3:                  WA Department of Fire and Emergency Services (DFES)       30.79
#> 4: WA Department of Primary Industries and Regional Development (DPIRD)       31.65

Example 12: Finding Stations in Both the DPIRD and SILO Data Sets

Query stations nearest DPIRD’s Northam, WA station, “NO” and return both DPIRD and SILO/BOM stations within 50 km of this station.

library(weatherOz)

(
  wa_stn_all <- find_nearby_stations(
    station_code = "NO",
    distance_km = 50,
    which_api = "all"
  )
)
#>     station_code       station_name longitude  latitude  state elev_m
#>           <fctr>             <char>     <num>     <num> <char>  <num>
#>  1:           NO            Northam  116.6942 -31.65161     WA    163
#>  2:       010111            Northam  116.6586 -31.65080     WA    170
#>  3:           MK             Muresk  116.6913 -31.72772     WA    251
#>  4:       010150       Grass Valley  116.7969 -31.63580     WA    200
#>  5:       010152   Muresk Institute  116.6833 -31.75000     WA    166
#>  6:       010115        Quellington  116.8647 -31.77140     WA    220
#>  7:       010125            Toodyay  116.4703 -31.55170     WA    140
#>  8:       010244        Bakers Hill  116.4561 -31.74690     WA    330
#>  9:       010311               York  116.7650 -31.89970     WA    179
#> 10:       010023     Warradong Farm  116.9411 -31.50030     WA    240
#> 11:        YE001          York East  116.9211 -31.83588     WA    229
#> 12:       010091          Meckering  117.0081 -31.63220     WA    195
#> 13:         BTSB DFES-B Talbot West  116.6898 -31.96060     WA    352
#> 14:       010138           Wooroloo  116.3413 -31.81500     WA    277
#> 15:       010058         Goomalling  116.8269 -31.29940     WA    239
#> 16:       010134          Wattening  116.5150 -31.31190     WA    240
#> 17:       010165        Green Hills  116.9839 -31.94080     WA    244
#> 18:       010163             Jaroma  117.1433 -31.77060     WA    265
#> 19:       010009            Bolgart  116.5092 -31.27440     WA    240
#> 20:       010160        Quella Park  117.1194 -31.45330     WA    265
#> 21:       009007            Chidlow  116.2658 -31.86220     WA    300
#> 22:       010120       Doodenanning  117.0986 -31.90920     WA    290
#> 23:       009066        Gidgegannup  116.1976 -31.79060     WA    290
#>     station_code       station_name longitude  latitude  state elev_m
#>                                                                    owner distance_km
#>                                                                   <char>       <num>
#>  1: WA Department of Primary Industries and Regional Development (DPIRD)    0.000000
#>  2:                                                                  BOM    3.369959
#>  3: WA Department of Primary Industries and Regional Development (DPIRD)    7.620000
#>  4:                                                                  BOM    9.878912
#>  5:                                                                  BOM   10.986728
#>  6:                                                                  BOM   20.914807
#>  7:                                                                  BOM   23.934879
#>  8:                                                                  BOM   24.889495
#>  9:                                                                  BOM   28.381350
#> 10:                                                                  BOM   28.808439
#> 11: WA Department of Primary Industries and Regional Development (DPIRD)   29.230000
#> 12:                                                                  BOM   29.790490
#> 13:                  WA Department of Fire and Emergency Services (DFES)   30.900000
#> 14:                                                                  BOM   37.993263
#> 15:                                                                  BOM   41.128932
#> 16:                                                                  BOM   41.412805
#> 17:                                                                  BOM   42.226585
#> 18:                                                                  BOM   44.489821
#> 19:                                                                  BOM   45.457855
#> 20:                                                                  BOM   45.923973
#> 21:                                                                  BOM   46.778842
#> 22:                                                                  BOM   47.759247
#> 23:                                                                  BOM   49.440793
#>                                                                    owner distance_km

Example 13: Finding Stations in the Southwest Agriculture Region of Western Australia

Using find_stations_in() is different than find_nearby_stations() as it finds any stations that fall within a boundary that you provide rather than using a single point to search from. For detailed examples using named places or bounding boxes, see the “weatherOz for SILO” vignette.

The {sf} object, south_west_agricultural_region, is provided with {weatherOz} under the CC BY 4.0 Licence from the Department of Primary Industries and Regional Development (DPIRD), so we can extract stations within this area of Western Australia.

First, we can plot the south_west_agricultural_region to see what it looks like.

library(weatherOz)
library(ggplot2)
library(ggthemes)
library(sf)
#> Linking to GEOS 3.11.0, GDAL 3.5.3, PROJ 9.1.0; sf_use_s2() is TRUE

ggplot(south_west_agricultural_region) +
   geom_sf() +
   theme_map()
plot of chunk view_sw_ag_region

plot of chunk view_sw_ag_region

Now we can use that to find stations that fall only within that part of Western Australia. We’ll use the coordinate reference system (CRS) provided by this {sf} object and find all stations, including those that have closed.

sw_wa <- find_stations_in(
  x = south_west_agricultural_region,
  include_closed = TRUE,
  crs = sf::st_crs(south_west_agricultural_region)
)

sw_wa
#>       station_code              station_name      start        end  latitude longitude  state elev_m
#>             <fctr>                    <char>     <Date>     <Date>     <num>     <num> <char>  <num>
#>    1:       009804                     Adina 1969-01-01 2024-10-21 -33.88110  122.2167     WA     60
#>    2:       008000                     Ajana 1917-01-01 2024-10-21 -27.96070  114.6336     WA    210
#>    3:       009500                    Albany 1877-01-01 2024-10-21 -35.02890  117.8808     WA      3
#>    4:       009741 Albany Airport Comparison 1942-01-01 2014-01-01 -34.94140  117.8022     WA     68
#>    5:       010501     Aldersyde Post Office 1909-01-01 1976-01-01 -32.36670  117.2833     WA     NA
#>   ---                                                                                               
#> 1033:       008146                  Ytiniche 1913-01-01 2024-10-21 -30.07060  116.2092     WA    300
#> 1034:       008147                      Yuna 1909-01-01 2024-10-21 -28.32500  114.9589     WA    270
#> 1035:        YU001                      Yuna 2012-06-21 2024-10-21 -28.33763  114.9898     WA    329
#> 1036:        YU002                   Yuna NE 2016-03-24 2024-10-21 -28.20032  115.2616     WA    267
#> 1037:        YU003                Yuna North 2018-08-08 2024-10-21 -28.12086  114.9626     WA    264
#>                                                                     source status   wmo
#>                                                                     <char> <char> <num>
#>    1:                                          Bureau of Meteorology (BOM)   open    NA
#>    2:                                          Bureau of Meteorology (BOM)   open    NA
#>    3:                                          Bureau of Meteorology (BOM)   open 94801
#>    4:                                          Bureau of Meteorology (BOM) closed 95802
#>    5:                                          Bureau of Meteorology (BOM) closed    NA
#>   ---                                                                                  
#> 1033:                                          Bureau of Meteorology (BOM)   open    NA
#> 1034:                                          Bureau of Meteorology (BOM)   open    NA
#> 1035: WA Department of Primary Industries and Regional Development (DPIRD)   open    NA
#> 1036: WA Department of Primary Industries and Regional Development (DPIRD)   open    NA
#> 1037: WA Department of Primary Industries and Regional Development (DPIRD)   open    NA

We need to convert the sw_wa object from a data.table to an sf object and transform it to use the same CRS as the south_west_agricultural_region object to map the results.

sw_wa <- st_as_sf(
  x = sw_wa,
  coords = c("longitude", "latitude"),
  crs = "EPSG:4326"
)

sw_wa <- st_transform(x = sw_wa, crs = st_crs(south_west_agricultural_region))

Now we can use {ggplot2} to plot the stations indicating whether they are still open or they are closed.

ggplot(south_west_agricultural_region) +
  geom_sf(fill = "white") +
  geom_sf(data = sw_wa,
          alpha = 0.65,
          size = 2,
          aes(colour = status)) +
  theme_map()
plot of chunk plot_sw_land_div_map

plot of chunk plot_sw_land_div_map

Checking Station Uptime or Availability

Example 14: Checking Station Availability for Current Year

Check the availability of the Westonia station since the start of the current year using the default functionality with no start_date or end_date.

library(weatherOz)

(WS001 <- get_dpird_availability(
  station_code = "WS001"
))
#> Key: <station_code>
#>    station_code station_name to9_am since9_am since12_am current_hour last24_hours last7_days_since9_am
#>          <fctr>       <char>  <int>     <num>      <num>        <int>        <num>                <num>
#> 1:        WS001     Westonia    100      95.8       99.2          100         99.6                 99.9
#>    last7_days_since12_am last14_days_since9_am last14_days_since12_am month_to_date_to9_am
#>                    <num>                 <int>                  <int>                <int>
#> 1:                  99.9                   100                    100                  100
#>    month_to_date_since12_am year_to_date_to9_am year_to_date_since12_am
#>                       <int>               <int>                   <int>
#> 1:                      100                 100                     100

Example 15: Checking Station Availability for a Set Time Period

Check the availability of the Binnu station for January of 2018. When a custom start_date is provided an end_date must also be provided.

library(weatherOz)

(
  BI_201801 <- get_dpird_availability(
    station_code = "BI",
    start_date = "2018-01-01",
    end_date = "2018-01-31"
  )
)
#> Key: <station_code>
#>    station_code station_name start_date   end_date availability_since_9_am availability_since_12_am
#>          <fctr>       <char>     <POSc>     <POSc>                   <int>                    <int>
#> 1:           BI        Binnu 2018-01-01 2018-01-31                     100                      100

Getting Station Metadata for the DPIRD Network Stations

The get_stations_metadata() function is shared with the SILO functions as well, so this function will retrieve data from both weather APIs. Shown here is how to use it for DPIRD data only and with an example of DPIRD specific information, namely including closed stations and rich metadata.

Example 16: Get DPIRD Station Metadata

The get_stations_metadata() function allows you to get details about the stations themselves for stations in the DPIRD and SILO (BOM) networks in one function. Here we demonstrate how to get the metadata for the DPIRD stations only.

library(weatherOz)

(metadata <- get_stations_metadata(which_api = "dpird"))
#>      station_code station_name      start        end  latitude longitude  state elev_m
#>            <char>       <char>     <Date>     <Date>     <num>     <num> <char>  <int>
#>   1:        AN001    Allanooka 2012-06-19 2024-10-21 -29.06361  114.9972     WA    131
#>   2:        AM001       Amelup 2019-10-09 2024-10-21 -34.27083  118.2685     WA    200
#>   3:        SH002      Babakin 2016-06-22 2024-10-21 -32.12548  118.0041     WA    313
#>   4:           BA  Badgingarra 2008-11-19 2024-10-21 -30.33805  115.5395     WA    284
#>   5:        BP001     Balingup 2014-10-24 2024-10-21 -33.79620  116.0640     WA    227
#>  ---                                                                                  
#> 219:           YS      Yilgarn 2008-11-01 2024-10-21 -31.91562  119.2561     WA    468
#> 220:        YE001    York East 2013-11-08 2024-10-21 -31.83588  116.9211     WA    229
#> 221:        YU001         Yuna 2012-06-21 2024-10-21 -28.33763  114.9898     WA    329
#> 222:        YU002      Yuna NE 2016-03-24 2024-10-21 -28.20032  115.2616     WA    267
#> 223:        YU003   Yuna North 2018-08-08 2024-10-21 -28.12086  114.9626     WA    264
#>                                                                    source status    wmo
#>                                                                    <char> <char> <lgcl>
#>   1: WA Department of Primary Industries and Regional Development (DPIRD)   open     NA
#>   2: WA Department of Primary Industries and Regional Development (DPIRD)   open     NA
#>   3: WA Department of Primary Industries and Regional Development (DPIRD)   open     NA
#>   4: WA Department of Primary Industries and Regional Development (DPIRD)   open     NA
#>   5: WA Department of Primary Industries and Regional Development (DPIRD)   open     NA
#>  ---                                                                                   
#> 219: WA Department of Primary Industries and Regional Development (DPIRD)   open     NA
#> 220: WA Department of Primary Industries and Regional Development (DPIRD)   open     NA
#> 221: WA Department of Primary Industries and Regional Development (DPIRD)   open     NA
#> 222: WA Department of Primary Industries and Regional Development (DPIRD)   open     NA
#> 223: WA Department of Primary Industries and Regional Development (DPIRD)   open     NA

Example 17: Get Rich DPIRD Station Metadata and Include Closed Stations

You can fetch additional information about the DPIRD stations as well as getting data for stations that are no longer open like so with the rich and include_closed arguments set to TRUE.

library(weatherOz)

(metadata <- get_stations_metadata(which_api = "dpird",
                                  include_closed = TRUE,
                                  rich = TRUE))
#>      station_code station_name      start        end  latitude longitude  state elev_m
#>            <char>       <char>     <Date>     <Date>     <num>     <num> <char>  <int>
#>   1:        AN001    Allanooka 2012-06-19 2024-10-21 -29.06361  114.9972     WA    131
#>   2:        AM001       Amelup 2019-10-09 2024-10-21 -34.27083  118.2685     WA    200
#>   3:        SH002      Babakin 2016-06-22 2024-10-21 -32.12548  118.0041     WA    313
#>   4:           BA  Badgingarra 2008-11-19 2024-10-21 -30.33805  115.5395     WA    284
#>   5:        BP001     Balingup 2014-10-24 2024-10-21 -33.79620  116.0640     WA    227
#>  ---                                                                                  
#> 234:           YS      Yilgarn 2008-11-01 2024-10-21 -31.91562  119.2561     WA    468
#> 235:        YE001    York East 2013-11-08 2024-10-21 -31.83588  116.9211     WA    229
#> 236:        YU001         Yuna 2012-06-21 2024-10-21 -28.33763  114.9898     WA    329
#> 237:        YU002      Yuna NE 2016-03-24 2024-10-21 -28.20032  115.2616     WA    267
#> 238:        YU003   Yuna North 2018-08-08 2024-10-21 -28.12086  114.9626     WA    264
#>                                                                    source status    wmo probe_height
#>                                                                    <char> <char> <lgcl>        <num>
#>   1: WA Department of Primary Industries and Regional Development (DPIRD)   open     NA         1.25
#>   2: WA Department of Primary Industries and Regional Development (DPIRD)   open     NA         1.25
#>   3: WA Department of Primary Industries and Regional Development (DPIRD)   open     NA         1.25
#>   4: WA Department of Primary Industries and Regional Development (DPIRD)   open     NA         1.25
#>   5: WA Department of Primary Industries and Regional Development (DPIRD)   open     NA         1.25
#>  ---                                                                                                
#> 234: WA Department of Primary Industries and Regional Development (DPIRD)   open     NA         1.25
#> 235: WA Department of Primary Industries and Regional Development (DPIRD)   open     NA         1.25
#> 236: WA Department of Primary Industries and Regional Development (DPIRD)   open     NA         1.25
#> 237: WA Department of Primary Industries and Regional Development (DPIRD)   open     NA         1.25
#> 238: WA Department of Primary Industries and Regional Development (DPIRD)   open     NA         1.25
#>      rain_gauge_height wind_probe_heights air_temperature battery_voltage delta_t dew_point pan_evaporation
#>                  <num>             <list>          <lgcl>          <lgcl>  <lgcl>    <lgcl>          <lgcl>
#>   1:               0.5                  3            TRUE            TRUE    TRUE      TRUE            TRUE
#>   2:               1.0                  3            TRUE            TRUE    TRUE      TRUE            TRUE
#>   3:               0.5                  3            TRUE            TRUE    TRUE      TRUE            TRUE
#>   4:               0.5                  3            TRUE            TRUE    TRUE      TRUE            TRUE
#>   5:               0.5                  3            TRUE            TRUE    TRUE      TRUE            TRUE
#>  ---                                                                                                       
#> 234:               0.5                  3            TRUE            TRUE    TRUE      TRUE            TRUE
#> 235:               0.5                  3            TRUE            TRUE    TRUE      TRUE            TRUE
#> 236:               0.5                  3            TRUE            TRUE    TRUE      TRUE            TRUE
#> 237:               0.5                  3            TRUE            TRUE    TRUE      TRUE            TRUE
#> 238:               0.5                  3            TRUE            TRUE    TRUE      TRUE            TRUE
#>      relative_humidity barometric_pressure rainfall soil_temperature solar_irradiance wet_bulb  wind1  wind2
#>                 <lgcl>              <lgcl>   <lgcl>           <lgcl>           <lgcl>   <lgcl> <lgcl> <lgcl>
#>   1:              TRUE               FALSE     TRUE            FALSE             TRUE     TRUE   TRUE  FALSE
#>   2:              TRUE               FALSE     TRUE            FALSE             TRUE     TRUE   TRUE  FALSE
#>   3:              TRUE               FALSE     TRUE             TRUE             TRUE     TRUE   TRUE  FALSE
#>   4:              TRUE               FALSE     TRUE             TRUE             TRUE     TRUE   TRUE  FALSE
#>   5:              TRUE               FALSE     TRUE             TRUE             TRUE     TRUE   TRUE  FALSE
#>  ---                                                                                                        
#> 234:              TRUE               FALSE     TRUE             TRUE             TRUE     TRUE   TRUE  FALSE
#> 235:              TRUE               FALSE     TRUE             TRUE             TRUE     TRUE   TRUE  FALSE
#> 236:              TRUE               FALSE     TRUE            FALSE             TRUE     TRUE   TRUE  FALSE
#> 237:              TRUE               FALSE     TRUE             TRUE             TRUE     TRUE   TRUE  FALSE
#> 238:              TRUE               FALSE     TRUE             TRUE             TRUE     TRUE   TRUE  FALSE
#>       wind3 apparent_temperature eto_short eto_tall frost_condition heat_condition wind_erosion_condition
#>      <lgcl>               <lgcl>    <lgcl>   <lgcl>          <lgcl>         <lgcl>                 <lgcl>
#>   1:  FALSE                 TRUE      TRUE     TRUE            TRUE           TRUE                   TRUE
#>   2:  FALSE                 TRUE      TRUE     TRUE            TRUE           TRUE                   TRUE
#>   3:  FALSE                 TRUE      TRUE     TRUE            TRUE           TRUE                   TRUE
#>   4:  FALSE                 TRUE      TRUE     TRUE            TRUE           TRUE                   TRUE
#>   5:  FALSE                 TRUE      TRUE     TRUE            TRUE           TRUE                   TRUE
#>  ---                                                                                                     
#> 234:  FALSE                 TRUE      TRUE     TRUE            TRUE           TRUE                   TRUE
#> 235:  FALSE                 TRUE      TRUE     TRUE            TRUE           TRUE                   TRUE
#> 236:  FALSE                 TRUE      TRUE     TRUE            TRUE           TRUE                   TRUE
#> 237:  FALSE                 TRUE      TRUE     TRUE            TRUE           TRUE                   TRUE
#> 238:  FALSE                 TRUE      TRUE     TRUE            TRUE           TRUE                   TRUE
#>      richardson_unit chill_hour
#>               <lgcl>     <lgcl>
#>   1:            TRUE       TRUE
#>   2:            TRUE       TRUE
#>   3:            TRUE       TRUE
#>   4:            TRUE       TRUE
#>   5:            TRUE       TRUE
#>  ---                           
#> 234:            TRUE       TRUE
#> 235:            TRUE       TRUE
#> 236:            TRUE       TRUE
#> 237:            TRUE       TRUE
#> 238:            TRUE       TRUE