-
Notifications
You must be signed in to change notification settings - Fork 4
Example data records
See also: Creating a TAF analysis, Bib entries.
This page was based on using the icesTAF package version 4.2.0 dated
2023-03-21.
We will start with an empty repository
test_datasets
¦--boot
¦ °--initial
¦ °--data
¦--data.R
¦--model.R
¦--output.R
°--report.R Consider the following script that downloads a zip file containing ESRI shapefiles of ICES areas, unzips it and deletes the zip file
filename <- "ICES_areas.zip"
# download and unzip
download(paste0("http://gis.ices.dk/shapefiles/", filename))
unzip(filename)
# delete zip file
unlink(filename)This code can be used to download shapefiles for use in a TAF assessment
by specifying script as the source of the data. This is done by
creating the following metadata record in DATA.bib
@Misc{icesareas,
originator = {ICES},
year = {2023},
title = {ICES Areas ESRI Shapefile},
access = {Public},
source = {script},
}and an accompanying R script. The R script must have the same name as
the ‘key’ field. In this case the key is icesareas so the script must
be called icesareas.R. The DATA.bib entry can be created using the
draft.data
function
draft.data(
data.files = "icesareas",
originator = "ICES",
title = "ICES Areas ESRI Shapefile",
period = FALSE,
source = "script",
file = TRUE
)After you have created the script in the boot folder called
icesareas.R the directory structure should look like this:
test_datasets
¦--boot
¦ ¦--DATA.bib
¦ ¦--icesareas.R
¦ °--initial
¦ °--data
¦--data.R
¦--model.R
¦--output.R
°--report.R Now we can run
taf.boot to process
the script to download the process the zip file and now the directory
structure will look like this
taf.boot()
test_datasets
¦--boot
¦ ¦--data
¦ ¦ °--icesareas
¦ ¦ ¦--DISCLAIMER_GIS.txt
¦ ¦ ¦--ICES_Areas_20160601_cut_dense_3857.cpg
¦ ¦ ¦--ICES_Areas_20160601_cut_dense_3857.dbf
¦ ¦ ¦--ICES_Areas_20160601_cut_dense_3857.prj
¦ ¦ ¦--ICES_Areas_20160601_cut_dense_3857.sbn
¦ ¦ ¦--ICES_Areas_20160601_cut_dense_3857.sbx
¦ ¦ ¦--ICES_Areas_20160601_cut_dense_3857.shp
¦ ¦ ¦--ICES_Areas_20160601_cut_dense_3857.shp.xml
¦ ¦ °--ICES_Areas_20160601_cut_dense_3857.shx
¦ ¦--DATA.bib
¦ ¦--icesareas.R
¦ °--initial
¦ °--data
¦--data.R
¦--model.R
¦--output.R
°--report.R We will start with an empty repository
test_datasets
¦--boot
¦ °--initial
¦ °--data
¦--data.R
¦--model.R
¦--output.R
°--report.R To download this file for use in an automated report for a TAF
assessment, specify the location of the file as the source of the data
record. The file is held in the
ices-taf/doc repository and is called
reportTemplate.docx. This is done by creating the following meta-data
record in DATA.bib
@Misc{reportTemplate.docx,
originator = {ICES},
year = {2023},
title = {ICES TAF Word template for report automation},
access = {Public},
source = {https://github.com/ices-taf/doc/raw/master/reportTemplate.docx},
}The DATA.bib entry can be created using the
draft.data
function
draft.data(
data.files = "reportTemplate.docx",
originator = "ICES",
title = "ICES TAF Word template for report automation",
period = FALSE,
source = "https://github.com/ices-taf/doc/raw/master/reportTemplate.docx",
file = TRUE
)The directory structure should now look like this:
test_datasets
¦--boot
¦ ¦--DATA.bib
¦ °--initial
¦ °--data
¦--data.R
¦--model.R
¦--output.R
°--report.R Now we can run
taf.boot to process
the script to download the Word template file and now the directory
structure will look like this
taf.boot()
test_datasets
¦--boot
¦ ¦--data
¦ ¦ °--reportTemplate.docx
¦ ¦--DATA.bib
¦ °--initial
¦ °--data
¦--data.R
¦--model.R
¦--output.R
°--report.R DATA.bib entry:
@Misc{ICES_StatRec_mapto_Ecoregions,
originator = {DTU Aqua},
year = {2019},
title = {ICES Stat rec ESRI Shapefile},
url = {https://gis.ices.dk/geonetwork/srv/metadata/81f68a99-9b91-4762-80d3-31c069731f44},
source = {script},
}with the R script: ICES_StatRec_mapto_Ecoregions.R
filename <- "ICES_StatRec_mapto_Ecoregions.zip"
# download and unzip
download(paste0("http://gis.ices.dk/shapefiles/", filename))
unzip(filename)
# delete zip file
unlink(filename)DATA.bib entry:
@Misc{ICES_ecoregions,
originator = {ICES},
year = {2019},
title = {ICES Ecoregion ESRI Shapefile},
url = {https://gis.ices.dk/geonetwork/srv/metadata/4745e824-a612-4a1f-bc56-b540772166eb},
source = {script},
}with the R script: ICES_ecoregions.R
filename <- "ICES_ecoregions.zip"
# download and unzip
download(paste0("http://gis.ices.dk/shapefiles/", filename))
unzip(filename)
# delete zip file
unlink(filename)DATA.bib entry:
@Misc{ICES_SD_species_lookup,
originator = {ICES},
year = {2019},
title = {ICES Fisheries Guild lookup table},
url = {https://gis.ices.dk/geonetwork/srv/metadata/30541cf4-0236-437f-9757-596c5f793cff},
source = {script},
}with the R script: ICES_SD_species_lookup.R
library(icesSD)
library(magrittr)
sid <- getSD()
# get lookup table for species, common name and Fisheries guild from SID
species_lookup <-
sid %>%
filter(ActiveYear > 2018) %>%
select(
SpeciesScientificName,
SpeciesCommonName,
FisheriesGuild
) %>%
mutate(
FisheriesGuild = tolower(FisheriesGuild)
) %>%
filter(
!is.na(FisheriesGuild) &
!is.na(SpeciesScientificName)
) %>%
unique()
write.taf(species_lookup, quote = TRUE)