Changeset 22853


Ignore:
Timestamp:
06/20/18 16:29:57 (7 years ago)
Author:
schlegel
Message:

CHG: make sure reconstructed climate can be of longer length

File:
1 edited

Legend:

Unmodified
Added
Removed
  • issm/trunk-jpl/src/c/classes/Elements/Element.cpp

    r22852 r22853  
    540540        IssmDouble Delta18oTime;
    541541        IssmDouble dpermil,f;
    542         IssmDouble time,yts,time_yr,month,time_clim;
     542        IssmDouble time,yts,time_yr,month,time_clim,time_climt,time_climp;
    543543        bool isTemperatureScaled=true;
    544544        bool isPrecipScaled=true;
     
    548548        time_yr=floor(time/yts)*yts;
    549549        time_clim=time_yr;
     550        time_climt=time_yr;
     551        time_climp=time_yr;
    550552
    551553        /*Get some pdd parameters*/
     
    559561        Input*     input2=this->inputs->GetInput(SmbPrecipitationsPresentdayEnum); _assert_(input2);
    560562        Input*     input3=NULL;
    561         if(!isTemperatureScaled){
    562                 input3=this->inputs->GetInput(SmbTemperaturesPresentdayEnum);           _assert_(input3);
    563         }
    564563        Input*     input4=NULL;
    565         if(!isPrecipScaled){
    566                 input4=this->inputs->GetInput(SmbPrecipitationsPresentdayEnum);         _assert_(input4);
    567         }
    568564        int offset;
    569565
     
    571567        if (fmod(offset,12.)!=1){
    572568                time_clim=floor(dynamic_cast<TransientInput*>(input)->GetTimeByOffset(offset-fmod(offset,12.)+1)/yts)*yts;
     569        }
     570
     571        if(!isTemperatureScaled){
     572                input3=this->inputs->GetInput(SmbTemperaturesPresentdayEnum);           _assert_(input3);
     573                offset=dynamic_cast<TransientInput*>(input3)->GetTimeInputOffset(time_yr);
     574                if (fmod(offset,12.)!=1){
     575                        time_climt=floor(dynamic_cast<TransientInput*>(input3)->GetTimeByOffset(offset-fmod(offset,12.)+1)/yts)*yts;
     576                }
     577        }
     578        if(!isPrecipScaled){
     579                input4=this->inputs->GetInput(SmbPrecipitationsPresentdayEnum);         _assert_(input4);
     580                offset=dynamic_cast<TransientInput*>(input4)->GetTimeInputOffset(time_yr);
     581                if (fmod(offset,12.)!=1){
     582                        time_climp=floor(dynamic_cast<TransientInput*>(input4)->GetTimeByOffset(offset-fmod(offset,12.)+1)/yts)*yts;
     583                }
    573584        }
    574585
     
    583594
    584595                        if(!isTemperatureScaled){
    585                                 input3->GetInputValue(&TemperaturesReconstructed[iv*12+month],gauss,time_clim+month/12.*yts);
     596                                input3->GetInputValue(&TemperaturesReconstructed[iv*12+month],gauss,time_climt+month/12.*yts);
    586597                        }
    587598                        if(!isPrecipScaled){
    588                                 input4->GetInputValue(&PrecipitationsReconstructed[iv*12+month],gauss,time_clim+month/12.*yts);
     599                                input4->GetInputValue(&PrecipitationsReconstructed[iv*12+month],gauss,time_climp+month/12.*yts);
    589600                                PrecipitationsReconstructed[iv*12+month]=PrecipitationsReconstructed[iv*12+month]*yts;
    590601                        }
Note: See TracChangeset for help on using the changeset viewer.