| 1 | function diagnostics(md,varargin)
|
|---|
| 2 | %DIAGNOSTICS: output all sort of information as shape files.
|
|---|
| 3 |
|
|---|
| 4 | %process options:
|
|---|
| 5 | options=pairoptions(varargin{:});
|
|---|
| 6 | path=getfieldvalue(options,'path','./');
|
|---|
| 7 |
|
|---|
| 8 | %mesh:
|
|---|
| 9 | if getfieldvalue(options,'mesh',0),
|
|---|
| 10 | mesh2shp(md,[path '/mesh']);
|
|---|
| 11 | end
|
|---|
| 12 |
|
|---|
| 13 | %grounding line :
|
|---|
| 14 | if getfieldvalue(options,'gl',0),
|
|---|
| 15 | contours=contourlevelzero(md,md.mask.groundedice_levelset,0);
|
|---|
| 16 | expwrite(contours,[path '/groundingline.exp']);
|
|---|
| 17 | exp2shp([path '/groundingline.shp'],[path '/groundingline.exp']);
|
|---|
| 18 | end
|
|---|
| 19 |
|
|---|
| 20 | %velocity:
|
|---|
| 21 | if exist(options,'vel'),
|
|---|
| 22 | vel=getfieldvalue(options,'vel',md.initialization.vel);
|
|---|
| 23 | xposting=getfieldvalue(options,'velposting',500);
|
|---|
| 24 | yposting=getfieldvalue(options,'velposting',500);
|
|---|
| 25 |
|
|---|
| 26 | xmin=min(md.mesh.x); ymax=max(md.mesh.y);
|
|---|
| 27 | ncols=(max(md.mesh.x)-min(md.mesh.x))/xposting+1;
|
|---|
| 28 | nlines=(max(md.mesh.y)-min(md.mesh.y))/yposting+1;
|
|---|
| 29 |
|
|---|
| 30 | [xm,ym,vel]=InterpFromMeshToGrid(md.mesh.elements,md.mesh.x,md.mesh.y,vel,xmin,ymax,xposting,yposting,nlines,ncols,0);
|
|---|
| 31 | vel=uint16(flipud(vel));
|
|---|
| 32 |
|
|---|
| 33 | imwrite(vel,[path '/vel.tif'],'tiff');
|
|---|
| 34 |
|
|---|
| 35 | string=sprintf('!gdal_translate -a_srs EPSG:3031 -a_ullr %g %g %g %g %s/vel.tif %s/velg.tif',...
|
|---|
| 36 | min(md.mesh.x),max(md.mesh.y),max(md.mesh.x),min(md.mesh.y),path,path);
|
|---|
| 37 | eval(string);
|
|---|
| 38 |
|
|---|
| 39 | end
|
|---|
| 40 |
|
|---|
| 41 | %hot spots:
|
|---|
| 42 | if getfieldvalue(options,'hotspots',0),
|
|---|
| 43 | threshold=getfieldvalue(options,'threshold',5000);
|
|---|
| 44 | i=getfieldvalue(options,'hotspotsi',length(md.results.TransientSolution));
|
|---|
| 45 | pos=find(md.results.TransientSolution(i).Vel>threshold);
|
|---|
| 46 | contour.x=md.mesh.x(pos); contour.y=md.mesh.y(pos); contour.density=1;
|
|---|
| 47 | expwrite(contour,[path '/hotspots.exp']);
|
|---|
| 48 | exp2shp([path '/hotspots.shp'],[path '/hotspots.exp']);
|
|---|
| 49 | end
|
|---|