Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File inputs not able to be a single file #184

Closed
lsetiawan opened this issue Nov 3, 2023 · 2 comments · Fixed by #190
Closed

File inputs not able to be a single file #184

lsetiawan opened this issue Nov 3, 2023 · 2 comments · Fixed by #190
Assignees
Labels
1 bug Something isn't working priority Priority issue that needs to be done in the next 2 weeks

Comments

@lsetiawan
Copy link
Member

lsetiawan commented Nov 3, 2023

Overview

John has discovered in #175 that when input files is set to be a single file rather than a glob path, it doesn't work. For example, if a user set a single file for pxp_tt like:

input_files:
    travel_times: 
      path: ./my_dir/pxp_tt

this will fail!

@lsetiawan lsetiawan changed the title Fix bug on file inputs not able to be a single file File inputs not able to be a single file Nov 3, 2023
@lsetiawan lsetiawan added priority Priority issue that needs to be done in the next 2 weeks bug Something isn't working labels Nov 3, 2023
@lsetiawan
Copy link
Member Author

lsetiawan commented Nov 6, 2023

The key function that creates the listing of path strings when glob path is given ** is called gather_files:

https://github.com/uw-ssec/offshore-geodesy/blob/d0f2bd01e387c287aa2b78eaaab007a82337a013/src/gnatss/main.py#L56-L59

The gather_files function returns a dictionary of the various InputData in the solver processing as such:

https://github.com/uw-ssec/offshore-geodesy/blob/d0f2bd01e387c287aa2b78eaaab007a82337a013/src/gnatss/configs/solver.py#L37-L50

will become:

{
  "sound_speed": str,
  "travel_times": List[str],
  "gps_solution": List[str],
  "deletions": str,
}

As you notice in above dictionary, I've matched the types to the expected input type for each loader function. Currently only "sound_speed" and "deletions" are expected to have single file.

@lsetiawan lsetiawan reopened this Nov 6, 2023
@lsetiawan
Copy link
Member Author

Proposed Solution

A solution to the above for this issue should be that every loader inputs should be a List[str] and that gather_files dictionary should output a List[str] to the file path.

Sample config input

input_files:
    sound_speed:
      path: ./tests/data/2022/NCL1/ctd/CTD_NCL1_Ch_Mi
    travel_times:
      path: ./tests/data/2022/NCL1/208/WG_20220727/pxp_tt
    gps_solution:
      path: ./tests/data/2022/NCL1/208/posfilter/POS_FREED_TRANS_TWTT
    deletions:
      path: ./tests/data/2022/NCL1/deletns.dat

The above inputs should output the following for the gather_files function

{
  "sound_speed": ["absolute/path/to/tests/data/2022/NCL1/ctd/CTD_NCL1_Ch_Mi"],
  "travel_times": ["absolute/path/to/tests/data/2022/NCL1/208/WG_20220727/pxp_tt"],
  "gps_solution": ["absolute/path/to/tests/data/2022/NCL1/208/posfilter/POS_FREED_TRANS_TWTT"],
  "deletions": ["absolute/path/to/tests/data/2022/NCL1/deletns.dat"],
}

The following functions should not fail when their respective list of path is given

load_sound_speed

https://github.com/uw-ssec/offshore-geodesy/blob/d0f2bd01e387c287aa2b78eaaab007a82337a013/src/gnatss/loaders.py#L35

load_deletions

https://github.com/uw-ssec/offshore-geodesy/blob/d0f2bd01e387c287aa2b78eaaab007a82337a013/src/gnatss/loaders.py#L262-L264

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 bug Something isn't working priority Priority issue that needs to be done in the next 2 weeks
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants