Changeset 20487
- Timestamp:
- 04/09/16 13:58:08 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified issm/trunk-jpl/src/m/plot/radarpower.m ¶
r19935 r20487 34 34 y0=min(ylim); y1=max(ylim); 35 35 36 %figure out if we should go look for Greenland or Antarctica geotiff, or if user provided one. 37 if ~exist(options,'overlay_image'), 36 if ~exist(options,'overlay_image'), % no image provided, go look into ModelData for one!{{{ 38 37 if md.mesh.epsg==3413, %Greenland 39 38 %old code {{{ … … 143 142 144 143 else 145 error('EPSG code not supported yet (ex: 3413 for UPS Greenland, 3031 for UPS Antarctica)'); 146 end 147 else 144 if ~exist(options,'geotiff_name'), 145 error('Need a geotiff for areas outside of Greenland and Antarctica'); 146 end 147 148 %Name of image 149 inputname='./temp.tif'; 150 eval(['!gdal_translate -quiet -projwin ' num2str(x0) ' ' num2str(y1) ' ' num2str(x1) ' ' num2str(y0) ' ' geotiff_name ' ' inputname ]); 151 152 %Read in temp.tif: 153 im=imread('temp.tif','TIFF'); 154 %adjust contrast and brightness 155 %im=imadjust(im,[a b],[c d]); 156 pixelskip=max(1,ceil(posting/((x1-x0)/(size(im,2))))); 157 md.radaroverlay.pwr=double(flipud(im(1:pixelskip:end,1:pixelskip:end))); 158 md.radaroverlay.x=(x0:(x1-x0)/(size(md.radaroverlay.pwr,2)-1):x1); 159 md.radaroverlay.y=(y0:(y1-y0)/(size(md.radaroverlay.pwr,1)-1):y1); 160 161 %Erase image or keep it? 162 if ~getfieldvalue(options,'keep_image',0), 163 system('rm -rf ./temp.tif'); 164 end 165 end 166 %}}} 167 else %user provided image {{{ 148 168 %user provided an image. check we also have overlay_xlim and overlay_ylim options, to know what range of coordinates the image covers. 149 169 if (~exist(options,'overlay_xlim') | ~exist(options,'overlay_xlim')| ~exist(options,'overlay_xposting')| ~exist(options,'overlay_yposting')), 150 170 error('radarpower error message: please provide overlay_xlim, overlay_ylim, overlay_xposting and overlay_yposting options together with overlay_image option'); 151 171 end 152 overlay_image=getfieldvalue(options,'overlay_image'); 153 overlay_xlim=getfieldvalue(options,'overlay_xlim'); 154 overlay_ylim=getfieldvalue(options,'overlay_ylim'); 155 overlay_xposting=getfieldvalue(options,'overlay_xposting'); 156 overlay_yposting=getfieldvalue(options,'overlay_yposting'); 157 158 sizex=floor((x1-x0)/overlay_xposting); 159 sizey=floor((y1-y0)/overlay_yposting); 160 topleftx=floor((x0-overlay_xlim(1))/overlay_xposting); % x min 161 toplefty=floor((overlay_ylim(2)-y1)/overlay_yposting); % y max 172 overlay_image=getfieldvalue(options,'overlay_image') 173 overlay_xlim=getfieldvalue(options,'overlay_xlim') 174 x0 175 x1 176 overlay_ylim=getfieldvalue(options,'overlay_ylim') 177 overlay_xposting=getfieldvalue(options,'overlay_xposting') 178 overlay_yposting=getfieldvalue(options,'overlay_yposting') 179 180 sizex=floor((x1-x0)/overlay_xposting) 181 sizey=floor((y1-y0)/overlay_yposting) 182 topleftx=floor((x0-overlay_xlim(1))/overlay_xposting) % x min 183 toplefty=floor((overlay_ylim(2)-y1)/overlay_yposting) % y max 162 184 163 185 %Read and crop file … … 170 192 md.radaroverlay.x=(x0:(x1-x0)/(size(md.radaroverlay.pwr,2)-1):x1); 171 193 md.radaroverlay.y=(y0:(y1-y0)/(size(md.radaroverlay.pwr,1)-1):y1); 172 end 173 174 %Was a triangulation requested for the area of the image that is not covered by the mesh? 194 end %}}} 195 196 %Was a triangulation requested for the area of the image that is not covered by the mesh? %{{{ 175 197 if strcmpi(getfieldvalue(options,'outertriangulation','no'),'yes'), 176 198 … … 184 206 185 207 %inner hole from mesh segments: 186 box(2).x= [md.mesh.x(md.mesh.segments(:,1)); md.mesh.x(md.mesh.segments(end,2))];208 box(2).x=md.mesh.x(md.mesh.segments(:,1)); 187 209 box(2).x=[box(2).x; box(2).x(1)]; 188 box(2).y= [md.mesh.y(md.mesh.segments(:,1)); md.mesh.y(md.mesh.segments(end,2))];210 box(2).y=md.mesh.y(md.mesh.segments(:,1)); 189 211 box(2).y=[box(2).y; box(2).y(1)]; 190 212 … … 200 222 maxarea=max(GetAreas(md.mesh.elements,md.mesh.x,md.mesh.y)); 201 223 outermd=triangle(model(),'./outertriangulation.exp',sqrt(maxarea)); 224 %outermd=bamg(model(),'domain','./outertriangulation.exp','hmin',sqrt(maxarea)); 202 225 203 226 %save the triangulation: … … 206 229 md.radaroverlay.outery=outermd.mesh.y; 207 230 208 end 231 end %}}}
Note:
See TracChangeset
for help on using the changeset viewer.