Below is a new formula that you can use for debugging. It will create the data table for whatever row number you put into the If() statement at the end. If you do not want to create a data table, then just change the row number that you are trying to find, to -1. There will never be a -1 row, so a table will not be created. Anyway, see if you can see what is going on and where an error is occurring.
Make sure the table is sorted correctly and any rows you don't want to be processed are deleted from the table. The script does not honor Excluded rows.
If( Row() == 1,
holdMatrix = [];
dateMatrix = [];
rowMatrix = [];
);
If( Is Missing( :Name( "Date Time (UTC)" ) ) == 0,
If(
Is Missing( :Name( " Sea Surface Temperature (deg C)" ) ) == 1, holdMatrix = holdMatrix || 0,
:Name( " Sea Surface Temperature (deg C)" ) > 31.3, holdMatrix = holdMatrix || :time difference 2,
:Name( " Sea Surface Temperature (deg C)" ) <= 31.3, holdMatrix = holdMatrix || 0
);
dateMatrix = dateMatrix || Informat( :date, "m/d/y" );
rowMatrix = rowMatrix || Row();
If( N Cols( dateMatrix ) & N Cols( holdMatrix ) != 0,
While(
dateMatrix[N Cols( dateMatrix )] > dateMatrix[1] + In Days( 120 ) & N Cols( holdMatrix ) > 0 &
N Cols( dateMatrix ) > 0,
dateMatrix[1] = [];
holdMatrix[1] = [];
rowMatrix[1] = [];
);
If( N Cols( dateMatrix ) & N Cols( holdMatrix ) != 0,
x = Sum( holdMatrix ),
x = .
);
,
x = .
);
,
x = .
);
If( Row() == 22159,
New Table( "row" || Char( Row() ),
New Column( "RowNum", set values( rowMatrix ) ),
New Column( "Values", set values( holdMatrix ) ),
New Column( "dates", set values( dateMatrix ), Format( "m/d/y" ) )
)
);
(x / 24) / 7;
Jim