calum-chamberlain / ESCI451-Python

Introduction to Python for VUW ESCI 451 course.
GNU General Public License v3.0
11 stars 5 forks source link

Error in caluclating displacement in module 4B #26

Closed calum-chamberlain closed 1 year ago

calum-chamberlain commented 2 years ago

The code that gets works out the displacement is wrong in module 4B - it ends up subtracting between the indices of the dataframe, not the values. the code should be changed to something like:

date_filter = (GNSS_data['time'] >= '2016/11/06T11:02:56') & (
    GNSS_data['time'] <= '2016/11/20T11:02:56')

N_first_value = GNSS_data.loc[date_filter]['north'].to_numpy()[0]
N_last_value = GNSS_data.loc[date_filter]['north'].to_numpy()[-1]

N_disp = N_last_value - N_first_value

print(f"The displacement is {N_disp} mm")

The text beforehand describing the handy index methods should be changed to match this code as well.

FinniganIK commented 2 years ago

Or something like:

FirstIndex = GNSS_data.loc[date_filter]['north'].first_valid_index()
FirstValue = GNSS_data['north'][FirstIndex]

That's what I had meant to do

FinniganIK commented 2 years ago

And then make sure this is working correctly in the vector dataframe