-
Notifications
You must be signed in to change notification settings - Fork 81
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
More liberal pattern when running terracotta ingest
#271
Comments
Unfortunately this is an unsolvable problem. Raster patterns are a confusing mess, and I am hesitant to make it even more confusing by capturing more stuff. They are really meant only for the simplest of use cases. Is there any particular reason why you don't want to use the Python API for ingestion like we recommend in the docs? I could be nudged to support regex patterns as a power-user feature: $ terracotta ingest --raster-regex "(?P<type>\w+)__rp_(?P<rp>\d+)__rcp_(?P<rcp>\d+\.\d+)__epoch_(?P<epoch>\d+)__gcm_(?P<gcm>[\w-]+)\.tif" But I think you have to agree that the patterns are quite messy, so it might be easier to use the Python API :) |
I can see the problem. I guess I asked because the I can't see myself typing out that I wonder if a simpler example script in the docs might help:
I can draft a PR with an attempt at adding to the docs if you like - otherwise do close this, some version of using the API is the way forward 😊 |
This looks awesome, thanks! I would gladly accept a PR on this. |
The terracotta ingest script is limited in what it can parse, see DHI/terracotta#271
It would be convenient to allow some punctuation marks as well as alphanumeric characters in the regex pattern matching key values.
I have a raster pattern like:
{type}__rp_{rp}__rcp_{rcp}__epoch_{epoch}__gcm_{gcm}.tif
and files like:
cyclone__rp_10__rcp_8.5__epoch_2050__gcm_CMCC-CM2-VHR4.tif
river__rp_2__rcp_8.5__epoch_2030__gcm_MIROC-ESM-CHEM.tif
The regex match is too strict to allow the
.
or-
in values - could it be relaxed? I can patch the filenames as a workaround, but a quick edit to the key bit of the regex so it's just[^_]+
seems to work okay locally:https://github.com/DHI-GRAS/terracotta/blob/b7c67c3c2736401295644c1e8882b3f0f013bb5c/terracotta/scripts/click_types.py#L74
The text was updated successfully, but these errors were encountered: