Changeset 20730


Ignore:
Timestamp:
06/14/16 09:33:25 (9 years ago)
Author:
seroussi
Message:

CHG: cleaned pigregion

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/examples/Pig/PigRegion.m

    r19043 r20730  
    66
    77% Get necessary data to build up the velocity grid
    8 xmin = ncreadatt(nsidc_vel,'/','xmin');
     8xmin    = ncreadatt(nsidc_vel,'/','xmin');
     9ymax    = ncreadatt(nsidc_vel,'/','ymax');
     10spacing = ncreadatt(nsidc_vel,'/','spacing');
     11nx      = double(ncreadatt(nsidc_vel,'/','nx'));
     12ny      = double(ncreadatt(nsidc_vel,'/','ny'));
     13vx      = double(ncread(nsidc_vel,'vx'));
     14vy      = double(ncread(nsidc_vel,'vy'));
     15
    916xmin = 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
     17xmin = str2num(xmin(1:end-2));  % get rid of the unit and convert to double
    1218
    13 ymax = ncreadatt(nsidc_vel,'/','ymax');
    1419ymax = 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');
     20ymax = str2num(ymax(1:end-2)); 
    2021
    21 spacing = ncreadatt(nsidc_vel,'/','spacing');
    2222spacing = strtrim(spacing);
    23 spacing = spacing(1:end-2); 
    24 spacing = str2num(spacing);
     23spacing = str2num(spacing(1:end-2)); 
    2524
     25% Build the coordinates
     26x=xmin+(0:1:nx)'*spacing;
     27y=(ymax)-(0:1:ny)'*spacing;
    2628
    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
     30posx=find(x<=-12.0e5 & x>=-18.0e5);
     31x_pig=x(posx);
     32posy=find(y<=1.0e5 & y>-4.0e5);
     33y_pig=y(posy);
    3134
    32 posx=find(x<=-12.0e5);
    33 id1x=find(x>=-18.0e5,1);
    34 id2x=posx(end);
     35vx_pig=flipud(vx(posx,posy)');
     36vy_pig=flipud(vy(posx,posy)');
     37vel_pig=sqrt(vx_pig.^2+vy_pig.^2);
    3538
    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)
     39imagesc(x_pig,y_pig,vel_pig)
Note: See TracChangeset for help on using the changeset viewer.