Changeset 25776


Ignore:
Timestamp:
11/21/20 11:18:50 (4 years ago)
Author:
Eric.Larour
Message:

CHG: diverse

Location:
issm/branches/trunk-larour-SLPS2020/src/m/contrib/larour
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • issm/branches/trunk-larour-SLPS2020/src/m/contrib/larour/isintriangle.m

    r24845 r25776  
    1010
    1111        a = y23 * dx + x32 * dy;
     12        if isnan(a),
     13                isin=0;
     14                return;
     15        end
    1216        if (a < minD || a > maxD)
    1317                isin=0;
  • issm/branches/trunk-larour-SLPS2020/src/m/contrib/larour/ismip6.m

    r25724 r25776  
    246246                                        for j=1:size(hg,2),
    247247                                                hgj=hg(:,j);
    248                                                 pos=find(hgj>.99); %we want fully grounded
    249                                                 %pos=find(hgj>0); %we want slightly grounded
     248                                                pos=find(hgj>0); %we want slightly grounded
    250249                                                hgv(md.mesh.elements(pos,:),j)=1;
    251250                                        end
  • issm/branches/trunk-larour-SLPS2020/src/m/contrib/larour/oceanmip.m

    r25588 r25776  
    1414                zostoga = {}; % global-mean thermosteric sea level anomalies (in mm) (time)
    1515                time = {}; %time in year
     16                timem = {}; %time in months
    1617                pbo = {}; %local ocean-bottom pressure changes. Also have zero mean over the oceans (lat,lon,time)
    1718                lat = {};
    1819                long = {};
     20                mask = {};
    1921                scenario = {};
    2022                model = {};
     
    4446                                        %figure out time interval and remove historical:
    4547                                        time=ncread(file,'time');
     48
    4649                                        pos=find(diff(time)<0);
    4750                                        if isempty(pos),
    48                                                 %pos=(length(time)-12*100+1):length(time);
    4951                                                pos=1:length(time);
    5052                                        else
     
    5557                                        pos=pos(pos2);
    5658                                        time=time(pos); nt=length(time);
     59                                        self.timem{end+1}=time;
    5760
    5861                                        %reduce datasets:
     
    6770                                                zosm(:,:,year)=mean(zos(:,:,(i-11):i),3);
    6871                                        end
    69                                         self.zos{end+1}=zosm; clear zos;
     72                                        self.zos{end+1}=zosm; clear zos;  clear zosm;
    7073
    7174                                        %zostoga:
     
    9295                                        self.long{end+1}=ncread(file,'lon');
    9396
     97                                        %mask:
     98                                        self.mask{end+1}=ncread(file,'slm');
     99
    94100                                        %scenario and model:
    95101                                        file=self.files{f};
     
    102108                end
    103109                %}}}
    104                 function self = interpolate(self,md) % {{{
     110                function self = interpolate(self,md,slm) % {{{
    105111
    106112                        %retrieve long and lat from mesh:
     
    110116
    111117                        for i=1:self.n,
     118                        %for i=1,
    112119                                disp(['interpolating model ' self.model{i} ' onto model mesh']);
    113120
     
    118125                                        self.long{i}=self.long{i}(2:181,:,:);
    119126                                        self.lat{i}=self.lat{i}(2:181,:,:);
     127                                        self.mask{i}=self.mask{i}(2:181,:,:);
    120128                                end
    121129
     
    125133                                pos=find(long<0); long(pos)=long(pos)+360;
    126134                                lat=double(self.lat{i}); lat=lat(:);
    127                                 [newl,uniqpos]=unique([lat,long],'rows','stable');
    128                                 long=long(uniqpos); lat=lat(uniqpos);
     135                                if slm==1,
     136                                        mask=double(self.mask{i}); mask=mask(:);
     137                                        maskpos=find(mask==1);
     138                                else
     139                                        maskpos=(1:length(long))';
     140                                end
     141                                [newl,uniqpos]=unique([lat(maskpos),long(maskpos)],'rows','stable');
     142                                long=long(maskpos(uniqpos)); lat=lat(maskpos(uniqpos));
    129143                                index=delaunay(long,lat);
    130144
     
    155169                                        end
    156170
    157                                         pbo=omip_pbo(:,:,j); pbo=pbo(:); pbo=pbo(uniqpos);
    158                                         zos=omip_zos(:,:,j); zos=zos(:); zos=zos(uniqpos);
     171                                        pbo=omip_pbo(:,:,j); pbo=pbo(:); pbo=pbo(maskpos(uniqpos));
     172                                        zos=omip_zos(:,:,j); zos=zos(:); zos=zos(maskpos(uniqpos));
    159173
    160174                                        pboj= InterpFromMeshToMesh2d(index,long,lat,pbo(newpos),meshlong,meshlat);
Note: See TracChangeset for help on using the changeset viewer.