Changeset 22803
- Timestamp:
- 05/24/18 10:28:17 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/examples/EsaGRACE/runme.m
r22796 r22803 1 1 2 2 clear all; 3 steps=[ 5]; % [1:6];3 steps=[0]; % [1:5]; 4 4 5 5 if any(steps==0) % Download GRACE land_mass data {{{ … … 42 42 md = loadmodel('./Models/EsaGRACE.Mesh'); 43 43 44 % define time interval for analysis 44 45 year_month = 2007+15/365; 45 time_min=year_month; 46 time_max=year_month; 47 46 time_range = [year_month year_month]; 47 48 48 % map GRACE water load on to the mesh for the seleted month(s) 49 water_load = grace(md.mesh.elements,md.mesh.lat,md.mesh.long,time_ min,time_max);49 water_load = grace(md.mesh.elements,md.mesh.lat,md.mesh.long,time_range(1),time_range(2)); 50 50 51 51 md.esa.deltathickness = water_load*md.materials.rho_freshwater/md.materials.rho_ice; % ice height equivalent … … 117 117 md = loadmodel('./Models/EsaGRACE.Solution'); 118 118 119 % solutions. 120 ur = md.results.EsaSolution.EsaUmotion*1000; % [mm] 121 un = md.results.EsaSolution.EsaNmotion*1000; % [mm] 122 ue = md.results.EsaSolution.EsaEmotion*1000; % [mm] 119 % loads and solutions. 120 sol1 = md.esa.deltathickness*100; % WEH cm 121 sol2 = md.results.EsaSolution.EsaUmotion*1000; % [mm] 122 sol3 = md.results.EsaSolution.EsaNmotion*1000; % [mm] 123 sol4 = md.results.EsaSolution.EsaEmotion*1000; % [mm] 124 sol_name={'Change in water equivalent height [cm]', 'Vertical displacement [mm]',... 125 'Horizontal (NS) displacement [mm]', 'Horizontal (EW) displacement [mm]'}; 123 126 124 127 res = 1.0; % degree … … 128 131 sol_grid = zeros(size(lat_grid)); 129 132 130 sol = ue; 133 for kk=1:4 134 sol=eval(sprintf('sol%d',kk)); 135 136 % if data are on elements, map those on to the vertices {{{ 137 if length(sol)==md.mesh.numberofelements 138 % map on to the vertices 139 for jj=1:md.mesh.numberofelements 140 ii=(jj-1)*3; 141 pp(ii+1:ii+3)=md.mesh.elements(jj,:); 142 end 143 for jj=1:md.mesh.numberofvertices 144 pos=ceil(find(pp==jj)/3); 145 temp(jj)=mean(sol(pos)); 146 end 147 sol=temp'; 148 end % }}} 131 149 132 % Make a interpolation object133 F = scatteredInterpolant(md.mesh.lat,md.mesh.long,sol);134 F.Method = 'linear';135 F.ExtrapolationMethod = 'linear';150 % Make a interpolation object 151 F = scatteredInterpolant(md.mesh.lat,md.mesh.long,sol); 152 F.Method = 'linear'; 153 F.ExtrapolationMethod = 'linear'; 136 154 137 % Do the interpolation to get gridded solutions... 138 sol_grid = F(lat_grid, lon_grid); 139 sol_grid(isnan(sol_grid))=0; 155 % Do the interpolation to get gridded solutions... 156 sol_grid = F(lat_grid, lon_grid); 157 sol_grid(isnan(sol_grid))=0; 158 sol_grid(lat_grid>85 & sol_grid==0) =NaN; % set polar unphysical 0s to Nan 140 159 141 % set polar unphysical 0s to Nan 142 sol_grid(lat_grid>85 & sol_grid==0) =NaN; 160 set(0,'DefaultAxesFontSize',18,'DefaultAxesLineWidth',1,'DefaultTextFontSize',18,'DefaultLineMarkerSize',8) 161 figure1=figure('Position', [100, 100, 1000, 500]); 162 gcf; 163 load coast; 164 cla; 165 pcolor(lon_grid,lat_grid,sol_grid); shading flat; hold on; 166 plot(long,lat,'k'); hold off; 167 c1=colorbar; 168 colormap(jet); 169 xlim([-180 180]); 170 ylim([-90 90]); 171 grid on; 172 title(sol_name(kk)); 173 set(gcf,'color','w'); 143 174 144 set(0,'DefaultAxesFontSize',18,'DefaultAxesLineWidth',1,'DefaultTextFontSize',18,'DefaultLineMarkerSize',8) 145 figure1=figure('Position', [100, 100, 1000, 500]); 146 gcf; 147 load coast; 148 cla; 149 pcolor(lon_grid,lat_grid,sol_grid); shading flat; 150 %caxis([-0.3 0.3]) 151 hold on 152 plot(long,lat,'k'); 153 %geoshow(lat,long,'DisplayType','polygon','FaceColor','white'); 154 hold off; 155 c1=colorbar; 156 colormap(jet); 157 xlim([-180 180]); 158 ylim([-90 90]); 159 grid on; 160 title(['Average change in relative sea-level [mm/yr]']); 161 set(gcf,'color','w'); 162 163 %export_fig('Fig5.pdf'); 175 %export_fig('Fig5.pdf'); 176 end 164 177 165 178 end % }}} 166 179 167 if any(steps==6) % {{{ Transient168 disp(' Step 6: Transient run');169 170 end % }}}171
Note:
See TracChangeset
for help on using the changeset viewer.