source('src/datavalidator.R')

# Read in data 
setwd('data')
catch.no<-read.ices('cn.dat')
catch.mean.weight<-read.ices('cw.dat')
dis.mean.weight<-read.ices('dw.dat')
land.mean.weight<-read.ices('lw.dat')
stock.mean.weight<-read.ices('sw.dat')
prop.mature<-read.ices('mo.dat')
natural.mortality<-read.ices('nm.dat')
surveys<-read.surveys('survey.dat')
land.frac<-read.ices('lf.dat')
prop.f<-read.ices('pf.dat')
prop.m<-read.ices('pm.dat')
setwd('..')

# Finally write the file with data prepared for state-space assessment 
data<-write.records(surveys=surveys, 
                    residual.fleet=catch.no, 
                    prop.mature=prop.mature, 
                    stock.mean.weight=stock.mean.weight, 
                    catch.mean.weight=catch.mean.weight, 
                    dis.mean.weight=dis.mean.weight, 
                    land.mean.weight=land.mean.weight,
                    prop.f=prop.f, 
                    prop.m=prop.m, 
                    natural.mortality=natural.mortality, 
                    land.frac=land.frac, file='run/sam.dat')
