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

Resolve path in data catalog if it contains brackets {} #1068

Open
2 tasks done
hboisgon opened this issue Sep 27, 2024 · 1 comment
Open
2 tasks done

Resolve path in data catalog if it contains brackets {} #1068

hboisgon opened this issue Sep 27, 2024 · 1 comment
Labels
Bug Something isn't working

Comments

@hboisgon
Copy link
Contributor

hboisgon commented Sep 27, 2024

HydroMT version checks

  • I have checked that this issue has not already been reported.
  • I have checked that this bug exists on the latest version of HydroMT.

Reproducible Example

from hydromt_wflow import WflowModel
model = WflowModel()
model.data_catalog.get_dataframe("roughness_river_mapping_default")

Current behaviour

FileNotFoundError: No such file found: C:\SnapVolumesTemp\MountPoints\{{45c63495-0000-0000-0000-100000000000}}\{{4EB959A1-DAFA-48F1-96BB-E4B67D6DC4E4}}\SVROOT\git\hydromt_wflow\hydromt_wflow\data\wflow\N_river_mapping.csv

However, using single brackets does results in correct reading of the csv file. So the solution might need to be searched for in the HydroMT code

Desired behaviour

Path should be interpreted correctly.

Additional context

Might be related to this line in the code (pre-v1, I did not check if the issue still exist with v1)

# escape unknown fields

I think because we use {} for keywords like variable, year, month. I think this may have been solved in the past but is not working anymore?
See the issue that was opened in hydromt-wflow for more details: Deltares/hydromt_wflow#298

@hboisgon hboisgon added Bug Something isn't working Needs refinement issue still needs refinement labels Sep 27, 2024
DirkEilander added a commit that referenced this issue Sep 27, 2024
@DirkEilander
Copy link
Contributor

This bug does not exist in v1, see test in

def test_uri_without_wildcard(self, test_filesystem: MemoryFileSystem):

In v0.10 it can be reproduces using the test code below and is fixed in 0e39435. We need to decide if and when we will release fixes to v0.10, but at least this way it can be installed from the v010 brach directly if users need it.

def test_resolve_path_unknown_key(tmp_path):
    # create dummy csv file
    path = tmp_path / "{unknown_key}.csv"
    path.write_text("test")
    # create adapter
    source = DataFrameAdapter(path=path)
    source._resolve_paths()

@DirkEilander DirkEilander added Bug Something isn't working and removed Bug Something isn't working Needs refinement issue still needs refinement labels Sep 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants