Changeset 24747


Ignore:
Timestamp:
04/27/20 13:03:04 (5 years ago)
Author:
Mathieu Morlighem
Message:

CHG: much faster interp from geotiff

Location:
issm/trunk-jpl/src/m/contrib/morlighem/modeldata
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified issm/trunk-jpl/src/m/contrib/morlighem/modeldata/interpBedmachineGreenland.m

    r23875 r24747  
    3333        ncdate='2018-06-01';
    3434        ncdate='2019-04-18';
     35        ncdate='2020-04-14';
    3536end
    3637
  • TabularUnified issm/trunk-jpl/src/m/contrib/morlighem/modeldata/interpFromGeotiff.m

    r23873 r24747  
    3333
    3434        %Read image
    35         data=double(flipud(imread(geotiffname)));
     35        if 1
     36                assert(dx>0); assert(dy>0);
     37                ydata = fliplr(ydata);
     38
     39                %Get pixels we are interested in
     40                offset=2;
     41                xmin=min(X(:)); xmax=max(X(:));
     42                posx=find(xdata<=xmax);
     43                id1x=max(1,find(xdata>=xmin,1)-offset);
     44                id2x=min(numel(xdata),posx(end)+offset);
     45
     46                ymin=min(Y(:)); ymax=max(Y(:));
     47                posy=find(ydata>=ymin);
     48                id1y=max(1,find(ydata<=ymax,1)-offset);
     49                id2y=min(numel(ydata),posy(end)+offset);
     50
     51                data  = double(imread(geotiffname,'PixelRegion',{[id1y,id2y],[id1x,id2x]}));
     52                xdata=xdata(id1x:id2x);
     53                ydata=ydata(id1y:id2y);
     54        else
     55                data=double(flipud(imread(geotiffname)));
     56        end
    3657        data(find(abs(data)>10^30))=NaN;
     58
    3759end
    3860
Note: See TracChangeset for help on using the changeset viewer.