%% mydata_my_pet
% Sets referenced data

%%
function [data, auxData, metaData, txtData, weights] = mydata_Hippoglussus_hippoglossus 
  % created by Starrlight Augustine, Bas Kooijman, Dina Lika, Goncalo Marques and Laure Pecquerie 2015/03/31
  % last modified: 2015/07/28 
  
  %% Syntax
  % [data, auxData, metaData, txtData, weights] = <../mydata_my_pet.m *mydata_my_pet*>
  
  %% Description
  % Sets data, pseudodata, metadata, auxdata, explanatory text, weights coefficients.
  % Meant to be a template in add-my-pet
  %
  % Output
  %
  % * data: structure with data
  % * auxData: structure with auxilliairy data that is required to compute predictions of data (e.g. temperature, food.). 
  %   auxData is unpacked in predict and the user needs to construct predictions accordingly.
  % * txtData: text vector for the presentation of results
  % * metaData: structure with info about this entry
  % * weights: structure with weights for each data set
  
  %% Remarks
  % Plots with the same labels and units can be combined into one plot by assigning a cell string with dataset names to metaData.grp,sets, and a caption to metaData.grp.comment. 
  
%% set metaData

metaData.phylum     = 'Chordata'; 
metaData.class      = 'Actinopteri'; 
metaData.order      = 'Pleuronectiformes'; 
metaData.family     = 'Pleuronectidae';
metaData.species    = 'Hippoglossus_hippoglossus'; % 
metaData.species_en = 'Atlantic halibut'; 
metaData.T_typical  = C2K(6); % K, body temp
metaData.data_0     = {'ab'; 'ap'; 'am'; 'Lb'; 'Lp'; 'Li'; 'Wdb'; 'Wdp'; 'Wdi'; 'Ri'};  % tags for different types of zero-variate data
metaData.data_1     = {'t-L'; 'L-W'}; % tags for different types of uni-variate data

metaData.COMPLETE = 2.5; % using criteria of LikaKear2011

metaData.author   = {'Magnus Aune Wiedmann'};            % put names as authors as separate strings:  {'FirstName1 LastName2','FirstName2 LastName2'} , with corresponding author in first place 
metaData.date_subm = [2016 04 21];                       % [year month day], date at which the entry is submitted
metaData.email    = {'magnus.wiedmann@akvaplan.niva.no'};              % e-mail of corresponding author
metaData.address  = {'Akvaplan-niva, 9007, Norway'};   % affiliation, postcode, country of the corresponding author

% uncomment and fill in the following fields when the entry is updated:
% metaData.author_mod_1  = {'FirstName3 LastName3'};          % put names as authors as separate strings:  {'author1','author2'} , with corresponding author in first place 
% metaData.date_mod_1    = [2017 09 18];                      % [year month day], date modified entry is accepted into the collection
% metaData.email_mod_1   = {'myname@myuniv.univ'};            % e-mail of corresponding author
% metaData.address_mod_1 = {'affiliation, zipcode, country'}; % affiliation, postcode, country of the corresponding author

% for curators only ------------------------------
% metaData.curator     = {'FirstName LastName'};
% metaData.email_cur   = {'myname@myuniv.univ'}; 
% metaData.date_acc    = [2015 04 22]; 
%-------------------------------------------------

%% set data
% zero-variate data;
% typically depend on scaled functional response f.
% here assumed to be equal for all real data; the value of f is specified in pars_init_my_pet.
% add an optional comment structure to give any additional explanations on
% how the value was chosen, see the last column of the ab data set for an
% example

% age 0 is at onset of embryo development
data.ab = 68;      units.ab = 'd';    label.ab = 'age at birth';  bibkey.ab = {'BlaxDani1983','LønnKjør1982'}; comment.ab  = 'duration from fertilization to hatching is 50d (BlaxDani1983), whereas duration from hatching to end of yolk sac stage is 18d (LønnKjør1982)'; 
  temp.ab = C2K(5);  units.temp.ab = 'K'; label.temp.ab = 'temperature';
  % observed age at birth is frequently larger than ab, because of diapauzes during incubation

  
data.ap_f = 2920;     units.ap = 'd';    label.ap = 'age at puberty'; bibkey.ap = 'WienJoha2011';comment.ab_f  = 'age at puberty can be up to 18y (MunkNiel2005). Temperature preference is 0-10degC'; 
  temp.ap = C2K(5);  units.temp.ap = 'K'; label.temp.ap = 'temperature';

data.ap_m = 2555;     units.ap = 'd';    label.ap = 'age at puberty'; bibkey.ap = 'WienJoha2011'; comment.ab_m  = 'age at puberty can be up to 18y (MunkNiel2005). Temperature preference is 0-10degC';
  temp.ap = C2K(5);  units.temp.ap = 'K'; label.temp.ap = 'temperature';
  
  % observed age at puberty is frequently larger than ap, 
  %   because allocation to reproduction starts before first eggs appear
data.am = 60*365;     units.am = 'd';    label.am = 'life span';     bibkey.am = 'WienJoha2011';   %am means "age at death" or simply life span. Can be up to 60 years old
temp.am = C2K(5);  units.temp.am = 'K'; label.temp.am = 'temperature'; 
% (accounting for aging only) 

% Please specify what type of length measurement is used for your species.
% We put here snout-to-vent length, but you should change this depending on your species:
data.Lb  = 1.15;   units.Lb  = 'cm';   label.Lb  = 'total length';    bibkey.Lb  = 'MunkNiel2005';  %ok. MAW
data.Lp_f  = 110;   units.Lp  = 'cm';   label.Lp  = 'total length at puberty';  bibkey.Lp  = {'JakuHaug1988'}; % paper from Faroese waters
data.Lp_m  = 55;   units.Lp  = 'cm';   label.Lp  = 'total length at puberty';  bibkey.Lp  = {'JakuHaug1988'}; % paper from Faroese waters
data.Li_m  = 180;   units.Li  = 'cm';   label.Li  = 'ultimate total length';    bibkey.Li  = 'WienJoha2011';
data.Li_f  = 350;   units.Li  = 'cm';   label.Li  = 'ultimate total length';    bibkey.Li  = 'WienJoha2011';


data.Wdb = 1.476e-3; units.Wdb = 'g';    label.Wdb = 'dry weight at birth'; bibkey.Wdb = 'LeinHolm1997'; comment.Wdb = 'this number is after 40d at 4degC, but the variation in weight from hatching to the end of the yolk sac stage (50d) is small';

%data.Wdp = 8e-3;   units.Wdp = 'g';    label.Wdp = 'dry weight at puberty'; bibkey.Wdp = 'Anon2015';
%data.Wdi = 0.15;   units.Wdi = 'g';    label.Wdi = 'ultimate dry weight';   bibkey.Wdi = 'Wiki';

data.Ri_max  = 1.8274e4;    units.Ri  = '#/d';  label.Ri  = 'maximum reprod rate';   bibkey.Ri  = 'HaugGull1988'; comment.Ri.max = 'This number is for a 195 cm long female; 6.67e6 eggs/365 days'; %(Ri is the reproductive rate at ultimate state)
data.Ri_low = 1.2877e3; units.Ri  = '#/d';  label.Ri  = 'maximum reprod rate';   bibkey.Ri  = 'HaugGull1988'; comment.Ri.low = 'This number is for a 132 cm long female; 0.47e6 eggs/365 days';  
% for an individual of ultimate length Li 
temp.Ri = C2K(6);  units.temp.Ri = 'K'; label.temp.Ri = 'temperature';
 
% uni-variate data

% uni-variate data at f = 0.8 (this value should be added in pars_init_my_pet as a parameter f_tL) 
% snout-to-vent length and wet weights were measured at the same time
% uni-variate data at f = 0.8 (this value should be added in pars_init_my_pet as a parameter f_tL) 
% snout-to-vent length and wet weights were measured at the same time

data.aL_m = [6 8 12 14 16 18 20 22;    % y, time since birth
           59.1 69.9 106 115 120 125 129 133]';  % cm, snout-to-vent length at f and T (STANDARD LENGTH)
units.aL_m   = {'years', 'cm'};  label.aL_m = {'time since birth', 'total length'};  bibkey.aL_m = 'Andr1964'; %Ok MAW
temp.aL_m    = C2K(6);  units.temp.aL_m = 'K'; label.temp.aL_m = 'temperature';
comment.aL_m = 'Total length is an average'; % optional field

data.aW_m = [6 8 12 14 16 18 20 22;    % y, time since birth
           3.2 6.4 16 20 23 26 29 33]';  % kg, total weight
data.aW_m(:,2) = 1e3 * data.aW_m(:,2); % g, convert kg to g
units.aW_m   = {'years', 'g'};  label.aW_m = {'time since birth', 'total length'};  bibkey.aW_m = 'Andr1964'; 
temp.aW_m    = C2K(6);  units.temp.aW_m = 'K'; label.temp.aW_m = 'temperature';
comment.aW_m = 'Total weight is an average'; % optional field

data.aL_f = [4 6 8 12 14 16 18 20 22;    % d, time since birth
           52.5 69 89 132 142 151 159 167 173]';  % cm, snout-to-vent length at f and T (STANDARD LENGTH)
units.aL_f   = {'years', 'cm'};  label.aL_f = {'time since birth', 'total length'};  bibkey.aL_f = 'Andr1964'; %Ok MAW
temp.aL_f    = C2K(6);  units.temp.aL_f = 'K'; label.temp.aL_f = 'temperature';
comment.aL_f = 'Total length is an average'; % optional field

data.aW_f = [4 6 8 12 14 16 18 20 22;    % y, time since birth
           1.4 3.4 7 31 41 51 61 71 79]';  % kg, total weight
data.aW_f(:,2) = 1e3 * data.aW_f(:,2); % g, convert kg to g
units.aW_f   = {'years', 'g'};  label.aW_f = {'time since birth', 'total length'};  bibkey.aW_f = 'Andr1964'; 
temp.aW_f    = C2K(6);  units.temp.aW_f = 'K'; label.temp.aW_f = 'temperature';
comment.aW_f = 'Total weight is an average'; % optional field

%% set weights for all real data
weights = setweights(data, []);

%% overwriting weights (remove these remarks after editing the file)
% the weights were set automatically with the function setweigths,
% if one wants to ovewrite one of the weights it should always present an explanation example:
%
% zero-variate data:
% weights.Wdi = 100 * weights.Wdi; % Much more confidence in the ultimate dry
%                                % weights than the other data points
% uni-variate data: 
% weights.tL = 2 * weights.tL;

%% set pseudodata and respective weights
% (pseudo data are in data.psd and weights are in weights.psd)
[data, units, label, weights] = addpseudodata(data, units, label, weights);

%% overwriting pseudodata and respective weights (remove these remarks after editing the file)
% the pseudodata and respective weights were set automatically with the function setpseudodata
% if one wants to overwrite one of the values then please provide an explanation
% example:
% data.psd.p_M = 1000;                    % my_pet belongs to a group with high somatic maint 
% weights.psd.kap = 10 * weights.psd.kap;   % I need to give this pseudo data a higher weights

%% pack auxData and txtData for output
auxData.temp = temp;
txtData.units = units;
txtData.label = label;
txtData.bibkey = bibkey;
if exist('comment','var')
  txtData.comment = comment;
end

%% Discussion points
%D1 = 'Author_mod_1: I found information on the number of eggs per female as a function of length in Anon2013 that was much higher than in Anon2015 but chose to not include it as the temperature was not provided';
% optional bibkey: metaData.bibkey.D1 = 'Anon2013';
%D2 = 'Author_mod_1: I was surprised to observe that the weights coefficient for ab changed so much the parameter values';     
% optional bibkey: metaData.bibkey.D2 = 'Kooy2010';
% metaData.discussion = struct('D1', D1, 'D2', D2);

%% Facts
% list facts: F1, F2, etc.
% make sure each fact has a corresponding bib key
% do not put any DEB modelling assumptions here, only relevant information on
% biology and life-cycles etc.
%F1 = 'The larval stage lasts 202 days and no feeding occurs';
%metaData.bibkey.F1 = 'Wiki'; % optional bibkey
%metaData.facts = struct('F1',F1);

%% References
% the following two references should be kept-----------------------------------------------------------
bibkey = 'Kooy2010'; type = 'Book'; bib = [ ...  % used in setting of chemical parameters and pseudodata
'author = {Kooijman, S.A.L.M.}, ' ...
'year = {2010}, ' ...
'title  = {Dynamic Energy Budget theory for metabolic organisation}, ' ...
'publisher = {Cambridge Univ. Press, Cambridge}, ' ...
'pages = {Table 4.2 (page 150), 8.1 (page 300)}, ' ...
'howpublished = {\url{http://www.bio.vu.nl/thb/research/bib/Kooy2010.html}}'];
metaData.biblist.(bibkey) = ['''@', type, '{', bibkey, ', ' bib, '}'';'];
%
bibkey = 'Wiki'; type = 'Misc'; bib = [...
'howpublished = {\url{https://en.wikipedia.org/wiki/Atlantic_halibut}},'...
'note = {Accessed : 2015-04-30}'];
metaData.biblist.(bibkey) = ['''@', type, '{', bibkey, ', ' bib, '}'';'];
%
bibkey = 'Andr1964'; type = 'Book'; bib = [ ...  
'author = {Andriyashev, A.P.}, ' ...
'year = {1964}, ' ...
'title  = {Fishes of the northern seas of the U.S.S.R.}, ' ...
'publisher = {Smithsonian Institution of the National Science Foundation, Washington D.C.} ' ...
'pages = {''}, ' ...
'howpublished = {''}'];
metaData.biblist.(bibkey) = ['''@', type, '{', bibkey, ', ' bib, '}'';'];
%
bibkey = 'HaugGull1988'; type = 'Article'; bib = [ ... 
'author = {Haug, T. and Gulliksen, B.}, ' ... 
'year = {1988}, ' ...
'title = {Fecundity and oocyte sizes in ovaries of female Atlantic halibut, \emph{Hippoglossus hippoglossus} (L.)}, ' ...
'journal = {Sarsia}, ' ...
'volume = {73}, ' ...
'number = {''}, '...
'pages = {259-261}'];
metaData.biblist.(bibkey) = ['''@', type, '{', bibkey, ', ' bib, '}'';'];
%
bibkey = 'LeinHolm1997'; type = 'Article'; bib = [ ... 
'author = {Lein, I. and Holmefjord, I. and Rye, M.}, ' ... 
'year = {1997}, ' ...
'title = {Effects of temperature on yolk sac larvae of Atlantic halibut \emph{Hippoglossus hippoglossus} L.}, ' ...
'journal = {Aquaculture}, ' ...
'volume = {157}, ' ...
'number = {''}, '...
'pages = {123-135}'];
metaData.biblist.(bibkey) = ['''@', type, '{', bibkey, ', ' bib, '}'';'];
%
bibkey = 'JakuHaug1988'; type = 'Article'; bib = [ ... 
'author = {Jakupsstovu, S.H. and Haug, T.}, ' ... 
'year = {1988}, ' ...
'title = {Growth, sexual maturation, and spawning season of Atlantic halibut \emph{Hippoglossus hippoglossus}, in Faroese waters}, ' ...
'journal = {Fisheries Research}, ' ...
'volume = {6}, ' ...
'number = {3}, '...
'pages = {201-215}'];
metaData.biblist.(bibkey) = ['''@', type, '{', bibkey, ', ' bib, '}'';'];
%
bibkey = 'WienJoha2011'; type = 'Report'; bib = [ ... % OK (MAW)
'author = {Wienerroither, R. and Johannesen, E. and Dolgov, A. and Byrkjedal, I. and Bjelland, O. and Drevetnyak, K. and Eriksen, K. B. and Høines, Å. and Langhelle, G. and Langøy H. and Prokhorova, T. and Prozorkevich, D. and Wenneck, T.}, ' ... 
'year = {2011}, ' ...
'title = {Atlas of the Barents Sea fishes}, ' ...
'howpublished = {\url{http://www.imr.no/filarkiv/2011/09/atlas_august_2011_press_quality_til_web.pdf/nb-no}}'];
metaData.biblist.(bibkey) = ['''@', type, '{', bibkey, ', ' bib, '}'';'];
%
bibkey = 'MunkNiel2005'; type = 'Book'; bib = [ ... % OK (MAW)
'author = {Munk, P. and Nielsen, J. G.}, ' ... 
'year = {2005}, ' ...
'title = {Eggs and larvae of North Sea fishes},' ...
'publisher = {biofolia, Frederiksberg}, ' ...
'pages = {50}'];
metaData.biblist.(bibkey) = ['''@', type, '{', bibkey, ', ' bib, '}'';'];
%
bibkey = 'LønnKjør1982'; type = 'Article'; bib = [ ... 
'author = {Lønning, S. and Kjørsvik, E. and Haug, T. and Gulliksen, B.}, ' ... 
'year = {1982}, ' ...
'title = {The early development of the halibut, \emph{Hippoglossus hippoglossus} (L.), compared with other marine teleosts}, ' ...
'journal = {Sarsia}, ' ...
'volume = {67}, ' ...
'number = {''}, '...
'pages = {85-91}'];
metaData.biblist.(bibkey) = ['''@', type, '{', bibkey, ', ' bib, '}'';'];
%
bibkey = 'BlaxDani1983'; type = 'Article'; bib = [ ... 
'author = {Blaxter, J.H.S. and Danielssen, D. and Moksness, E. and Øiestad, V.}, ' ... 
'year = {1983}, ' ...
'title = {Description of the early development of the halibut \emph{Hippoglossus hippoglossus} and attempts to rear the larvae past first feeding}, ' ...
'journal = {Marine Biology}, ' ...
'volume = {73}, ' ...
'number = {''}, '...
'pages = {99-107}'];
metaData.biblist.(bibkey) = ['''@', type, '{', bibkey, ', ' bib, '}'';'];
