Changeset 25272
- Timestamp:
- 07/13/20 18:37:40 (5 years ago)
- Location:
- issm/trunk-jpl/src/m/contrib/larour
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/m/contrib/larour/ismip6.m
r25061 r25272 188 188 189 189 end % }}} 190 function interpolate(self, field,ismip2mesh,ismip2mesh_correction) % {{{190 function interpolate(self,md,field,ismip2mesh,ismip2mesh_correction) % {{{ 191 191 192 192 for i=1:self.n, … … 202 202 end 203 203 204 %map onto mesh: 205 hg=ismip2mesh_correction.*(ismip2mesh*ht); 206 pos=find(isnan(hg)); hg(pos)=0; 204 %map onto mesh: correct only for thicknesses 205 hg=ismip2mesh_correction.*(ismip2mesh*ht) ; 207 206 208 207 %keep field: 209 208 if strcmpi(field,'lithk'), 209 pos=find(isnan(hg)); hg(pos)=0; 210 210 self.thickness{i}=hg; 211 self.deltathickness{i}=diff(hg,1,2); 212 end 211 end 212 if strcmpi(field,'sftgif'), 213 hge=ones(md.mesh.numberofvertices,size(hg,2)); 214 for j=1:size(hg,2), 215 hgj=hg(:,j); 216 pos=find(hgj>0); 217 hge(md.mesh.elements(pos,:),j)=-1; 218 end 219 self.icemask{i}=hge; 220 end 221 if strcmpi(field,'sftgrf'), 222 hge=-ones(md.mesh.numberofvertices,size(hg,2)); 223 for j=1:size(hg,2), 224 hgj=hg(:,j); 225 pos=find(hgj>0); 226 hge(md.mesh.elements(pos,:),j)=1; 227 end 228 self.oceanmask{i}=hge; 229 end 230 213 231 self.time{i}=t; 214 232 self.timestart{i}=t0; … … 217 235 end 218 236 end % }}} 237 function part=partition(self,md,part,value) % {{{ 238 239 for i=1:self.n, 240 dh=self.deltathickness{i}; 241 for j=1:size(dh,2), 242 dhj=dh(:,j); 243 pos=find(dhj); 244 part(pos)=value; 245 end 246 end 247 248 end % }}} 219 249 end 220 250 end -
issm/trunk-jpl/src/m/contrib/larour/oceanmip.m
r25001 r25272 42 42 disp(['reading file ' file]); 43 43 44 %figure out time interval :44 %figure out time interval and remove historical: 45 45 time=ncread(file,'time'); 46 pos=find(time>2000); time=time(pos); nt=length(time); 47 46 pos=find(diff(time)<0); 47 if isempty(pos), 48 pos=(length(time)-12*100+1):length(time); 49 else 50 pos=[(pos+1):length(time)]; 51 end 52 time2=time(pos); 53 pos2=find(time2<=2099 & time2>=2006); 54 pos=pos(pos2); 55 time=time(pos); nt=length(time); 56 48 57 %reduce datasets: 49 58 time=floor(time(12:12:nt)); … … 55 64 for i=12:12:nt, 56 65 year=i/12; 57 zosm(:,:,year)=mean(zos(:,:, i-11:i),3);66 zosm(:,:,year)=mean(zos(:,:,(i-11):i),3); 58 67 end 59 68 self.zos{end+1}=zosm; clear zos; 60 69 61 70 %zostoga: 62 zostoga=ncread(file,'zostoga'); 63 zostogam=zeros(nt/12 );71 zostoga=ncread(file,'zostoga'); zostoga=zostoga(pos); 72 zostogam=zeros(nt/12,1); 64 73 for i=12:12:nt, 65 74 year=i/12; … … 155 164 end 156 165 %}}} 157 function [pbo,time]= bottompressure(self,model,gridded) % {{{ 166 function [rate,time]= zostoga_mean(self) % {{{ 167 series=zeros(length(self.time{1}),self.n); 168 for i=1:self.n, 169 series(:,i)=self.zostoga{i}; 170 end 171 rate=mean(series,2); 172 time=self.time{1}; 173 end 174 %}}} 175 function [rate,time]= zostoga_std(self) % {{{ 176 series=zeros(length(self.time{1}),self.n); 177 for i=1:self.n, 178 series(:,i)=self.zostoga{i}; 179 end 180 rate=std(series,1,2); 181 time=self.time{1}; 182 end 183 %}}} 184 function [average,stddev,time]= zostoga_stats(self) % {{{ 185 series=zeros(length(self.time{1}),self.n); 186 for i=1:self.n, 187 series(:,i)=self.zostoga{i}; 188 end 189 average=mean(series,2); 190 stddev=std(series,1,2); 191 time=self.time{1}; 192 end 193 %}}} 194 function array= bottompressure(self,model,gridded) % {{{ 158 195 for i=1:self.n, 159 196 if strcmpi(model,self.model{i}), … … 164 201 end 165 202 time=self.time{i}; 203 array=[pbo;time]; 166 204 break; 167 205 end … … 169 207 end 170 208 %}}} 209 function arrays= dbottompressures(self) % {{{ 210 arrays=cell(self.n,1); 211 for i=1:self.n, 212 pbo=self.mesh_pbo{i}; pbo=pbo/1000; %in meters 213 dpbo=diff(pbo,1,2); 214 time=self.time{i}; 215 time=time(1:end-1); 216 array=[dpbo;dtime]; 217 arrays{i}=array; 218 end 219 end %}}} 220 function arrays= dzoss(self) % {{{ 221 arrays=cell(self.n,1); 222 for i=1:self.n, 223 zos=self.mesh_zos{i}; zos=zos/1000; %in meters 224 dzos=diff(zos,1,2); 225 time=self.time{i};time=time(1:end-1); 226 array=[dzos;time]; 227 arrays{i}=array; 228 end 229 end %}}} 230 function arrays= dzostogass(self) % {{{ 231 arrays=cell(self.n,1); 232 for i=1:self.n, 233 zostoga=self.zostoga{i}; zos=zos/1000; %in meters 234 dzostoga=diff(dzostoga); 235 time=self.time{i};time=time(1:end-1); 236 array=[dzostoga;time]; 237 arrays{i}=array; 238 end 239 end %}}} 171 240 function [lat,long]= latlong(self,model) % {{{ 172 241 for i=1:self.n,
Note:
See TracChangeset
for help on using the changeset viewer.