From 41a2f1305cd86faee4cbff1633c3117734bafd64 Mon Sep 17 00:00:00 2001 From: "Frederik J. Simons" Date: Fri, 1 Jul 2016 15:33:11 -0400 Subject: [PATCH] All "regions" moved to REGIONS --- REGIONS/africa.m | 41 ++++++++++++++ REGIONS/alloceans.m | 115 +++++++++++++++++++++++++++++++++++++++ REGIONS/amazon.m | 44 +++++++++++++++ REGIONS/antarctica.m | 86 +++++++++++++++++++++++++++++ REGIONS/australia.m | 40 ++++++++++++++ REGIONS/baffin.m | 39 ++++++++++++++ REGIONS/borneo.m | 42 +++++++++++++++ REGIONS/contshelves.m | 122 ++++++++++++++++++++++++++++++++++++++++++ REGIONS/ellesmere.m | 42 +++++++++++++++ REGIONS/england.m | 43 +++++++++++++++ REGIONS/eurasia.m | 42 +++++++++++++++ REGIONS/greenland.m | 61 +++++++++++++++++++++ REGIONS/honshu.m | 42 +++++++++++++++ REGIONS/madagascar.m | 42 +++++++++++++++ REGIONS/namerica.m | 40 ++++++++++++++ REGIONS/newguinea.m | 42 +++++++++++++++ REGIONS/orinoco.m | 44 +++++++++++++++ REGIONS/samerica.m | 40 ++++++++++++++ REGIONS/sumatra.m | 41 ++++++++++++++ 19 files changed, 1008 insertions(+) create mode 100644 REGIONS/africa.m create mode 100644 REGIONS/alloceans.m create mode 100644 REGIONS/amazon.m create mode 100644 REGIONS/antarctica.m create mode 100644 REGIONS/australia.m create mode 100644 REGIONS/baffin.m create mode 100644 REGIONS/borneo.m create mode 100644 REGIONS/contshelves.m create mode 100644 REGIONS/ellesmere.m create mode 100644 REGIONS/england.m create mode 100644 REGIONS/eurasia.m create mode 100644 REGIONS/greenland.m create mode 100644 REGIONS/honshu.m create mode 100644 REGIONS/madagascar.m create mode 100644 REGIONS/namerica.m create mode 100644 REGIONS/newguinea.m create mode 100644 REGIONS/orinoco.m create mode 100644 REGIONS/samerica.m create mode 100644 REGIONS/sumatra.m diff --git a/REGIONS/africa.m b/REGIONS/africa.m new file mode 100644 index 0000000..5892da2 --- /dev/null +++ b/REGIONS/africa.m @@ -0,0 +1,41 @@ +function varargout=africa(res,buf) +% XY=AFRICA(res,buf) +% AFRICA(...) % Only makes a plot +% +% Finds the coordinates of Africa, potentially buffered by some amount. +% +% INPUT: +% +% res 0 The standard, default values +% N Splined values at N times the resolution +% buf Distance in degrees that the region outline will be enlarged +% by BUFFERM, not necessarily integer, possibly negative +% [default: 0] +% +% OUTPUT: +% +% XY Closed-curved coordinates of the continent +% +% Last modified by charig-at-princeton.edu, 11/23/2011 +% Last modified by fjsimons-at-alum.mit.edu, 11/23/2011 + +defval('res',0) +defval('buf',0) + +% Parameters that make this the region in question +regn='africa'; +c11=[0 37.5 ; 342.5 36.5]; +cmn=[52 -35 ; 360 3.5]; +xunt=[261:307 110:260 339:399]; +ofs=[360 0]; + +% Do it! Make it, load it, save it +XY=regselect(regn,c11,cmn,xunt,res,buf,ofs); + +if nargout==0 + plot(XY(:,1),XY(:,2),'k-'); axis image; grid on +end + +% Prepare optional output +varns={XY}; +varargout=varns(1:nargout); diff --git a/REGIONS/alloceans.m b/REGIONS/alloceans.m new file mode 100644 index 0000000..adee32b --- /dev/null +++ b/REGIONS/alloceans.m @@ -0,0 +1,115 @@ +function varargout=alloceans(res) +% XY=ALLOCEANS(res) +% ALLOCEANS(...) % Only makes a plot +% +% Finds the coordinates of some of the worlds' oceans so we can combine +% its localization kernel with those for the missing continents to turn +% into Slepian eigenfunctions for all of the world's oceans. Also, there +% is a polar gap taken out. +% +% INPUT: +% +% res 0 The standard, default values +% N Splined values at N times the resolution +% inclang Inclination angle, determines size of polar caps +% +% OUTPUT: +% +% XY Closed-curved coordinates of the world's ocean +% +% SEE ALSO: EQBAND +% +% Written by D.C. Slobbe, 21/10/2010 +% Last modified by fjsimons-at-alum.mit.edu, 10/08/2011 + +defval('res',0) +defval('inclang',66.15); + +if res==0 + fnpl=fullfile(getenv('IFILES'),'COASTS','alloceans.mat'); +else + fnpl=fullfile(getenv('IFILES'),'COASTS',sprintf('alloceans-%i.mat',res)); +end + +if exist(fnpl,'file')==2 + load(fnpl) + if nargout==0 + plot(XY(:,1),XY(:,2),'k-'); axis equal; grid on + else + varns={XY}; + varargout=varns(1:nargout); + end +else + if res==0 + ShftAngl = 180; + XYbos = eqband(0,inclang); + XYbos(:,1) = XYbos(:,1)-360-ShftAngl; + + XY_NA = namerica(0); + XY_NA(:,1) = XY_NA(:,1)-360; + + XY_GR = greenland(0); + XY_GR(:,1) = XY_GR(:,1)-360; + + XY_EA = eurasia(0); + XY_EA(:,1) = XY_EA(:,1)-360; + + % Antarctica receives special treatment + clf + [~,handl,XYant]=plotcont([0 -62],[360 -83],[],0); + delete(handl) + + % Get rid of common NaNs + XYant = XYant(~isnan(XYant(:,1)) & ~isnan(XYant(:,2)),:); + + % Form closed contour + XYant = XYant(~isnan(XYant(:,1)) & ~isnan(XYant(:,2)),:); + XYant = [[0,-90];[0,XYant(227,2)];... + XYant([231:end,1:227],:);[360,-90];[0,-90]]; + [XY_NA(:,1),XY_NA(:,2)] = poly2cw(XY_NA(:,1), XY_NA(:,2)); + [XY_GR(:,1),XY_GR(:,2)] = poly2cw(XY_GR(:,1), XY_GR(:,2)); + [XY_EA(:,1),XY_EA(:,2)] = poly2cw(XY_EA(:,1), XY_EA(:,2)); + [XYant(:,1),XYant(:,2)] = poly2cw(XYant(:,1), XYant(:,2)); + + % Now combine these into an overall interior coastline + warning off map:vectorsToGPC:noExternalContours + [Xu,Yu]=polybool('subtraction',XYbos(:,1),XYbos(:,2),... + XY_NA(:,1),XY_NA(:,2)); ... + [Xu,Yu]=polybool('subtraction',Xu,Yu,XY_GR(:,1),XY_GR(:,2)); + [Xu,Yu]=polybool('subtraction',Xu,Yu,XYant(:,1),XYant(:,2)); + [Xu,Yu]=polybool('subtraction',Xu,Yu,XY_EA(:,1),XY_EA(:,2)); + % Make sure you get both pieces + XY_EA(:,1)=XY_EA(:,1)-360; + [Xu,Yu]= polybool('subtraction',Xu,Yu,XY_EA(:,1),XY_EA(:,2)); + XYant(:,1)=XYant(:,1)-360; + [Xu,Yu]=polybool('subtraction',Xu,Yu,XYant(:,1),XYant(:,2)); + XY=[Xu,Yu]; + warning on map:vectorsToGPC:noExternalContours + + % This should be done manually + StrtIndpol = [0;find(isnan(XY(:,1)));length(XY(:,1))+1]; + [~,maxdi] = max(diff(StrtIndpol)); + XY = [XY(StrtIndpol(maxdi)+1:StrtIndpol(maxdi+1)-1,:)]; + [LATo,LONo] = interpm(XY(:,2),XY(:,1),0.25); + XY = [LONo,LATo]; + + XY(:,1) = XY(:,1)+360; + + % Eyeball + plot(XY(:,1),XY(:,2),'LineW',2,'Color','k'); + axis equal + + % Check this out %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + curvecheck(XY(:,1),XY(:,2)) + + % Check this out %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + save(fnpl,'XY') + else + XY=alloceans(0); + XYb=bezier(XY,res); + XY=XYb; + save(fnpl,'XY') + end + varns={XY}; + varargout=varns(1:nargout); +end diff --git a/REGIONS/amazon.m b/REGIONS/amazon.m new file mode 100644 index 0000000..5e511e3 --- /dev/null +++ b/REGIONS/amazon.m @@ -0,0 +1,44 @@ +function varargout=amazon(res,buf) +% XY=AMAZON(res,buf) +% AMAZON(...) % Only makes a plot +% +% Finds the coordinates of Amazon, potentially buffered by some amount. +% +% INPUT: +% +% res 0 The standard, default values +% N Splined values at N times the resolution +% buf Distance in degrees that the region outline will be enlarged +% by BUFFERM, not necessarily integer, possibly negative +% [default: 0] +% +% OUTPUT: +% +% XY Closed-curved coordinates of the continent +% +% Last modified by charig-at-princeton.edu, 11/23/2011 +% Last modified by fjsimons-at-alum.mit.edu, 11/23/2011 + +defval('res',0) +defval('buf',0) + +% Parameters that make this the region in question +regn='amazon'; +c11=[280 5]; +cmn=[310 -25]; +xunt=[]; + +% This admittedly is a special case +XY=load(fullfile(getenv('IFILES'),'COASTS','amazon')); + +% Do it! Make it, load it, save it +XY=regselect(regn,XY(:,1),XY(:,2),xunt,res,buf); + +if nargout==0 + plot(XY(:,1),XY(:,2),'k-'); axis image; grid on +end + +% Prepare optional output +varns={XY}; +varargout=varns(1:nargout); + diff --git a/REGIONS/antarctica.m b/REGIONS/antarctica.m new file mode 100644 index 0000000..20fa2cd --- /dev/null +++ b/REGIONS/antarctica.m @@ -0,0 +1,86 @@ +function varargout=antarctica(res,buf,rotb) +% [XY,lonc,latc]=antarctica(res,buf,rotb) +% ANTARCTICA(...) % Only makes a plot +% +% Finds the coordinates of Antarctica, but rotates them to an equatorial +% location so KERNELC doesn't choke on the calculation. +% +% INPUT: +% +% res 0 The standard, default values +% N Splined values at N times the resolution +% 'rotated' to determine if this region is rotated (it is). We +% use this in e.g. GLMALPHA to determine whether to rotate the +% eigenfunctions after finding them. You get a logical as output. +% buf Distance in degrees by which the region outline will be enlarged +% by BUFFERM, not necessarily integer, possibly negative +% [default: 0] +% rotb 0 You want the coordinates on the equator for mathematical +% operations (e.g. you need to make a kernel) [default] +% 1 You want the coordinates rotated back to their original +% location (e.g. for plotting) +% +% OUTPUT: +% +% XY Closed-curved coordinates of the continent +% lonc The amount by which you need to rotate it back over z +% latc The amount by which you need to rotate it back over y +% +% See also PLM2ROT, GEOBOXCAP, KLMLMP2ROT, GLMALPHA +% +% Last modified by charig@princeton.edu, 06/24/2016 +% Last modified by fjsimons@princeton.edu, 07/01/2016 + +defval('res',0) +defval('buf',0) +defval('rotb',0) + +if ~isstr(res) + + % Some setup + c11=[0 -62]; + cmn=[360 -83]; + + % Do it! Make it, load it, save it + XY=regselect('antarctica',c11,cmn,[],res,buf); + + % Do some extra here to get the lonc latc + [~,~,XY2]=plotcont(c11(:),cmn(:),[],0); + close + % Get rid of common NaNs + XY2=XY2(~isnan(XY2(:,1)) & ~isnan(XY2(:,2)),:); + % Get rid of common NaNs + XY2=XY2(~isnan(XY2(:,1)) & ~isnan(XY2(:,2)),:); + % Find the geographical center and the area to use for rotation + % Note: this is based on the unbuffered region and does not change + [lonc,latc,A]=rcenter([XY2(:,1) XY2(:,2)]); + lonc=-45; + + % Do we return rotated coordinates? + if rotb==1 + [thetap,phip,rotmats]=rottp((90-XY(:,2))*pi/180,XY(:,1)/180*pi,... + -lonc*pi/180,latc*pi/180,0); + XY = [phip*180/pi 90-thetap*180/pi]; + end + + % Make sure the coordinates make sense + XY(:,1)=XY(:,1)-360*[XY(:,1)>360]; + XY(:,1)=XY(:,1)+360*[XY(:,1)<0]; + + % Prepare Output + varns={XY,lonc,latc}; + varargout=varns(1:nargout); + +elseif strcmp(res,'rotated') + % Return a 1 flag as output, indicating the region is a rotated region + varargout={1}; +elseif strcmp(res,'demo1') + % Make a simple plot + XY=antarctica(); + plot(XY(:,1),XY(:,2),'k-'); axis equal; grid on + axis([-30-lonc 30-lonc -30 20]) +end + + + + diff --git a/REGIONS/australia.m b/REGIONS/australia.m new file mode 100644 index 0000000..21d4bb6 --- /dev/null +++ b/REGIONS/australia.m @@ -0,0 +1,40 @@ +function varargout=australia(res,buf) +% XY=AUSTRALIA(res,buf) +% AUSTRALIA(...) % Only makes a plot +% +% Finds the coordinates of Australia, potentially buffered by some amount. +% +% INPUT: +% +% res 0 The standard, default values +% N Splined values at N times the resolution +% buf Distance in degrees that the region outline will be enlarged +% by BUFFERM, not necessarily integer, possibly negative +% [default: 0] +% +% OUTPUT: +% +% XY Closed-curved coordinates of the continent +% +% Last modified by charig-at-princeton.edu, 11/23/2011 +% Last modified by fjsimons-at-alum.mit.edu, 11/23/2011 + +defval('res',0) +defval('buf',0) + +% Parameters that make this the region in question +regn='australia'; +c11=[112 -10.5]; +cmn=[154 -39]; +xunt=2:166; + +% Do it! Make it, load it, save it +XY=regselect(regn,c11,cmn,xunt,res,buf); + +if nargout==0 + plot(XY(:,1),XY(:,2),'k-'); axis image; grid on +end + +% Prepare optional output +varns={XY}; +varargout=varns(1:nargout); diff --git a/REGIONS/baffin.m b/REGIONS/baffin.m new file mode 100644 index 0000000..57720ad --- /dev/null +++ b/REGIONS/baffin.m @@ -0,0 +1,39 @@ +function varargout=baffin(res,buf) +% XY=baffin(res,buf) +% baffin(...) % Only makes a plot +% +% Finds the coordinates of Baffin Island, potentially buffered by some amount. +% +% INPUT: +% +% res 0 The standard, default values +% N Splined values at N times the resolution +% buf Distance in degrees that the region outline will be enlarged +% by BUFFERM, not necessarily integer, possibly negative +% [default: 0] +% +% OUTPUT: +% +% XY Closed-curved coordinates of the continent +% +% Last modified by fjsimons-at-alum.mit.edu, 09/23/2014 + +defval('res',0) +defval('buf',0) + +% Parameters that make this the region in question +regn='baffin'; +c11=[270 77]; +cmn=[300 58]; +xunt=[14:107]; + +% Do it! Make it, load it, save it +XY=regselect(regn,c11,cmn,xunt,res,buf); + +if nargout==0 + plot(XY(:,1),XY(:,2),'k-'); axis equal; grid on +end + +% Prepare optional output +varns={XY}; +varargout=varns(1:nargout); diff --git a/REGIONS/borneo.m b/REGIONS/borneo.m new file mode 100644 index 0000000..782b67f --- /dev/null +++ b/REGIONS/borneo.m @@ -0,0 +1,42 @@ +function varargout=borneo(res,buf) +% XY=BORNEO(res,buf) +% BORNEO(...) % Only makes a plot +% +% Finds the coordinates of Borneo, potentially buffered by +% some amount. +% +% INPUT: +% +% res 0 The standard, default values +% N Splined values at N times the resolution +% buf Distance in degrees that the region outline will be enlarged +% by BUFFERM, not necessarily integer, possibly negative +% [default: 0] +% +% OUTPUT: +% +% XY Closed-curved coordinates of the island +% +% Last modified by fjsimons-at-alum.mit.edu, 09/24/2014 + +defval('res',0) +defval('buf',0) + +% Parameters that make this the region in question +regn='borneo'; +c11=[108 9]; +cmn=[120 -5]; +xunt=[12:57]; +ofs=0; + +% Do it! Make it, load it, save it +XY=regselect(regn,c11,cmn,xunt,res,buf,ofs); + +if nargout==0 + plot(XY(:,1),XY(:,2),'k-'); axis image; grid on +end + +% Prepare optional output +varns={XY}; +varargout=varns(1:nargout); + diff --git a/REGIONS/contshelves.m b/REGIONS/contshelves.m new file mode 100644 index 0000000..1c00cbc --- /dev/null +++ b/REGIONS/contshelves.m @@ -0,0 +1,122 @@ +function varargout=contshelves(res,rotb) +% [XY,lonc,latc]=CONTSHELVES(res,rotb) +% CONTSHELVES(...) % Only makes a plot +% +% Finds the coordinates of the continental lithosphere and rotates those +% away from the poles so KERNELC doesn't choke on the calculation. +% +% INPUT: +% +% res 0 The standard, default values, +% N Splined values at N times the resolution, +% 'rotated' to determine if this region is rotated (it is). We +% use this in e.g. GLMALPHA to determine whether to rotate the +% eigenfunctions after finding them. You get a logical as output. +% rotb 0 The rotated version [default] needed by e.g. KERNELCP +% 1 The unrotated version suitable for geographic plots +% +% OUTPUT: +% +% XY Closed-curved coordinates of the continental shelves, two +% closed curves separated by a row of NaNs. +% lonc The amount by which you need to rotate it back over z +% latc The amount by which you need to rotate it back over y +% +% Written by Jarno Saarimaki and Ciaran Beggan, 2011 +% Last modified by fjsimons-at-alum.mit.edu, 07/12/2012 +% Last modified by charig-at-princeton.edu, 06/27/2016 + +defval('res',0) +defval('rotb',0) + +if ~isstr(res) + + % The directory where you keep the coordinates + whereitsat=fullfile(getenv('IFILES'),'COASTS'); + + if res==0 + fnpl=fullfile(whereitsat,'ContShelves.mat'); + else + fnpl=fullfile(whereitsat,sprintf('ContShelves-%i.mat',res)); + end + + if rotb==1 + XY=load(fullfile(whereitsat,'ContShelves.txt')); + XY(:,1)=XY(:,1)+[XY(:,1)<0]*360; + [X,Y]=penlift(XY(:,1),XY(:,2)); + XY=[X Y]; + end + + if exist(fnpl,'file')==2 + if rotb==0; load(fnpl); end + if nargout==0 + plot(XY(:,1),XY(:,2),'k-'); axis equal; axis tight; + else + varns={XY,lonc,latc}; + varargout= varns(1:nargout); + end + else + if res == 0 + % There are two continuous regions in the data separated by a row + % of NaNs. The other region is defined in two (by NaNs) so that the + % original XY could be plotted as continuous lines. + XY=load(fullfile(whereitsat,'ContShelves.txt')); + + % Get rid of NaN between North America and asia and leave the one + % between North America and Antarctica + h = find(isnan(XY(:,1))); + XY(h(1),:) = []; + XY = [ XY(1:h(2)-2,:) ; XY(1,:) ; XY(h(2)-1:end,:)]; + XY(end+1,:) = XY(h(2)+1,:); + + % Convert to Cartesian coordinates + [X,Y,Z]=sph2cart(XY(:,1)*pi/180,XY(:,2)*pi/180,1); + + % The rotation angles + lonc = -220; latc = -130; + + % Apply the rotation + xyzp=[rotz(lonc*pi/180)*roty(-latc*pi/180)*[X(:) Y(:) Z(:)]']'; + + % Transform back to spherical coordinates + [phi,piminth,r]=cart2sph(xyzp(:,1),xyzp(:,2),xyzp(:,3)); + lon=phi*180/pi; lat=piminth*180/pi; + + % Output in the usual format + XY=[lon lat]; + + % Eyeball + plot(XY(:,1),XY(:,2),'LineW',2,'Color','k'); + + axis equal + axis tight + + save(fnpl,'XY','lonc','latc') + else + [XY,lonc,latc]=contshelves(0); + % Interpolate separately each region that is separated by NaNs + h = find(isnan(XY(:,1))); + XYb = [ bezier( XY(1:h(1)-1,:) , res ) ; [NaN NaN] ]; + if length(h) > 1 + for i = 2:length(h) + XYb = [ XYb ; bezier( XY(h(i-1)+1:h(i)-1,:) , res ) ; ... + [NaN NaN] ]; + end + end + XY = [ XYb ; bezier( XY(h(end)+1:end,:) , res ) ]; + save(fnpl,'XY','lonc','latc') + end + varns={XY,lonc,latc}; + varargout= varns(1:nargout); + end + +elseif strcmp(res,'rotated') + % Return a 1 flag as output, indicating the region is a rotated region + varargout={1}; + +elseif strcmp(res,'demo1') + % Make a simple plot + XY=contshelves(); + plot(XY(:,1),XY(:,2),'k-'); axis equal; grid on + +end diff --git a/REGIONS/ellesmere.m b/REGIONS/ellesmere.m new file mode 100644 index 0000000..68cdfcf --- /dev/null +++ b/REGIONS/ellesmere.m @@ -0,0 +1,42 @@ +function varargout=ellesmere(res,buf) +% XY=ELLESMERE(res,buf) +% ELLESMERE(...) % Only makes a plot +% +% Finds the coordinates of Ellesmere, potentially buffered by some amount. +% +% INPUT: +% +% res 0 The standard, default values +% N Splined values at N times the resolution +% buf Distance in degrees that the region outline will be enlarged +% by BUFFERM, not necessarily integer, possibly negative +% [default: 0] +% +% OUTPUT: +% +% XY Closed-curved coordinates of the continent +% +% Last modified by fjsimons-at-alum.mit.edu, 09/23/2014 +% Last modified by charig-at-princeton.edu, 04/28/2015 + +defval('res',10) +defval('buf',0) + +% Parameters that make this the region in question +regn='ellesmere'; +c11=[267 85]; +%cmn=[300 76]; +cmn=[300 74]; +xunt=[61:245]; + + +% Do it! Make it, load it, save it +XY=regselect(regn,c11,cmn,xunt,res,buf); + +if nargout==0 + plot(XY(:,1),XY(:,2),'k-'); axis equal; grid on +end + +% Prepare optional output +varns={XY}; +varargout=varns(1:nargout); diff --git a/REGIONS/england.m b/REGIONS/england.m new file mode 100644 index 0000000..68a0671 --- /dev/null +++ b/REGIONS/england.m @@ -0,0 +1,43 @@ +function varargout=england(res,buf) +% XY=ENGLAND(res,buf) +% ENGLAND(...) % Only makes a plot +% +% Finds the coordinates of England, potentially buffered by some amount. +% +% INPUT: +% +% res 0 The standard, default values +% N Splined values at N times the resolution +% buf Distance in degrees that the region outline will be enlarged +% by BUFFERM, not necessarily integer, possibly negative +% [default: 0] +% +% OUTPUT: +% +% XY Closed-curved coordinates of the continent +% +% Last modified by charig-at-princeton.edu, 11/23/2011 +% Last modified by fjsimons-at-alum.mit.edu, 11/23/2011 + +defval('res',0) +defval('buf',0) + +% Parameters that make this the region in question +regn='england'; +c11=[353 59 ; 0 59]; +cmn=[360 49.75 ; 2 49.75]; +xunt=[61:68 9:60 72:80]; +ofs=[0 360]; + +% Do it! Make it, load it, save it +XY=regselect(regn,c11,cmn,xunt,res,buf,ofs); + +if nargout==0 + plot(XY(:,1),XY(:,2),'k-'); axis image; grid on +end + +% Prepare optional output +varns={XY}; +varargout=varns(1:nargout); + + diff --git a/REGIONS/eurasia.m b/REGIONS/eurasia.m new file mode 100644 index 0000000..9c311c3 --- /dev/null +++ b/REGIONS/eurasia.m @@ -0,0 +1,42 @@ +function varargout=eurasia(res,buf) +% XY=EURASIA(res,buf) +% EURASIA(...) % Only makes a plot +% +% Finds the coordinates of Eurasia, potentially buffered by some amount. +% +% INPUT: +% +% res 0 The standard, default values +% N Splined values at N times the resolution +% buf Distance in degrees that the region outline will be enlarged +% by BUFFERM, not necessarily integer, possibly negative +% [default: 0] +% +% OUTPUT: +% +% XY Closed-curved coordinates of the continent +% +% Last modified by charig-at-princeton.edu, 11/23/2011 +% Last modified by fjsimons-at-alum.mit.edu, 11/23/2011 + +defval('res',0) +defval('buf',0) + +% Parameters that make this the region in question +regn='eurasia'; +c11=[0 77.5 ; 350 50 ; 180 69]; +cmn=[180 8; 360 36 ; 190 64]; +xunt=[420:827 914:1023 1556:1605 1030:1548 1607:1639]; +ofs=[360 0 360]; + +% Do it! Make it, load it, save it +XY=regselect(regn,c11,cmn,xunt,res,buf,ofs); + +if nargout==0 + plot(XY(:,1),XY(:,2),'k-'); axis equal; grid on +end + +% Prepare optional output +varns={XY}; +varargout=varns(1:nargout); + diff --git a/REGIONS/greenland.m b/REGIONS/greenland.m new file mode 100644 index 0000000..bb4f8ed --- /dev/null +++ b/REGIONS/greenland.m @@ -0,0 +1,61 @@ +function varargout=greenland(res,buf,nearby) +% XY=GREENLAND(res,buf,nearby) +% GREENLAND(...) % Only makes a plot +% +% Finds the coordinates of Greenland, potentially buffered by some amount. +% +% INPUT: +% +% res 0 The standard, default values +% N Splined values at N times the resolution +% buf Distance in degrees that the region outline will be enlarged +% by BUFFERM, not necessarily integer, possibly negative +% [default: 0] +% nearby Subtract the nearby islands of Ellesmere and Baffin +% from your coordinates [default: 1] or 0 +% +% OUTPUT: +% +% XY Closed-curved coordinates of the continent +% +% Last modified by charig-at-princeton.edu, 07/10/2014 +% Last modified by fjsimons-at-alum.mit.edu, 11/23/2011 + +defval('res',0) +defval('buf',0) +defval('nearby',1) + +% Parameters that make this the region in question +regn='greenland'; +c11=[286.7 83.75]; +cmn=[349 59.75]; +xunt=1:352; + +% Do it! Make it, load it, save it +XY=regselect(regn,c11,cmn,xunt,res,buf); + +if nargout==0 + plot(XY(:,1),XY(:,2),'k-'); axis image; grid on +end + +% Subtract the nearby island of Ellsemere +if nearby + % NOTE: if you don't have the nearby stuff made at the desired buffer + % then this will just end in a recursive error. i.e. You should make + % Ellesmere first before trying to subtract it. + XY2 = ellesmereg(10,buf); + [x,y] = polybool('subtraction',XY(:,1),XY(:,2),XY2(:,1),XY2(:,2)); + XY = [x y]; + if buf>=2 + XY2 = baffing(10,1.5); + [x,y] = polybool('subtraction',XY(:,1),XY(:,2),XY2(:,1),XY2(:,2)); + XY = [x y]; + end +end + + + +% Prepare optional output +varns={XY}; +varargout=varns(1:nargout); + diff --git a/REGIONS/honshu.m b/REGIONS/honshu.m new file mode 100644 index 0000000..34a3850 --- /dev/null +++ b/REGIONS/honshu.m @@ -0,0 +1,42 @@ +function varargout=honshu(res,buf) +% XY=HONSHU(res,buf) +% HONSHU(...) % Only makes a plot +% +% Finds the coordinates of Honshu and Kyushu, potentially buffered by +% some amount. +% +% INPUT: +% +% res 0 The standard, default values +% N Splined values at N times the resolution +% buf Distance in degrees that the region outline will be enlarged +% by BUFFERM, not necessarily integer, possibly negative +% [default: 0] +% +% OUTPUT: +% +% XY Closed-curved coordinates of the island +% +% Last modified by fjsimons-at-alum.mit.edu, 09/24/2014 + +defval('res',0) +defval('buf',0) + +% Parameters that make this the region in question +regn='honshu'; +c11=[129 42]; +cmn=[146 30]; +xunt=[3:56]; +ofs=0; + +% Do it! Make it, load it, save it +XY=regselect(regn,c11,cmn,xunt,res,buf,ofs); + +if nargout==0 + plot(XY(:,1),XY(:,2),'k-'); axis image; grid on +end + +% Prepare optional output +varns={XY}; +varargout=varns(1:nargout); + diff --git a/REGIONS/madagascar.m b/REGIONS/madagascar.m new file mode 100644 index 0000000..2987e8d --- /dev/null +++ b/REGIONS/madagascar.m @@ -0,0 +1,42 @@ +function varargout=madagascar(res,scal) +% XY=MADAGASCAR(res,scal) +% MADAGASCAR(...) % Only makes a plot +% +% Finds the coordinates of Madagascar, potentially buffered by +% some amount. +% +% INPUT: +% +% res 0 The standard, default values +% N Splined values at N times the resolution +% buf Distance in degrees that the region outline will be enlarged +% by BUFFERM, not necessarily integer, possibly negative +% [default: 0] +% +% OUTPUT: +% +% XY Closed-curved coordinates of the island +% +% Last modified by fjsimons-at-alum.mit.edu, September 28, 2014 + +defval('res',0) +defval('buf',0) + +% Parameters that make this the region in question +regn='madagascar'; +c11=[41 -11]; +cmn=[52 -27]; +xunt=[1:35]; +ofs=0; + +% Do it! Make it, load it, save it +XY=regselect(regn,c11,cmn,xunt,res,buf,ofs); + +if nargout==0 + plot(XY(:,1),XY(:,2),'k-'); axis image; grid on +end + +% Prepare optional output +varns={XY}; +varargout=varns(1:nargout); + diff --git a/REGIONS/namerica.m b/REGIONS/namerica.m new file mode 100644 index 0000000..a4b6d2c --- /dev/null +++ b/REGIONS/namerica.m @@ -0,0 +1,40 @@ +function varargout=namerica(res,buf) +% XY=NAMERICA(res,buf) +% NAMERICA(...) % Only makes a plot +% +% Finds the coordinates of Namerica, potentially buffered by some amount. +% +% INPUT: +% +% res 0 The standard, default values +% N Splined values at N times the resolution +% buf Distance in degrees that the region outline will be enlarged +% by BUFFERM, not necessarily integer, possibly negative +% [default: 0] +% +% OUTPUT: +% +% XY Closed-curved coordinates of the continent +% +% Last modified by charig-at-princeton.edu, 11/23/2011 +% Last modified by fjsimons-at-alum.mit.edu, 11/23/2011 + +defval('res',0) +defval('buf',0) + +% Parameters that make this the region in question +regn='namerica'; +c11=[191 74.5]; +cmn=[304.5 12]; +xunt=[385:717 721:1004]; + +% Do it! Make it, load it, save it +XY=regselect(regn,c11,cmn,xunt,res,buf); + +if nargout==0 + plot(XY(:,1),XY(:,2),'k-'); axis equal; grid on +end + +% Prepare optional output +varns={XY}; +varargout=varns(1:nargout); diff --git a/REGIONS/newguinea.m b/REGIONS/newguinea.m new file mode 100644 index 0000000..8c109aa --- /dev/null +++ b/REGIONS/newguinea.m @@ -0,0 +1,42 @@ +function varargout=newguinea(res,scal) +% XY=NEWGUINEA(res,scal) +% NEWGUINEA(...) % Only makes a plot +% +% Finds the coordinates of New Guinea, potentially buffered by +% some amount. +% +% INPUT: +% +% res 0 The standard, default values +% N Splined values at N times the resolution +% buf Distance in degrees that the region outline will be enlarged +% by BUFFERM, not necessarily integer, possibly negative +% [default: 0] +% +% OUTPUT: +% +% XY Closed-curved coordinates of the island +% +% Last modified by fjsimons-at-alum.mit.edu, 09/28/2014 + +defval('res',0) +defval('buf',0) + +% Parameters that make this the region in question +regn='newguinea'; +c11=[130 0]; +cmn=[151 -13]; +xunt=[1:70]; +ofs=0; + +% Do it! Make it, load it, save it +XY=regselect(regn,c11,cmn,xunt,res,buf,ofs); + +if nargout==0 + plot(XY(:,1),XY(:,2),'k-'); axis image; grid on +end + +% Prepare optional output +varns={XY}; +varargout=varns(1:nargout); + diff --git a/REGIONS/orinoco.m b/REGIONS/orinoco.m new file mode 100644 index 0000000..097d8c5 --- /dev/null +++ b/REGIONS/orinoco.m @@ -0,0 +1,44 @@ +function varargout=orinoco(res,buf) +% XY=ORINOCO(res,buf) +% ORINOCO(...) % Only makes a plot +% +% Finds the coordinates of Orinoco, potentially buffered by some amount. +% +% INPUT: +% +% res 0 The standard, default values +% N Splined values at N times the resolution +% buf Distance in degrees that the region outline will be enlarged +% by BUFFERM, not necessarily integer, possibly negative +% [default: 0] +% +% OUTPUT: +% +% XY Closed-curved coordinates of the continent +% +% Last modified by charig-at-princeton.edu, 11/23/2011 +% Last modified by fjsimons-at-alum.mit.edu, 11/23/2011 + +defval('res',0) +defval('buf',0) + +% Parameters that make this the region in question +regn='orinoco'; +c11=[260 15]; +cmn=[345 -60]; +xunt=[]; + +% This admittedly is a special case +XY=load(fullfile(getenv('IFILES'),'COASTS','orinoco')); + +% Do it! Make it, load it, save it +XY=regselect(regn,XY(:,1),XY(:,2),xunt,res,buf); + +if nargout==0 + plot(XY(:,1),XY(:,2),'k-'); axis image; grid on +end + +% Prepare optional output +varns={XY}; +varargout=varns(1:nargout); + diff --git a/REGIONS/samerica.m b/REGIONS/samerica.m new file mode 100644 index 0000000..b612a29 --- /dev/null +++ b/REGIONS/samerica.m @@ -0,0 +1,40 @@ +function varargout=samerica(res,buf) +% XY=SAMERICA(res,buf) +% SAMERICA(...) % Only makes a plot +% +% Finds the coordinates of Samerica, potentially buffered by some amount. +% +% INPUT: +% +% res 0 The standard, default values +% N Splined values at N times the resolution +% buf Distance in degrees that the region outline will be enlarged +% by BUFFERM, not necessarily integer, possibly negative +% [default: 0] +% +% OUTPUT: +% +% XY Closed-curved coordinates of the continent +% +% Last modified by charig-at-princeton.edu, 11/23/2011 +% Last modified by fjsimons-at-alum.mit.edu, 11/23/2011 + +defval('res',0) +defval('buf',0) + +% Parameters that make this the region in question +regn='samerica'; +c11=[278.5 13]; +cmn=[326 -55.5]; +xunt=16:271; + +% Do it! Make it, load it, save it +XY=regselect(regn,c11,cmn,xunt,res,buf); + +if nargout==0 + plot(XY(:,1),XY(:,2),'k-'); axis equal; grid on +end + +% Prepare optional output +varns={XY}; +varargout=varns(1:nargout); diff --git a/REGIONS/sumatra.m b/REGIONS/sumatra.m new file mode 100644 index 0000000..d851425 --- /dev/null +++ b/REGIONS/sumatra.m @@ -0,0 +1,41 @@ +function varargout=sumatra(res,scal) +% XY=SUMATRA(res,scal) +% SUMATRA(...) % Only makes a plot +% +% Finds the coordinates of Sumatra, potentially buffered by +% some amount. +% +% INPUT: +% +% res 0 The standard, default values +% N Splined values at N times the resolution +% buf Distance in degrees that the region outline will be enlarged +% by BUFFERM, not necessarily integer, possibly negative +% [default: 0] +% +% OUTPUT: +% +% XY Closed-curved coordinates of the island +% +% Last modified by fjsimons-at-alum.mit.edu, September 28th, 2014 + +defval('res',0) +defval('buf',0) + +% Parameters that make this the region in question +regn='sumatra'; +c11=[94 6]; +cmn=[108 -6]; +xunt=[4:42]; +ofs=0; + +% Do it! Make it, load it, save it +XY=regselect(regn,c11,cmn,xunt,res,buf,ofs); + +if nargout==0 + plot(XY(:,1),XY(:,2),'k-'); axis image; grid on +end + +% Prepare optional output +varns={XY}; +varargout=varns(1:nargout);