Changeset 20111
- Timestamp:
- 02/10/16 12:35:12 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/mesh/patchglobe.m
r19954 r20111 5 5 6 6 %recover basic options: 7 hem=getfieldvalue(options,'hem');8 7 bandwidth=getfieldvalue(options,'bandwidth',100000); 9 8 10 9 %give ourselves a unique temporary directory: 11 10 temproot=tempname; mkdir(temproot); 11 12 %align external segments on 2d model: 13 mh2d.segments=alignsegments(mh2d.segments); 12 14 13 15 %figure out domain outline: … … 18 20 expcontract([temproot '/PatchBroad.exp'],[temproot '/PatchBroad.exp'],-bandwidth); 19 21 20 %now flag vertices that are within the contour: 21 [x,y]=ll2xy(mh.lat,mh.long,hem); 22 if hem==1, 23 flagsnods=ContourToNodes(x,y,[temproot '/PatchBroad.exp'],1) & mh.lat>=0; 24 else 25 flagsnods=ContourToNodes(x,y,[temproot '/PatchBroad.exp'],1) & mh.lat<=0; 26 end 22 %now flag vertices (from mh2d's broad contour that are on the global mesh: do this in the local 2d mesh reference system. 23 [x,y]=gdaltransform(mh.long,mh.lat,'EPSG:4326',['EPSG:' num2str(mh2d.epsg)]); 24 flagsnods=ContourToNodes(x,y,[temproot '/PatchBroad.exp'],1); 27 25 28 26 %expand flags to any element that touches the contour: … … 37 35 38 36 %x,y for segments: 39 [xsegs,ysegs]= ll2xy(mh.lat(mh.segments(:,1)),mh.long(mh.segments(:,1)),hem);37 [xsegs,ysegs]=gdaltransform(mh.long(mh.segments(:,1)),mh.lat(mh.segments(:,1)),'EPSG:4326',['EPSG:' num2str(mh2d.epsg)]); 40 38 41 %create contour out of these segments:39 %create lat,long contour out of these segments: 42 40 meshtodomain(mh,[temproot '/PatchEnveloppe.exp'],'latlong','on'); 43 expll2xy([temproot '/PatchEnveloppe.exp'],hem); 41 42 %get these lat,long transformed to local mesh referencial: 43 env=expread([temproot '/PatchEnveloppe.exp']); 44 [env.x,env.y]=gdaltransform(env.x,env.y,'EPSG:4326',['EPSG:' num2str(mh2d.epsg)]); 44 45 45 46 %now, create domain outine from broad enveloppe and initial mesh 46 env=expread([temproot '/PatchEnveloppe.exp']);47 47 dom=expread([temproot '/Patch.exp']); 48 48 … … 61 61 expwrite(domain,[temproot '/PatchBand.exp']); 62 62 63 %plot mesh: 64 if getfieldvalue(options,'plot',0), expdisp([temproot '/PatchBand.exp']); end 65 63 66 %mesh: 64 67 mdb=bamg(model(),'domain',[temproot '/PatchBand.exp'],'MaxCornerAngle',1e-15,'gradation',10000); … … 71 74 72 75 %augment patch with band 73 [mhb.l at,mhb.long]=xy2ll(mhb.x,mhb.y,hem);76 [mhb.long,mhb.lat]=gdaltransform(mhb.x,mhb.y,['EPSG:' num2str(mh2d.epsg)],'EPSG:4326'); 74 77 mh2db=augment2dmesh(mh2d,mhb); 75 78
Note:
See TracChangeset
for help on using the changeset viewer.