Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add new function to print netcdf file format info in console for AGFD #12

Merged
merged 2 commits into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export(get_historical_state_estimates)
export(get_soil_thickness)
export(inspect_cache)
export(plot)
export(print_agfd_nc_file_format)
export(print_soil_thickness_metadata)
export(read_agfd_dt)
export(read_agfd_stars)
Expand Down
36 changes: 36 additions & 0 deletions R/get_agfd.R
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,39 @@ print.read.abares.agfd.nc.files <- function(x, ...) {
cli::cat_line()
invisible(x)
}

#' Prints File Format Information for the AGFD NetCDF Files
#'
#' Print the file format from section 3.2 in \cite{Australian Bureau of
#' Agricultural and Resource Economics and Sciences}.
#'
#' @references Australian gridded farm data, Australian Bureau of Agricultural
#' and Resource Economics and Sciences, Canberra, July, DOI:
#' <https://doi.org/10.25814/7n6z-ev41. CC BY 4.0.>
#' @source <https://daff.ent.sirsidynix.net.au/client/en_AU/search/asset/1036161/0>
#' @examples
#' print_agfd_nc_file_format()
#'
#' @export
#' @autoglobal
#' @noRd
print_agfd_nc_file_format <- function() {
cli::cat_rule()
cli::cli_text("Each of the layers in simulation output data is represented as
a 2D raster in NETCDF files, with the following grid format:")
cli::cat_line()
cli::cli_dl(
c(
"{.strong CRS}" = "EPSG:4326 - WGS 84 – Geographic",
"{.strong Extent}" = "111.975 -44.525 156.275 -9.975",
"{.strong Unit}" = "Degrees",
"{.strong Width}" = "886",
"{.strong Height}" = "691",
"{.strong Cell size}" = "0.05 degree x 0.05 degree"
)
)
cli::cat_rule()
cli::cli_text("For further details, see the ABARES website,
{.url https://www.agriculture.gov.au/abares/research-topics/surveys/farm-survey-data/australian-gridded-farm-data}")
}

2 changes: 1 addition & 1 deletion codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@
},
"SystemRequirements": null
},
"fileSize": "387.526KB",
"fileSize": "390.077KB",
"citation": [
{
"@type": "SoftwareSourceCode",
Expand Down
21 changes: 20 additions & 1 deletion vignettes/read.abares.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,25 @@ Load the {read.abares} library.
library(read.abares)
```

Check the file format information for the NetCDF files.


``` r
print_agfd_nc_file_format()
#> ────────────────────────────────────────────────────────────────────────────────────────
#> Each of the layers in simulation output data is represented as a 2D raster in NETCDF
#> files, with the following grid format:
#> CRS: EPSG:4326 - WGS 84 – Geographic
#> Extent: 111.975 -44.525 156.275 -9.975
#> Unit: Degrees
#> Width: 886
#> Height: 691
#> Cell size: 0.05 degree x 0.05 degree
#> ────────────────────────────────────────────────────────────────────────────────────────
#> For further details, see the ABARES website,
#> <https://www.agriculture.gov.au/abares/research-topics/surveys/farm-survey-data/australian-gridded-farm-data>
```

Download or load from the local cache and read the AGFD files as a list of {stars} objects.


Expand Down Expand Up @@ -110,7 +129,7 @@ head(tdnc[[1]])
#> # A tibble: 1 × 2
#> access source
#> <dttm> <chr>
#> 1 2024-12-07 21:23:36 /Users/adamsparks/Library/Caches/org.R-project.R/R/read.abares/hi…
#> 1 2024-12-07 23:43:59 /Users/adamsparks/Library/Caches/org.R-project.R/R/read.abares/hi…
#>
#> $axis
#> # A tibble: 84 × 3
Expand Down
6 changes: 6 additions & 0 deletions vignettes/read.abares.Rmd.orig
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ Load the {read.abares} library.
library(read.abares)
```

Check the file format information for the NetCDF files.

```{r agfd-file-format}
print_agfd_nc_file_format()
```

Download or load from the local cache and read the AGFD files as a list of {stars} objects.

```{r agfd-stars}
Expand Down
Loading