% this function takes the delR values used in your data file and fit an
% initial temperature profile in accordance with the initial temperature
% profile used in the quarter degree global model example:
% http://mitgcm.org/viewvc/MITgcm/MITgcm_contrib/quarter_degree_global/input/data?revision=1.11&view=markup
function tny = fitTemp(delRny)
tRef2 = [23.,23,23 ,22.,22,22, 21.,20.,20,19.,18.,18, 17.,16.,16,15.,14.,13.,...
    12.,11.,9,9.,8.,7.,6,6.,5,5.,4,4,4.,3,3,3.,2.,2,2,2,1.,1,1,1,1,1,1,1,1,1,1,1];

delR2 = [10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.00, 10.01,...
     10.03, 10.11, 10.32, 10.80, 11.76, 13.42, 16.04 , 19.82, 24.85,...
     31.10, 38.42, 46.50, 55.00, 63.50, 71.58, 78.90, 85.15, 90.18,...
     93.96, 96.58, 98.25, 99.25,100.01,101.33,104.56,111.33,122.83,...
     139.09,158.94,180.83,203.55,226.50,249.50,272.50,295.50,318.50,...
     341.50,364.50,387.50,410.50,433.50,456.50];

%The delR values used in Ada's 1 degree resolution runs 
%delRny= [14.8461, 17.7881, 21.3130, 25.5365, 30.5969, 36.6601, 43.9247,...
%   52.6290, 63.0581, 75.5539, 90.5259, 108.4648, 129.9585, 155.7114,...
%  186.5677, 223.5385, 267.8356, 320.9107, 384.5033, 460.6977, 551.9909,...
%  661.3751, 792.4352, 949.4666];

%The delR values used in Liv's 1 degree resolution runs 
%delRny= [50.,  70., 100., 140., 190.,240., 290., 340., 390., 440.,490.,...
%540., 590., 640., 690.,];

tny=interp1(cumsum(delR2),tRef2,cumsum(delRny));
tny=round(tny);
end
