diff --git a/Preprocessing_tools/make_grid.m b/Preprocessing_tools/make_grid.m index 939048cf4b2bd058dd5ee15dd3ba9480feea1332..23e076fb010657676c3eb2513fba3dec205bab1b 100644 --- a/Preprocessing_tools/make_grid.m +++ b/Preprocessing_tools/make_grid.m @@ -40,6 +40,7 @@ crocotools_param %%%%%%%%%%%%%%%%%%% END USERS DEFINED VARIABLES %%%%%%%%%%%%%%%%%%%%%%% warning off isoctave=exist('octave_config_info'); +if exist('CROCO_NHMG')==0, CROCO_NHMG=0; end % % Title @@ -51,12 +52,6 @@ disp([' Title: ',CROCO_title]) disp(' ') disp([' Resolution: 1/',num2str(1/dl),' deg']) -% -% Link the GSHHS coastline private data -% for crude, low, intermediate, high and full resolution -% -make_gshhs_link ; - % % Choose interactive tool for making grid (rotated grid) % @@ -94,6 +89,19 @@ else % Get the longitude % lonr=(lonmin:dl:lonmax); +if exist('CROCO_NHMG')==0, CROCO_NHMG=0; end +if CROCO_NHMG, % find compatible grid + Lp=length(lonr); Lm=Lp-2; + P=[1:10]; A1=2.^P; A2=3*2.^P; + [ d1, ix1 ] = min( abs( A1-Lm ) ); + [ d2, ix2 ] = min( abs( A2-Lm ) ); + if d1<d2, Lm_new=A1(ix1); else Lm_new=A2(ix2); end + Lp_new=Lm_new+2; + while Lp<Lp_new + lonr(Lp+1)=lonr(Lp)+dl; + Lp=Lp+1; + end +end % % Get the latitude for an isotropic grid % @@ -103,6 +111,20 @@ while latr(i)<=latmax i=i+1; latr(i)=latr(i-1)+dl*cos(latr(i-1)*pi/180); end +if CROCO_NHMG, % find compatible grid + Mp=length(latr); Mm=Mp-2; + [ d1, ix1 ] = min( abs( A1-Mm ) ); + [ d2, ix2 ] = min( abs( A2-Mm ) ); + if d1<d2, Mm_new=A1(ix1); else Mm_new=A2(ix2); end + Mp_new=Mm_new+2; + while Mp<Mp_new + latr(Mp+1)=latr(Mp)+dl*cos(latr(Mp)*pi/180); + Mp=Mp+1; + end +end +% +% Make 2D arrays of (lon,lat) at all points +% [Lonr,Latr]=meshgrid(lonr,latr); [Lonu,Lonv,Lonp]=rho2uvp(Lonr); [Latu,Latv,Latp]=rho2uvp(Latr); diff --git a/crocotools_param.m b/crocotools_param.m index 8b310ce1396cce28d18bf8d520efe0a23096ba96..bafbbcb38087349fdf0aad211df4a2ac68f20065 100644 --- a/crocotools_param.m +++ b/crocotools_param.m @@ -62,6 +62,11 @@ latmax = -26; % Maximum latitude [degree north] % dl = 1/3; % +% Force horizontal grid point numbers if NHMG defined in cppdefs.h +% (Lm,Mm)=2^p or (Lm,Mm)=3*2^p (p integer) +% +CROCO_NHMG=0; +% % Number of vertical Levels (! should be the same in param.h !) % N = 32;