srlabUsask / crhmcode

GNU General Public License v3.0
8 stars 4 forks source link

CRHMcode core: Reading in observation files. Incorrect results when using macro filters in observation files. #157

Closed jhs507 closed 3 years ago

jhs507 commented 3 years ago

When opening the following observation file which has a filter command to calculate ea (desired vapor pressure) using the values for t (temperature) and rh (relative humidity) incorrect values are calculated and stored in the data array. Brandon_hourly_t_u_rh_1960-2006.txt

The values should be calculated as the following. Brandon_hourly_t_u_rh_1960-2006SHORT_ea.txt

Instead the first hundred values calculated are: FristHundered_ea.txt

This issue appears to be present on the master branch and affect both GUI and CLI versions.

jhs507 commented 3 years ago

The relevant sections of code are in file ClassData.cpp line 557 where the macros which handle the filters are executed to finish populating the data structure that is being read in.

Another relevant file is Classea.cpp where the filter function for vapor pressure is defined.

jhs507 commented 3 years ago

This issue appears to be affecting all uses of macro filters in observation files.

jhs507 commented 3 years ago

When class filters attempt to read the data from the read in observations they access a 3 dimensional array member of ClassFilter Data[][][] unfortunately it seems that this does not properly point to the correct data.

jhs507 commented 3 years ago

Commit https://github.com/srlabUsask/crhmcode/commit/a3f06f2a8c3f90aba8a7a845d287c4727e5928bd

Corrected the counting and allocation of space for filter arguments. It should allow ea to be calculated correctly.