Changeset 22809
- Timestamp:
- 05/29/18 14:07:24 (7 years ago)
- Location:
- issm/trunk-jpl/examples
- Files:
-
- 3 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/examples/EsaGRACE/runme.m
r22803 r22809 1 1 2 2 clear all; 3 steps=[0 ]; % [1:5];3 steps=[0:5]; % [1:5]; 4 4 5 5 if any(steps==0) % Download GRACE land_mass data {{{ -
issm/trunk-jpl/examples/SlrGRACE/runme.m
r22804 r22809 1 1 2 2 clear all; 3 steps=[5]; % [1:6]; 3 addpath('../Data','../Functions'); 4 5 steps=[7]; % [0:7]; 4 6 5 7 if any(steps==0) % Download GRACE land_mass data {{{ … … 11 13 cd(f,'allData/tellus/L3/land_mass/RL05/netcdf/'); 12 14 mget(f,'GRCTellus.JPL.200204_201701.LND.RL05_1.DSTvSCS1411.nc'); 15 16 !mv *.nc '../Data/' 13 17 14 18 % display the content of the netcdf file. … … 32 36 md.mesh=gmshplanet('radius',radius*1e-3,'resolution',resolution*1e-3); % attributes should be in km. 33 37 34 for i=1:numrefine ,38 for i=1:numrefine; % refine mesh... {{{ 35 39 36 40 %figure out mask: … … 66 70 %use distance to the coastline to refine mesh: 67 71 md.mesh=gmshplanet('radius',radius*1e-3,'resolution',resolution*1e-3,'refine',md.mesh,'refinemetric',dist); 68 end 72 end % }}} 69 73 70 74 %figure out mask: … … 156 160 md.slr.rotation=1; 157 161 158 % Request outputs159 % md.slr.requested_outputs = {'SlrUmotion','SlrNmotion','SlrEmotion'};160 161 162 % Cluster info 162 163 md.cluster=generic('name',oshostname(),'np',3); … … 206 207 F.Method = 'linear'; 207 208 F.ExtrapolationMethod = 'linear'; 208 209 209 210 % Do the interpolation to get gridded solutions... 210 211 sol_grid = F(lat_grid, lon_grid); … … 214 215 set(0,'DefaultAxesFontSize',18,'DefaultAxesLineWidth',1,'DefaultTextFontSize',18,'DefaultLineMarkerSize',8) 215 216 figure1=figure('Position', [100, 100, 1000, 500]); 216 gcf; 217 load coast; 218 cla; 219 pcolor(lon_grid,lat_grid,sol_grid); shading flat; hold on; 217 gcf; load coast; cla; 218 pcolor(lon_grid,lat_grid,sol_grid); shading flat; hold on; 219 % mask out land or oceans {{{ 220 if (kk==1) 221 geoshow(flipud(lat),flipud(long),'DisplayType','polygon','FaceColor','white'); 222 else 223 geoshow(lat,long,'DisplayType','polygon','FaceColor','white'); 224 end % }}} 220 225 plot(long,lat,'k'); hold off; 226 % define colormap, caxis, xlim etc {{{ 221 227 c1=colorbar; 222 colormap(jet); 228 colormap('haxby'); 229 caxis([-floor(min(abs(min(sol)),abs(max(sol)))) floor(min(abs(min(sol)),abs(max(sol))))]) 223 230 xlim([-180 180]); 224 231 ylim([-90 90]); 232 % }}} 225 233 grid on; 226 234 title(sol_name(kk)); … … 237 245 238 246 % read GRACE data during the chosen time period << steps=2 >> 239 disp('Projecting graceloads onto the mesh...');247 disp('Projecting loads onto the mesh...'); 240 248 time_range = 2007 + [15 350]/365; 241 249 water_load = grace(md.mesh.elements,md.mesh.lat,md.mesh.long,time_range(1),time_range(2)); … … 261 269 md.settings.output_frequency=1; 262 270 263 % Request outputs264 md.slr.requested_outputs = {'SlrUmotion','SlrNmotion','SlrEmotion'};265 266 271 % Cluster info 267 272 md.cluster=generic('name',oshostname(),'np',3); … … 271 276 md=solve(md,'tr'); 272 277 273 end % }}} 274 278 save ./Models/SlrGRACE.Transient md; 279 280 end % }}} 281 282 if any(steps==7) % Plot transient {{{ 283 disp(' Step 7: Plot transient'); 284 md = loadmodel('./Models/SlrGRACE.Transient'); 285 286 time = md.slr.deltathickness(end,:); % year 287 288 % loads and solutions. 289 for tt=1:length(time) 290 gmsl(tt) = md.results.TransientSolution(tt).SealevelEustatic*1000; % GMSL rate mm/yr 291 sol1(:,tt) = md.slr.deltathickness(1:end-1,tt)*100; % ice equivalent height [cm/yr] 292 %% something weired happened here!!! first month solution is duplicated. Use offset of 1. Will fix it asap! 293 sol2(:,tt) = md.results.TransientSolution(tt+1).Sealevel*1000; % mm/yr 294 end 295 sol_name = {'Change in water equivalent height [cm]', 'Relative sea-level [mm]'}; 296 movie_name = {'movie_loads.avi','movie_fingerprints.avi'}; 297 298 res = 1.0; % degree 299 300 % Make a grid of lats and lons, based on the min and max of the original vectors 301 [lat_grid, lon_grid] = meshgrid(linspace(-90,90,180/res), linspace(-180,180,360/res)); 302 sol_grid = zeros(size(lat_grid)); 303 304 for kk=1:2 305 sol=eval(sprintf('sol%d',kk)); 306 307 % if data are on elements, map those on to the vertices {{{ 308 if length(sol)==md.mesh.numberofelements 309 % map on to the vertices 310 for jj=1:md.mesh.numberofelements 311 ii=(jj-1)*3; 312 pp(ii+1:ii+3)=md.mesh.elements(jj,:); 313 end 314 for jj=1:md.mesh.numberofvertices 315 pos=ceil(find(pp==jj)/3); 316 temp2(jj,:)=mean(sol(pos,:)); 317 end 318 sol=temp2; 319 end % }}} 320 321 vidObj = VideoWriter(movie_name{kk}); 322 vidObj.FrameRate=2; % frames per second 323 open(vidObj); 324 325 for jj=1:length(time) 326 % Make a interpolation object 327 F = scatteredInterpolant(md.mesh.lat,md.mesh.long,sol(:,jj)); 328 F.Method = 'linear'; 329 F.ExtrapolationMethod = 'linear'; 330 331 % Do the interpolation to get gridded solutions... 332 sol_grid = F(lat_grid, lon_grid); 333 sol_grid(isnan(sol_grid))=0; 334 sol_grid(lat_grid>85 & sol_grid==0) =NaN; % set polar unphysical 0s to Nan 335 336 set(0,'DefaultAxesFontSize',18,'DefaultAxesLineWidth',1,'DefaultTextFontSize',18,'DefaultLineMarkerSize',8) 337 figure1=figure('Position', [100, 100, 1000, 500]); 338 gcf; load coast; cla; 339 pcolor(lon_grid,lat_grid,sol_grid); shading flat; hold on; 340 % mask out land or oceans {{{ 341 if (kk==1) 342 geoshow(flipud(lat),flipud(long),'DisplayType','polygon','FaceColor','white'); 343 else 344 geoshow(lat,long,'DisplayType','polygon','FaceColor','white'); 345 end % }}} 346 plot(long,lat,'k'); hold off; 347 % define colormap, caxis, xlim etc {{{ 348 c1=colorbar; 349 colormap('haxby'); 350 caxis([-floor(min(abs(min(min(sol))),abs(max(max(sol))))) floor(min(abs(min(min(sol))),abs(max(max(sol)))))]) 351 xlim([-180 180]); 352 ylim([-90 90]); 353 % }}} 354 grid on; 355 title(sol_name(kk)); 356 set(gcf,'color','w'); 357 writeVideo(vidObj,getframe(gcf)); 358 close % close current figure 359 end 360 361 % Close the file. 362 close(vidObj); 363 end 364 !open *.avi; 365 366 % plot GMSL time series 367 plot(time,gmsl,'-*','linewidth',3); grid on; 368 xlabel('# month'); 369 ylabel('GMSL [mm/yr]'); 370 set(gcf,'color','w'); 371 372 %export_fig('Fig7.pdf'); 373 374 end % }}} 375
Note:
See TracChangeset
for help on using the changeset viewer.