source: issm/oecreview/Archive/14312-15392/ISSM-15148-15149.diff@ 15393

Last change on this file since 15393 was 15393, checked in by Mathieu Morlighem, 12 years ago

NEW: adding Archive/14312-15392 for oecreview

File size: 2.8 KB
RevLine 
[15393]1Index: ../trunk-jpl/src/m/plot/plot_googlemaps.m
2===================================================================
3--- ../trunk-jpl/src/m/plot/plot_googlemaps.m (revision 15148)
4+++ ../trunk-jpl/src/m/plot/plot_googlemaps.m (revision 15149)
5@@ -15,8 +15,8 @@
6 error('buildgridded error message: gridded not supported for 3d meshes, project on a layer');
7 end
8
9-if ~any(isnan(md.radaroverlay.x)) & ~any(isnan(md.radaroverlay.y)) & ~any(isnan(md.radaroverlay.pwr)) &...
10- size(md.radaroverlay.pwr,3)==3 & all(size(md.radaroverlay.x)==size(md.radaroverlay.pwr)),
11+if ~any(isnan(md.radaroverlay.x(:))) & ~any(isnan(md.radaroverlay.y(:))) & ~any(isnan(md.radaroverlay.pwr(:))) ...
12+ & size(md.radaroverlay.pwr,3)==3 & size(md.radaroverlay.x,2)==size(md.radaroverlay.pwr,2),
13 disp('plot_googlemaps info: the RGB image held by the model is being used');
14 else
15 disp('Extracting image from Google maps...');
16@@ -81,8 +81,6 @@
17 if ~isnan(data_min),
18 options=changefieldvalue(options,'caxis',[data_min data_max]); % force caxis so that the colorbar is ready
19 end
20-options=addfielddefault(options,'xlim',xlim); % default xlim
21-options=addfielddefault(options,'ylim',ylim); % default ylim
22 options=addfielddefault(options,'axis','xy equal off'); % default axis
23 applyoptions(md,data,options);
24 end
25Index: ../trunk-jpl/src/m/plot/googlemaps.m
26===================================================================
27--- ../trunk-jpl/src/m/plot/googlemaps.m (revision 15148)
28+++ ../trunk-jpl/src/m/plot/googlemaps.m (revision 15149)
29@@ -2,6 +2,7 @@
30 %GOOGLEMAPS - Extract image from Google maps for given region
31 %
32 % Usage:
33+% md = googlemaps(md)
34 % md = googlemaps(md,ullat,ullon,lrlat,lrlon)
35 % md = googlemaps(md,ullat,ullon,lrlat,lrlon,options)
36 %
37@@ -12,10 +13,7 @@
38 % - zoom: zoom level, between 1 and 21 (default dynamically calculated)
39
40 %Parse inputs
41-if nargin<5,
42- help googlemaps
43- error('Wrong usage');
44-elseif nargin==5,
45+if nargin<=5,
46 options=pairoptions;
47 else
48 options=varargin{:};
49@@ -23,7 +21,23 @@
50 options=pairoptions(varargin{:});
51 end
52 end
53+if nargin==1,
54+ %Get xlim and ylim (used to extract Google maps image)
55+ xlim=getfieldvalue(options,'xlim',[min(md.mesh.x) max(md.mesh.x)]);
56+ ylim=getfieldvalue(options,'ylim',[min(md.mesh.y) max(md.mesh.y)]);
57+ [latlist lonlist]= xy2ll(...
58+ [linspace(xlim(1),xlim(2),100) linspace(xlim(2),xlim(2),100) linspace(xlim(2),xlim(1),100) linspace(xlim(1),xlim(1),100)],...
59+ [linspace(ylim(1),ylim(1),100) linspace(ylim(1),ylim(2),100) linspace(ylim(2),ylim(2),100) linspace(ylim(2),ylim(1),100)],...
60+ +1,45,70);
61
62+ %Image corners in lat/long
63+ ullat = max(latlist); ullon = min(lonlist);
64+ lrlat = min(latlist); lrlon = max(lonlist);
65+elseif nargin>1 & nargin<5,
66+ help googlemaps
67+ error('Wrong usage');
68+end
69+
70 %Find optimal zoom
71 if exist(options,'zoom'),
72 zoom = getfieldvalue(options,'zoom');
Note: See TracBrowser for help on using the repository browser.