From 56f07a107d02c3f7fb3796db3a9db180bb052b62 Mon Sep 17 00:00:00 2001 From: Arni Magnusson Date: Wed, 13 Sep 2017 19:18:09 +0200 Subject: [PATCH] Download catageysa.dat from TAF database -> data, later moved to input --- _raw/upload.R | 10 ++++++++++ data.R | 10 +++++----- input.R | 2 +- 3 files changed, 16 insertions(+), 6 deletions(-) create mode 100644 _raw/upload.R diff --git a/_raw/upload.R b/_raw/upload.R new file mode 100644 index 0000000..a0899d5 --- /dev/null +++ b/_raw/upload.R @@ -0,0 +1,10 @@ +## Upload raw data to TAF database + +## Before: catageysa.dat (user dir) +## After: catageysa.dat (TAF database) + +library(icesTAF) + +owd <- setwd("d:/projects/ices-taf/ftp/nwwg/2015/had-iceg/raw") +upload("2015_had-iceg", "raw", "catageysa.dat") +setwd(owd) diff --git a/data.R b/data.R index 76d9a28..182750b 100644 --- a/data.R +++ b/data.R @@ -1,18 +1,18 @@ -## Download and preprocess data, write TAF input tables +## Preprocess data, write TAF data tables -## Before: catageysa.dat (ftp) +## Before: catageysa.dat (TAF database) ## After: catageysa.dat, catage.csv, wcatch.csv, maturity.csv, wstock.csv, ## smb.csv, smh.csv (data) library(icesTAF) source("utilities.R") -ftp <- "https://raw.githubusercontent.com/ices-taf/ftp/master/nwwg/2015/had-iceg/" - mkdir("data") +url <- "http://taf.ices.local/taf/fs/2015_had-iceg/raw/" + ## Download data -download.file(paste0(ftp,"raw/catageysa.dat"), "data/catageysa.dat", quiet=TRUE) +download.file(paste0(url,"catageysa.dat"), "data/catageysa.dat", quiet=TRUE) txt <- readLines("data/catageysa.dat", encoding="latin1") ## Extract tables from original source diff --git a/input.R b/input.R index 7405437..de20e6d 100644 --- a/input.R +++ b/input.R @@ -8,4 +8,4 @@ library(icesTAF) mkdir("input") ## Copy model input file to input directory -cp("data/catageysa.dat", "input") +cp("data/catageysa.dat", "input", move=TRUE)