Changeset 20730
- Timestamp:
- 06/14/16 09:33:25 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/examples/Pig/PigRegion.m
r19043 r20730 6 6 7 7 % Get necessary data to build up the velocity grid 8 xmin = ncreadatt(nsidc_vel,'/','xmin'); 8 xmin = ncreadatt(nsidc_vel,'/','xmin'); 9 ymax = ncreadatt(nsidc_vel,'/','ymax'); 10 spacing = ncreadatt(nsidc_vel,'/','spacing'); 11 nx = double(ncreadatt(nsidc_vel,'/','nx')); 12 ny = double(ncreadatt(nsidc_vel,'/','ny')); 13 vx = double(ncread(nsidc_vel,'vx')); 14 vy = double(ncread(nsidc_vel,'vy')); 15 9 16 xmin = strtrim(xmin); % this is a string, and we need to recover the double value 10 xmin = xmin(1:end-2); % get rid of the unit 11 xmin = str2num(xmin); % convert to double 17 xmin = str2num(xmin(1:end-2)); % get rid of the unit and convert to double 12 18 13 ymax = ncreadatt(nsidc_vel,'/','ymax');14 19 ymax = strtrim(ymax); 15 ymax = ymax(1:end-2); 16 ymax = str2num(ymax); 17 18 nx = ncreadatt(nsidc_vel,'/','nx'); 19 ny = ncreadatt(nsidc_vel,'/','ny'); 20 ymax = str2num(ymax(1:end-2)); 20 21 21 spacing = ncreadatt(nsidc_vel,'/','spacing');22 22 spacing = strtrim(spacing); 23 spacing = spacing(1:end-2); 24 spacing = str2num(spacing); 23 spacing = str2num(spacing(1:end-2)); 25 24 25 % Build the coordinates 26 x=xmin+(0:1:nx)'*spacing; 27 y=(ymax)-(0:1:ny)'*spacing; 26 28 27 x=xmin+(0:1:nx-1)'*spacing; 28 x=double(x); 29 y=(ymax)-(0:1:ny-1)'*spacing; 30 y=double(y); 29 %Limit the region to Pine Island 30 posx=find(x<=-12.0e5 & x>=-18.0e5); 31 x_pig=x(posx); 32 posy=find(y<=1.0e5 & y>-4.0e5); 33 y_pig=y(posy); 31 34 32 posx=find(x<=-12.0e5);33 id1x=find(x>=-18.0e5,1);34 id2x=posx(end);35 vx_pig=flipud(vx(posx,posy)'); 36 vy_pig=flipud(vy(posx,posy)'); 37 vel_pig=sqrt(vx_pig.^2+vy_pig.^2); 35 38 36 posy=find(y>=-4.0e5); 37 id1y=find(y<=1.0e5,1); 38 id2y=posy(end); 39 40 %Get velocity subset 41 vx = double(ncread(nsidc_vel,'vx')); 42 vx_obs = vx(id1x:id2x,id1y:id2y); 43 vx_obs = flipud(vx_obs'); 44 45 vy = double(ncread(nsidc_vel,'vy')); 46 vy_obs = vy (id1x:id2x,id1y:id2y); 47 vy_obs = flipud(vy_obs'); 48 49 xred=x(id1x:id2x); 50 yred=y(id1y:id2y); 51 vel_obs=sqrt(vx_obs.^2.+vy_obs.^2.); 52 imagesc(xred,yred,vel_obs) 39 imagesc(x_pig,y_pig,vel_pig)
Note:
See TracChangeset
for help on using the changeset viewer.