Changeset 21917
- Timestamp:
- 08/08/17 17:34:18 (8 years ago)
- Location:
- issm/trunk-jpl/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/Elements/Element.cpp
r21895 r21917 539 539 IssmDouble Delta18oTime; 540 540 IssmDouble dpermil,f; 541 IssmDouble time,yts,time_yr,month ;541 IssmDouble time,yts,time_yr,month,time_clim; 542 542 this->parameters->FindParam(&time,TimeEnum); 543 543 this->parameters->FindParam(&yts,ConstantsYtsEnum); 544 544 this->parameters->FindParam(&f,SmbFEnum); 545 545 time_yr=floor(time/yts)*yts; 546 time_clim=time_yr; 546 547 547 548 /*Get some pdd parameters*/ … … 551 552 Input* input=this->inputs->GetInput(SmbTemperaturesPresentdayEnum); _assert_(input); 552 553 Input* input2=this->inputs->GetInput(SmbPrecipitationsPresentdayEnum); _assert_(input2); 554 int offset; 555 556 offset=dynamic_cast<TransientInput*>(input)->GetTimeInputOffset(time_yr); 557 if (fmod(offset,12)!=1){ 558 time_clim=floor(dynamic_cast<TransientInput*>(input)->GetTimeByOffset(offset-fmod(offset,12)+1)/yts)*yts; 559 } 560 553 561 /*loop over vertices: */ 554 562 Gauss* gauss=this->NewGauss(); … … 556 564 for(int iv=0;iv<numvertices;iv++) { 557 565 gauss->GaussVertex(iv); 558 input->GetInputValue(&TemperaturesPresentday[iv*12+month],gauss, month/12.*yts);559 input2->GetInputValue(&PrecipitationsPresentday[iv*12+month],gauss, month/12.*yts);566 input->GetInputValue(&TemperaturesPresentday[iv*12+month],gauss,time_clim+month/12.*yts); 567 input2->GetInputValue(&PrecipitationsPresentday[iv*12+month],gauss,time_clim+month/12.*yts); 560 568 561 569 PrecipitationsPresentday[iv*12+month]=PrecipitationsPresentday[iv*12+month]*yts; -
issm/trunk-jpl/src/c/classes/Inputs/TransientInput.cpp
r21872 r21917 246 246 247 247 delete input; 248 } 249 /*}}}*/ 250 int TransientInput::GetTimeInputOffset(IssmDouble time){/*{{{*/ 251 252 int found; 253 int offset; 254 255 /*go through the timesteps, and figure out which interval we 256 * *fall within. Then interpolate the values on this interval: */ 257 found=binary_search(&offset,time,this->timesteps,this->numtimesteps); 258 if(!found) _error_("Input not found (is TransientInput sorted ?)"); 259 260 return offset; 261 } 262 /*}}}*/ 263 IssmDouble TransientInput::GetTimeByOffset(int offset){/*{{{*/ 264 265 if (offset < 0) offset=0; 266 _assert_(this->timesteps[offset]); 267 268 return this->timesteps[offset]; 248 269 } 249 270 /*}}}*/ -
issm/trunk-jpl/src/c/classes/Inputs/TransientInput.h
r21872 r21917 70 70 void GetInputUpToCurrentTimeAverages(IssmDouble** pvalues, IssmDouble** ptimes, int* pnumtimes, IssmDouble currenttime); 71 71 int GetInputInterpolationType(){_error_("not implemented yet!");}; 72 IssmDouble GetTimeByOffset(int offset); 72 73 Input* GetTimeInput(IssmDouble time); 74 int GetTimeInputOffset(IssmDouble time); 73 75 void GetTimeValues(IssmDouble* values,IssmDouble time){_error_("not implemented yet");}; 74 76 void GetVectorFromInputs(Vector<IssmDouble>* vector,int* doflist); -
issm/trunk-jpl/src/m/classes/SMBd18opdd.m
r21710 r21917 76 76 md = checkfield(md,'fieldname','smb.rlapslgm','>=',0,'numel',1); 77 77 if(self.isd18opd==1) 78 md = checkfield(md,'fieldname','smb.temperatures_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1,'Inf',1,'timeseries',1); 79 md = checkfield(md,'fieldname','smb.precipitations_presentday','size',[md.mesh.numberofvertices+1 12],'NaN',1,'Inf',1,'timeseries',1); 78 lent=size(self.temperatures_presentday,2); 79 lenp=size(self.precipitations_presentday,2); 80 multt=ceil(lent/12)*12; 81 multp=ceil(lenp/12)*12; 82 md = checkfield(md,'fieldname','smb.temperatures_presentday','size',[md.mesh.numberofvertices+1 multt],'NaN',1,'Inf',1,'timeseries',1); 83 md = checkfield(md,'fieldname','smb.precipitations_presentday','size',[md.mesh.numberofvertices+1 multp],'NaN',1,'Inf',1,'timeseries',1); 80 84 md = checkfield(md,'fieldname','smb.delta18o','NaN',1,'Inf',1,'size',[2,NaN],'singletimeseries',1); 81 85 md = checkfield(md,'fieldname','smb.dpermil','>=',0,'numel',1); -
issm/trunk-jpl/src/m/classes/SMBd18opdd.py
r21712 r21917 97 97 98 98 if self.isd18opd: 99 md = checkfield(md,'fieldname','smb.temperatures_presentday','size',[md.mesh.numberofvertices+1,12],'NaN',1,'Inf',1,'timeseries',1) 100 md = checkfield(md,'fieldname','smb.precipitations_presentday','size',[md.mesh.numberofvertices+1,12],'NaN',1,'Inf',1,'timeseries',1) 99 lent=float(np.size(self.temperatures_presentday,1)) 100 lenp=float(np.size(self.precipitations_presentday,1)) 101 multt=np.ceil(lent/12.)*12. 102 multp=np.ceil(lenp/12.)*12. 103 md = checkfield(md,'fieldname','smb.temperatures_presentday','size',[md.mesh.numberofvertices+1,multt],'NaN',1,'Inf',1,'timeseries',1) 104 md = checkfield(md,'fieldname','smb.precipitations_presentday','size',[md.mesh.numberofvertices+1,multp],'NaN',1,'Inf',1,'timeseries',1) 101 105 md = checkfield(md,'fieldname','smb.delta18o','NaN',1,'Inf',1,'size',[2,np.nan],'singletimeseries',1) 102 106 md = checkfield(md,'fieldname','smb.dpermil','>=',0,'numel',[1])
Note:
See TracChangeset
for help on using the changeset viewer.