mareframe / vat

Visualizing Atlantis Tool (vat)
5 stars 9 forks source link

look into YOY biomass #6

Closed cddesja closed 8 years ago

cddesja commented 9 years ago

The YOY biomass plot looks very strange. Either it's something wrong with Atlantis code or my code.

cddesja commented 9 years ago

My plots are fine given the output. However, will convert biomass in tons to number of YOY recruits. Using:

yoy_mg_N = (yoy_biom * 50000000.0 / X_CN) 
you_nums = you_mg / (KWRR + KWSR) 
cddesja commented 8 years ago

@erlasturl - Is this something you want? Otherwise, I'm going to close this. It would be easy enough to implement.

cddesja commented 8 years ago

These numbers look very strange (extremely small) when I use this calculation. I have code in create_vadt.R to do this but it's presently commented out. If this is something someone is interested in then I'll reopen it.

erlasturl commented 8 years ago

I would like to have the numbers of YOY but I think the calculations should be different.

The YOY output is in tonnes wet weight (I think) so we need to convert the KWRR and KWSR to tonnes wet weight.

Rec_w = (KWRR +KWSR )_5.7_20/1000000000

Rec_N = YOY tonnes/Rec_w

Connected to this I think it would be ok to take out the last plot in age disaggregated, the one that says recruits because it really is just ageclass 1

cddesja commented 8 years ago

OK. Is Rec_N recruitment numbers or nitrogen?

I agree about the last plot.

erlasturl commented 8 years ago

Rec_N is recruitment numbers

cddesja commented 8 years ago

unknown

^^^ For FCD. Based on

# fixed: yoy as number of individuals
  colnames(yoy)[2:length(names(yoy))] <- str_split_fixed(names(yoy)[2:length(names(yoy))], pattern = '.0', n = 2)[,1]
  kwrr <- grep("KWRR", biolprm, value = T)
  kwrr_split <- unlist(str_split_fixed(kwrr, pattern = ' ', n = 2))
  kwrr_split <- apply(kwrr_split,2, str_trim, side = "both")
  kwrr_group <- str_split_fixed(kwrr_split[,1], pattern = '_', n = 2)[,2]
  kwrr_param <- str_split_fixed(kwrr_split[,2], pattern = ' ', n = 2)[,1]

  kwsr <- grep("KWSR", biolprm, value = T)
  kwsr_split <- unlist(str_split_fixed(kwsr, pattern = ' ', n = 2))
  kwsr_split <- apply(kwsr_split,2, str_trim, side = "both")
  kwsr_group <- str_split_fixed(kwsr_split[,1], pattern = '_', n = 2)[,2]
  kwsr_param <- str_split_fixed(kwsr_split[,2], pattern = ' ', n = 2)[,1]
  kwrr <- data.frame(group = kwrr_group, kwrr_param)
  kwsr <- data.frame(group = kwsr_group, kwsr_param)
  kwrr_kwsr_params <- merge(kwrr, kwsr)
  kwrr_kwsr_params$total <- as.double(as.character(kwrr_kwsr_params$kwrr_param)) + as.double(as.character(kwrr_kwsr_params$kwsr_param))

## Erla Calculations
  kwrr_kwsr_params$total <- kwrr_kwsr_params$total * 5.720 / 1000000000
  for(i in 2:ncol(yoy)){
    findColumn <- kwrr_kwsr_params$group == names(yoy)[i]
    yoy[, i] <- yoy[,i] / kwrr_kwsr_params$total[findColumn]
  }

This look OK? Note, I'm using a very old Iceland model.

cddesja commented 8 years ago

I am going to assume this fixes things @erlasturl. If not, let me know.