1 |
function [x_out,y_out]=netcdf_ecco_GenericgridPolarPlaneCoords(x_in,y_in,pole_sign); |
2 |
|
3 |
%pole_sign==1 -> north |
4 |
%pole_sign==-1 -> south |
5 |
|
6 |
if pole_sign==-1|pole_sign==+1 |
7 |
|
8 |
if ~isempty(find(pole_sign*y_in(:)<=0)) |
9 |
fprintf('polarcoords is ill-defined for this combination of tile and hemisphere combination \n => stop \n'); |
10 |
return; |
11 |
end |
12 |
|
13 |
x_out=zeros(size(x_in)); y_out=x_out; |
14 |
|
15 |
x_out(:)=(90-pole_sign*y_in(:)).*cos(pole_sign*x_in(:)*pi/180); |
16 |
y_out(:)=(90-pole_sign*y_in(:)).*sin(pole_sign*x_in(:)*pi/180); |
17 |
|
18 |
else |
19 |
|
20 |
x_out=x_in; y_out=y_in; |
21 |
|
22 |
end%if pole_sign==-1|pole_sign==+1 |
23 |
|
24 |
|