Skip to content

Commit

Permalink
Merge pull request #2 from adamhsparks/example_data
Browse files Browse the repository at this point in the history
  • Loading branch information
adamhsparks authored Nov 25, 2024
2 parents 399e3ce + cba15bc commit c8f4477
Show file tree
Hide file tree
Showing 13 changed files with 215 additions and 13 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Description: Download and import data from the Australian Bureau of
Agricultural and Resource Economics and Sciences (ABARES)
<https://www.agriculture.gov.au/abares>.
License: MIT + file LICENSE
URL: https://github.org/adamhsparks/read.abares,
URL: https://github.com/adamhsparks/read.abares,
https://adamhsparks.github.io/read.abares/
BugReports: https://github.com/adamhsparks/read.abares/issues
Depends:
Expand Down
35 changes: 35 additions & 0 deletions R/get_agfd.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,41 @@

#' Fetch Australian Gridded Farm Data
#'
#' Downloads The Australian Gridded Farm Data (\acronym{AGFD}) data and unzips
#' the compressed files to NetCDF for importing.
#'
#' @details
#'
#' From the [ABARES website](https://www.agriculture.gov.au/abares/research-topics/surveys/farm-survey-data/australian-gridded-farm-data):
#' \dQuote{The Australian Gridded Farm Data (\acronym{AGFD}) are a set of national
#' scale maps containing simulated data on historical broadacre farm business
#' outcomes including farm profitability on an 0.05-degree (approximately 5 km)
#' grid.\cr
#' These data have been produced by \acronym{ABARES} as part of the ongoing
#' Australian Agricultural Drought Indicator (\acronym{AADI}) project
#' (previously known as the Drought Early Warning System Project) and were
#' derived using \acronym{ABARES}
#' [*farmpredict*](https://www.agriculture.gov.au/abares/research-topics/climate/drought/farmpredict)
#' model, which in turn is based on ABARES Agricultural and Grazing Industries
#' Survey (\acronym{AAGIS}) data.\cr
#' [Australian Agricultural Drought Indicator](https://www.agriculture.gov.au/abares/research-topics/climate/australian-agriculture-drought-indicators-project)
#' (\acronym{AADI}) project (previously known as the Drought Early Warning
#' System Project) and were derived using \acronym{ABARES}
#' [*farmpredict*](https://www.agriculture.gov.au/abares/research-topics/climate/drought/farmpredict)
#' model, which in turn is based on ABARES [Agricultural and Grazing Industries
#' Survey](https://www.agriculture.gov.au/abares/research-topics/surveys/farm-definitions-methods)
#' (\acronym{AAGIS}) data.\cr
#' These maps provide estimates of farm business profit, revenue, costs and
#' production by location (grid cell) and year for the period 1990-91 to
#' 2022-23. The data do not include actual observed outcomes but rather model
#' predicted outcomes for representative or \sQuote{typical} broadacre farm
#' businesses at each location considering likely farm characteristics and
#' prevailing weather conditions and commodity prices.}\cr
#' -- \acronym{ABARES}, 2024-11-25
#'
#' Both sets of data are large in file size, *i.e.*, >1GB, and will require time
#' to download.
#'
#' @param fixed_prices `Boolean` Download historical climate and prices or
#' historical climate and fixed prices as described in (Hughes *et al.* 2022).
#' Defaults to `TRUE` and downloads the data with historical climate and fixed
Expand Down
3 changes: 3 additions & 0 deletions R/read_agfd_dt.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
#'
#' Read Australian Gridded Farm Data, (\acronym{AGFD}) as a [data.table] object.
#'
#' @inherit get_agfd details
#'
#' @param files A list of NetCDF files to import
#'
#' @return a [data.table::data.table] object of the Australian Gridded Farm Data
#'
#' @examplesIf interactive()
Expand Down
7 changes: 5 additions & 2 deletions R/read_agfd_stars.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@

#' Read AGFD NCDF Files With stars
#'
#' Read Australian Gridded Farm Data, (\acronym{AGFD}) as a [stars] object.
#' Read Australian Gridded Farm Data, (\acronym{AGFD}) as a list of [stars]
#' objects.
#'
#' @param files A list of NetCDF files to import
#' @inherit get_agfd details
#'
#' @inheritParams read_agfd_dt
#'
#' @return a `list` object of \CRANpkg{stars} objects of the Australian Gridded
#' Farm Data with the file names as the list's objects' names
Expand Down
5 changes: 4 additions & 1 deletion R/read_agfd_terra.R
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
#' Read Australian Gridded Farm Data, (\acronym{AGFD}) as a `list` of
#' [terra::rast] objects.
#'
#' @param files A list of NetCDF files to import
#' @inherit get_agfd details
#'
#' @inheritParams read_agfd_dt
#'
#' @return a `list` object of [terra::rast] objects of the Australian Gridded
#' Farm Data with the file names as the list's objects' names
#'
Expand Down
9 changes: 7 additions & 2 deletions R/read_agfd_tidync.R
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@

#' Read agfd NCDF Files With tidync
#'
#' @param files A list of NetCDF files to import
#' Read Australian Gridded Farm Data, (\acronym{AGFD}) as a list of [tidync]
#' objects
#'
#' @inherit get_agfd details
#'
#' @inheritParams read_agfd_dt
#'
#' @return a `list` object of \CRANpkg{tidync} [tidync::tidync] objects of the
#' Australian Gridded Farm Data with the file names as the list's objects'
#' names.
#'
#' @examplesIf interactive()
#' get_agfd(cache = TRUE) |>
#' x <- get_agfd(cache = TRUE) |>
#' read_agfd_tidync()
#'
#' @family AGFD
Expand Down
4 changes: 2 additions & 2 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"identifier": "read.abares",
"description": "Download and import data from the Australian Bureau of Agricultural and Resource Economics and Sciences (ABARES) <https://www.agriculture.gov.au/abares>.",
"name": "read.abares: Provides simple downloading, parsing and importing of Australian\n Bureau of Agricultural and Resource Economics and Sciences (ABARES)\n data sources",
"relatedLink": "https://github.org/adamhsparks/read.abares",
"relatedLink": "https://adamhsparks.github.io/read.abares/",
"codeRepository": "https://github.com/adamhsparks/read.abares",
"issueTracker": "https://github.com/adamhsparks/read.abares/issues",
"license": "https://spdx.org/licenses/MIT",
Expand Down Expand Up @@ -273,7 +273,7 @@
},
"SystemRequirements": null
},
"fileSize": "330.574KB",
"fileSize": "343.019KB",
"citation": [
{
"@type": "SoftwareSourceCode",
Expand Down
33 changes: 32 additions & 1 deletion man/get_agfd.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion man/read.abares-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions man/read_agfd_dt.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 32 additions & 1 deletion man/read_agfd_stars.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions man/read_agfd_terra.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 33 additions & 2 deletions man/read_agfd_tidync.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c8f4477

Please sign in to comment.