Changeset 25776
- Timestamp:
- 11/21/20 11:18:50 (4 years ago)
- 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 10 10 11 11 a = y23 * dx + x32 * dy; 12 if isnan(a), 13 isin=0; 14 return; 15 end 12 16 if (a < minD || a > maxD) 13 17 isin=0; -
issm/branches/trunk-larour-SLPS2020/src/m/contrib/larour/ismip6.m
r25724 r25776 246 246 for j=1:size(hg,2), 247 247 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 250 249 hgv(md.mesh.elements(pos,:),j)=1; 251 250 end -
issm/branches/trunk-larour-SLPS2020/src/m/contrib/larour/oceanmip.m
r25588 r25776 14 14 zostoga = {}; % global-mean thermosteric sea level anomalies (in mm) (time) 15 15 time = {}; %time in year 16 timem = {}; %time in months 16 17 pbo = {}; %local ocean-bottom pressure changes. Also have zero mean over the oceans (lat,lon,time) 17 18 lat = {}; 18 19 long = {}; 20 mask = {}; 19 21 scenario = {}; 20 22 model = {}; … … 44 46 %figure out time interval and remove historical: 45 47 time=ncread(file,'time'); 48 46 49 pos=find(diff(time)<0); 47 50 if isempty(pos), 48 %pos=(length(time)-12*100+1):length(time);49 51 pos=1:length(time); 50 52 else … … 55 57 pos=pos(pos2); 56 58 time=time(pos); nt=length(time); 59 self.timem{end+1}=time; 57 60 58 61 %reduce datasets: … … 67 70 zosm(:,:,year)=mean(zos(:,:,(i-11):i),3); 68 71 end 69 self.zos{end+1}=zosm; clear zos; 72 self.zos{end+1}=zosm; clear zos; clear zosm; 70 73 71 74 %zostoga: … … 92 95 self.long{end+1}=ncread(file,'lon'); 93 96 97 %mask: 98 self.mask{end+1}=ncread(file,'slm'); 99 94 100 %scenario and model: 95 101 file=self.files{f}; … … 102 108 end 103 109 %}}} 104 function self = interpolate(self,md ) % {{{110 function self = interpolate(self,md,slm) % {{{ 105 111 106 112 %retrieve long and lat from mesh: … … 110 116 111 117 for i=1:self.n, 118 %for i=1, 112 119 disp(['interpolating model ' self.model{i} ' onto model mesh']); 113 120 … … 118 125 self.long{i}=self.long{i}(2:181,:,:); 119 126 self.lat{i}=self.lat{i}(2:181,:,:); 127 self.mask{i}=self.mask{i}(2:181,:,:); 120 128 end 121 129 … … 125 133 pos=find(long<0); long(pos)=long(pos)+360; 126 134 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)); 129 143 index=delaunay(long,lat); 130 144 … … 155 169 end 156 170 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)); 159 173 160 174 pboj= InterpFromMeshToMesh2d(index,long,lat,pbo(newpos),meshlong,meshlat);
Note:
See TracChangeset
for help on using the changeset viewer.