code: def turbine_scores(pred, gt, raw_data, examine_len, stride=1):
      """
      Desc:
          Calculate the MAE and RMSE of one turbine
      Args:
          pred: prediction for one turbine
          gt: ground truth
          raw_data: the DataFrame of one wind turbine
          examine_len:
          stride:
      Returns:
          The averaged MAE and RMSE
      """
      nan_cond = pd.isna(raw_data).any(axis=1)
  
      invalid_cond = (
          (raw_data["Patv"] < 0)
          | ((raw_data["Patv"] == 0) & (raw_data["Wspd"] > 2.5))
          | (
              (raw_data["Pab1"] > 89)
              | (raw_data["Pab2"] > 89)
              | (raw_data["Pab3"] > 89)
          )
          | (
              (raw_data["Wdir"] < -180)
              | (raw_data["Wdir"] > 180)
              | (raw_data["Ndir"] < -720)
              | (raw_data["Ndir"] > 720)
          )
      )
  
      cond = (~invalid_cond) & (~nan_cond)
  
      maes, rmses = [], []
      cnt_sample, out_seq_len, _ = pred.shape
      for i in range(0, cnt_sample, stride):
          indices = np.where(cond[i : out_seq_len + i])
          prediction = pred[i]
          prediction = prediction[indices]
          targets = gt[i]
          targets = targets[indices]
          _mae, _rmse = regressor_scores(
              prediction[-examine_len:] / 1000,
              targets[-examine_len:] / 1000,
          )
          if _mae != _mae or _rmse != _rmse:
              continue
          maes.append(_mae)
          rmses.append(_rmse)
      avg_mae = np.array(maes).mean()
      avg_rmse = np.array(rmses).mean()
      return avg_mae, avg_rmse
  
file_path: PGL/examples/kddcup2022/wpf_baseline/metrics.py
imports: import pandas
  import time
  import numpy
label_desc: Use image node_id 10 for calling a global function with example usage: turbine_scores(pred, gt, raw_data, examine_len, stride) and returns: avg_mae,  avg_rmse