I am using the new roms_metrics.m function (track_ticket #879). I noticed it gives different x_rho and y_rho variables (x_psi,...) with respect to previous tools, only concerning the first (1) and last grid points (Lp and Mp). They indeed result to be dx/2 and dy/2 spaced with respect to the inner points, but that is not true for the corresponding lon_rho and lat_rho points. These are the lines of code producing x_rho and y_rho:
Code: Select all
% Compute Cartesian coordinates.
x_rho = zeros(size(dx));
for j=1:Mp
x_rho(1,j) = -dx(1,j);
for i=1:L
x_rho(i+1,j) = x_rho(i,j) + dx(i+1,j);
end
x_rho( 1,j) = x_rho( 1,j) + 0.5*dx( 1,j);
x_rho(Lp,j) = x_rho(Lp,j) - 0.5*dx(Lp,j);
end
y_rho = zeros(size(dy));
for i=1:Lp
y_rho(i,1) = -dy(i,1);
for j=1:M
y_rho(i,j+1) = y_rho(i,j) + dy(i,j+1);
end
y_rho(i,1 ) = y_rho(i,1 ) + 0.5*dy(i,1 );
y_rho(i,Mp) = y_rho(i,Mp) - 0.5*dy(i,Mp);
end
Code: Select all
x_rho( 1,j) = x_rho( 1,j) + 0.5*dx( 1,j);
x_rho(Lp,j) = x_rho(Lp,j) - 0.5*dx(Lp,j);
y_rho(i,1 ) = y_rho(i,1 ) + 0.5*dy(i,1 );
y_rho(i,Mp) = y_rho(i,Mp) - 0.5*dy(i,Mp);
Code: Select all
diff(x_rho(end-4:end,1))
ans =
842.7449
842.7449
842.7449
421.3725
thank you in advance,
Michele