rethomics / damr

Read TriKinetics' DAM data in R
http://rethomics.github.io
6 stars 6 forks source link

load_dam error because of start_datetime #35

Closed sannygirl11 closed 2 years ago

sannygirl11 commented 2 years ago

Hello,

After I wrote the following code: DATA_DIR <- "D:/.." setwd(DATA_DIR) metadata <- fread("Metadata.csv") metadata <- link_dam_metadata(metadata, result_dir = DATA_DIR) metadata dt <- load_dam(metadata)

I got the error: Error in find_dam_first_last_lines(path, start_datetime, stop_datetime, : No data in selected date range

Here my metadata:

No. file start_datetime stop_datetime region_id sex 1: 1 Monitor43.txt 2021-05-14 10:00:00 2021-06-04 09:59:59 1 M 2: 2 Monitor43.txt 2021-05-14 10:00:00 2021-06-04 09:59:59 2 M 3: 3 Monitor43.txt 2021-05-14 10:00:00 2021-06-04 09:59:59 3 M 4: 4 Monitor43.txt 2021-05-14 10:00:00 2021-06-04 09:59:59 4 M 5: 5 Monitor43.txt 2021-05-14 10:00:00 2021-06-04 09:59:59 5 M 6: 6 Monitor43.txt 2021-05-14 10:00:00 2021-06-04 09:59:59 6 M 7: 7 Monitor43.txt 2021-05-14 10:00:00 2021-06-04 09:59:59 7 M 8: 8 Monitor43.txt 2021-05-14 10:00:00 2021-06-04 09:59:59 8 M 9: 9 Monitor43.txt 2021-05-14 10:00:00 2021-06-04 09:59:59 9 M 10: 10 Monitor43.txt 2021-05-14 10:00:00 2021-06-04 09:59:59 10 M 11: 11 Monitor43.txt 2021-05-14 10:00:00 2021-06-04 09:59:59 11 M 12: 12 Monitor43.txt 2021-05-14 10:00:00 2021-06-04 09:59:59 12 M 13: 13 Monitor43.txt 2021-05-14 10:00:00 2021-06-04 09:59:59 13 M 14: 14 Monitor43.txt 2021-05-14 10:00:00 2021-06-04 09:59:59 14 M 15: 15 Monitor43.txt 2021-05-14 10:00:00 2021-06-04 09:59:59 15 M 16: 16 Monitor43.txt 2021-05-14 10:00:00 2021-06-04 09:59:59 16 M 17: 17 Monitor43.txt 2021-05-14 10:00:00 2021-06-04 09:59:59 17 F 18: 18 Monitor43.txt 2021-05-14 10:00:00 2021-06-04 09:59:59 18 F 19: 19 Monitor43.txt 2021-05-14 10:00:00 2021-06-04 09:59:59 19 F 20: 20 Monitor43.txt 2021-05-14 10:00:00 2021-06-04 09:59:59 20 F 21: 21 Monitor43.txt 2021-05-14 10:00:00 2021-06-04 09:59:59 21 F 22: 22 Monitor43.txt 2021-05-14 10:00:00 2021-06-04 09:59:59 22 F 23: 23 Monitor43.txt 2021-05-14 10:00:00 2021-06-04 09:59:59 23 F 24: 24 Monitor43.txt 2021-05-14 10:00:00 2021-06-04 09:59:59 24 F 25: 25 Monitor43.txt 2021-05-14 10:00:00 2021-06-04 09:59:59 25 F 26: 26 Monitor43.txt 2021-05-14 10:00:00 2021-06-04 09:59:59 26 F 27: 27 Monitor43.txt 2021-05-14 10:00:00 2021-06-04 09:59:59 27 F 28: 28 Monitor43.txt 2021-05-14 10:00:00 2021-06-04 09:59:59 28 F 29: 29 Monitor43.txt 2021-05-14 10:00:00 2021-06-04 09:59:59 29 F 30: 30 Monitor43.txt 2021-05-14 10:00:00 2021-06-04 09:59:59 30 F 31: 31 Monitor43.txt 2021-05-14 10:00:00 2021-06-04 09:59:59 31 F 32: 32 Monitor43.txt 2021-05-14 10:00:00 2021-06-04 09:59:59 32 F 33: 33 Monitor54.txt 2021-06-18 10:00:00 2021-07-05 09:59:59 1 M 34: 34 Monitor54.txt 2021-06-18 10:00:00 2021-07-05 09:59:59 2 M 35: 35 Monitor54.txt 2021-06-18 10:00:00 2021-07-05 09:59:59 3 M 36: 36 Monitor54.txt 2021-06-18 10:00:00 2021-07-05 09:59:59 4 M 37: 37 Monitor54.txt 2021-06-18 10:00:00 2021-07-05 09:59:59 5 M 38: 38 Monitor54.txt 2021-06-18 10:00:00 2021-07-05 09:59:59 6 M 39: 39 Monitor54.txt 2021-06-18 10:00:00 2021-07-05 09:59:59 7 M 40: 40 Monitor54.txt 2021-06-18 10:00:00 2021-07-05 09:59:59 8 M 41: 41 Monitor54.txt 2021-06-18 10:00:00 2021-07-05 09:59:59 9 M 42: 42 Monitor54.txt 2021-06-18 10:00:00 2021-07-05 09:59:59 10 M 43: 43 Monitor54.txt 2021-06-18 10:00:00 2021-07-05 09:59:59 11 M 44: 44 Monitor54.txt 2021-06-18 10:00:00 2021-07-05 09:59:59 12 M 45: 45 Monitor54.txt 2021-06-18 10:00:00 2021-07-05 09:59:59 13 M 46: 46 Monitor54.txt 2021-06-18 10:00:00 2021-07-05 09:59:59 14 M 47: 47 Monitor54.txt 2021-06-18 10:00:00 2021-07-05 09:59:59 15 M 48: 48 Monitor54.txt 2021-06-18 10:00:00 2021-07-05 09:59:59 16 M 49: 49 Monitor54.txt 2021-06-18 10:00:00 2021-07-05 09:59:59 17 F 50: 50 Monitor54.txt 2021-06-18 10:00:00 2021-07-05 09:59:59 18 F 51: 51 Monitor54.txt 2021-06-18 10:00:00 2021-07-05 09:59:59 19 F 52: 52 Monitor54.txt 2021-06-18 10:00:00 2021-07-05 09:59:59 20 F 53: 53 Monitor54.txt 2021-06-18 10:00:00 2021-07-05 09:59:59 21 F 54: 54 Monitor54.txt 2021-06-18 10:00:00 2021-07-05 09:59:59 22 F 55: 55 Monitor54.txt 2021-06-18 10:00:00 2021-07-05 09:59:59 23 F 56: 56 Monitor54.txt 2021-06-18 10:00:00 2021-07-05 09:59:59 24 F 57: 57 Monitor54.txt 2021-06-18 10:00:00 2021-07-05 09:59:59 25 F 58: 58 Monitor54.txt 2021-06-18 10:00:00 2021-07-05 09:59:59 26 F 59: 59 Monitor54.txt 2021-06-18 10:00:00 2021-07-05 09:59:59 27 F 60: 60 Monitor54.txt 2021-06-18 10:00:00 2021-07-05 09:59:59 28 F 61: 61 Monitor54.txt 2021-06-18 10:00:00 2021-07-05 09:59:59 29 F 62: 62 Monitor54.txt 2021-06-18 10:00:00 2021-07-05 09:59:59 30 F 63: 63 Monitor54.txt 2021-06-18 10:00:00 2021-07-05 09:59:59 31 F 64: 64 Monitor54.txt 2021-06-18 10:00:00 2021-07-05 09:59:59 32 F

Can you please tell me what I did wrong?

qgeissmann commented 2 years ago

Hello,

Yes, it implies that you are requesting data that does not exist in the files (Monitor54.txt and Monitor43.txt). I would go this way:

  1. check that you do have data in both files between the dates requested (start_datetime and stop_datetime )
  2. try to simplify the problem. e.g. use the first row of metadata link_dam_metadata(metadata[1,], result_dir = DATA_DIR). If is works, debug by adding more rows e.g. metadata[1:16,], and try to find the row that fails
  3. If it still fails, share the simplified problem and data file so we can reproduce the putative bug and fix it :wink:

Good luck!

sannygirl11 commented 2 years ago

I've found the mistake. My txt-file had the wrong formatting

qgeissmann commented 2 years ago

great. good luck with the next steps!

mantouyangmeng commented 3 months ago

Hi, I'm trying to run the damr package, and when I run load_dam(metadata), I now keep getting "Error in find_dam_first_last_lines(path, start_datetime, stop_datetime,. No data in selected date range". I've searched for ways to fix this (such as following the help provided in the error), but it still continues to report the error, and was wondering if you've encountered this problem?