Skip to content

Implicit (unstable) deltat and Ntimesteps definitions #74

@aantonyb

Description

@aantonyb

in CARDAMOM_READ_NETCDF_DATA.c there's an assumption that any model run requires two or more timesteps to calculate "deltat". Short term fix determines whether we have one or more timesteps and uses TIME_INDEX.values[0] as the deltat calculations.

Some possible ways to fix this:

  1. Change TIME_INDEX conventions to be defined "end of timestep" time index (rather than middle of timestep)

  2. Explicitly define "deltat" in driver file (i.e. user defined) to avoid dependencies

  3. Define timestep as Ntimesteps + 1 (same as POOLS) and therefore allow for deltat calculation.

    //Pre-processing
    //Ntimesteps
    //The deltat and DATA->Ntimesteps calculations are highly implicit and code prone to bugs. Need to replace with more explicit definitions of time and deltat
    DATA->Ntimesteps=DATA->TIME_INDEX.length;
    //Delta T
    if ( DATA->Ntimesteps>1){
    DATA->deltat=DATA->TIME_INDEX.values[1]-DATA->TIME_INDEX.values[0];}
    else {
    DATA->deltat=DATA->TIME_INDEX.values[0];}

Metadata

Metadata

Assignees

Labels

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions