seims.utility.timeseries_data Namespace Reference

Functions

def match_simulation_observation (sim_vars, sim_dict, obs_vars, obs_dict, start_time=None, end_time=None # type:Optional[datetime])
 
def calculate_statistics (sim_obs_dict, stime=None, etime=None # type:Optional[datetime])
 

Detailed Description

Handle time series data.

    @author   : Liangjun Zhu

    @changelog:
    - 18-10-29 - lj - Extract from other packages.

Function Documentation

◆ calculate_statistics()

def seims.utility.timeseries_data.calculate_statistics (   sim_obs_dict,
  stime = None,
  etime = None  # type: Optional[datetime] 
)
Calculate NSE, R-square, RMSE, PBIAS, and RSR.
Args:
    sim_obs_dict: {VarName: {'UTCDATETIME': [t1, t2, ..., tn],
                             'Obs': [o1, o2, ..., on],
                             'Sim': [s1, s2, ..., sn]
                             },
                   ...
                   }
    stime: Start time for statistics calculation.
    etime: End time for statistics calculation.
Returns:
    The dict with the format:
    {VarName: {'UTCDATETIME': [t1, t2, ..., tn],
               'Obs': [o1, o2, ..., on],
               'Sim': [s1, s2, ..., sn]},
               'NSE': nse_value,
               'R-square': r2_value,
               'RMSE': rmse_value,
               'PBIAS': pbias_value,
               'lnNSE': lnnse_value,
               'NSE1': nse1_value,
               'NSE3': nse3_value
               },
    ...
    }
    Return name list of the calculated statistics

◆ match_simulation_observation()

def seims.utility.timeseries_data.match_simulation_observation (   sim_vars,
  sim_dict,
  obs_vars,
  obs_dict,
  start_time = None,
  end_time = None  # type: Optional[datetime] 
)
Match the simulation and observation data by UTCDATETIME for each variable.

Args:
    sim_vars: Simulated variable list, e.g., ['Q', 'SED']
    sim_dict: {Datetime: [value_of_var1, value_of_var2, ...], ...}
    obs_vars: Observed variable list, which may be None or [], e.g., ['Q']
    obs_dict: same format with sim_dict
    start_time: Start time, by default equals to the start of simulation data
    end_time: End time, see start_time
Returns:
    The dict with the format:
    {VarName: {'UTCDATETIME': [t1, t2, ..., tn],
               'Obs': [o1, o2, ..., on],
               'Sim': [s1, s2, ..., sn]},
    ...
    }