From fca71de23fbb7326a5be791b15ff63dd356e2b1d Mon Sep 17 00:00:00 2001
From: KyleKlenk <kyle.c.klenk@gmail.com>
Date: Fri, 1 Apr 2022 13:03:20 -0600
Subject: [PATCH] adjusted where timestep and outputstep are incremented

---
 build/source/actors/HRUActor.h | 15 +++++++++------
 utils/netcdf/compareOutput.py  |  8 ++++----
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/build/source/actors/HRUActor.h b/build/source/actors/HRUActor.h
index 46cd18f..30474ad 100644
--- a/build/source/actors/HRUActor.h
+++ b/build/source/actors/HRUActor.h
@@ -104,8 +104,8 @@ behavior hru_actor(stateful_actor<hru_state>* self, int refGRU, int indxGRU,
             int err = 0;
 
             while( err == 0 ) {
-                err = Run_HRU(self);
 
+                err = Run_HRU(self);
                 if (err != 0) {
                     // RUN FAILURE!!! Notify Parent
                     self->send(self->state.parent, run_failure_v, self->state.indxGRU, err);
@@ -115,8 +115,8 @@ behavior hru_actor(stateful_actor<hru_state>* self, int refGRU, int indxGRU,
 
                 // Check if HRU is done computing
                 if (self->state.timestep >= self->state.num_steps) {
-                    // write out data
-                    // aout(self) << "Sending Final Write" << std::endl;
+                    if (debug)
+                        aout(self) << "Sending Final Write, outputStep = " << self->state.outputStep << std::endl;
                     self->send(self->state.file_access_actor, write_output_v, 
                         self->state.indxGRU, self->state.indxHRU, self->state.outputStep, self);
 
@@ -125,9 +125,10 @@ behavior hru_actor(stateful_actor<hru_state>* self, int refGRU, int indxGRU,
                     
                     return;
                 }
-
+                // update Timing Variables
                 self->state.timestep += 1;
-                self->state.outputStep += 1; // value to monitor how full the output structure is
+                self->state.outputStep += 1;
+
                 // check if we need more forcing information
                 if (self->state.forcingStep > self->state.stepsInCurrentFFile) {
                     // aout(self) << "Asking for more forcing data" << std::endl;
@@ -136,7 +137,9 @@ behavior hru_actor(stateful_actor<hru_state>* self, int refGRU, int indxGRU,
                 }
                 // check if we need to write our output
                 if (self->state.outputStep >= self->state.outputStrucSize) {
-                    // aout(self) << "Sending Write" << std::endl;
+                    if(debug)
+                        aout(self) << "Sending Write, outputStep = " << self->state.outputStep << std::endl;
+
                     self->send(self->state.file_access_actor, write_output_v, 
                         self->state.indxGRU, self->state.indxHRU, self->state.outputStep, self);
                     self->state.outputStep = 1;
diff --git a/utils/netcdf/compareOutput.py b/utils/netcdf/compareOutput.py
index 69fba28..6846820 100644
--- a/utils/netcdf/compareOutput.py
+++ b/utils/netcdf/compareOutput.py
@@ -27,10 +27,9 @@ varList = [time, scalarSWE, scalarCanopyWat, scalarAquiferStorage, scalarTotalSo
     scalarSurfaceRunoff, scalarSoilBaseflow, scalarSoilDrainage, scalarAquiferBaseflow, \
     scalarTotalET, scalarTotalRunoff, scalarNetRadiation]
 
-# varList = [time, scalarSWE]
 filename = "out.txt"
-originalPath = Path('/home/k13nk/SummaProject/output/originalBench/SummaOriginal_G000001-000001_timestep.nc')
-actorsPath = Path('/home/k13nk/SummaProject/output/testOutput/SummaActorsTestGRU1-1_timestep.nc')
+originalPath = Path('/u1/kck540/output/SummaOriginal/Apr-1-2022/SummaOriginal_G000001-000001_timestep.nc')
+actorsPath = Path('/u1/kck540/output/SummaActors/Apr-1-2022/SummaActorsGRU1-1_timestep.nc')
 
 originalDataset = xr.open_dataset(originalPath)
 actorsDataset = xr.open_dataset(actorsPath)
@@ -55,7 +54,8 @@ for i in range(0, numHRU):
       dataOrig.append(data)
     for data in allHRUsActors[i][var].values:
       dataAct.append(data)
-
+    print("Original", len(dataOrig))
+    print("Actors", len(dataAct))
     marginOfError = 0
     if var == time:
       for a in range(0, len(dataAct)):
-- 
GitLab