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
Allow batch -F to set a more specific naming template #6934
Conversation
See #6932 for discussion. This PR implements a -D option that stops any copying. This solution does not preempt further consideration of the other suggestion which is to generalize the naming of product files via a -Ftemplate option.
Rather than have a single running number as the product prefix we build one from this template and the -T data.
Happy to report that my command
relatively quickly produced 2970 grids with the new naming convention. The batch module is great for these things. |
If I use |
Yes, not tested but if your input file has trailing text and there are no other % except %s then that should be what it uses. Let me know if otherwise. |
YOu might even be able to give the template as -F%s and have the trialing text have the names you wanted, for example |
Ok, I try this script to make a png map for every european country. If I use Also, I only could get a map for countries with name with only one word (like "Andorra"), It failed with country like "San Marino". I got this error
Full script:
|
I dont see you using BATCH_NAME anywhere though? |
I would think you need to do gmt begin ${BATCH_NAME} png |
The space issue is something I was thinking about for regular numerical stuff too. My first effort had things like %4.1lf and once the argument was < 10 I got a space. So using %04.1lf fixed that. But I was thinking that when -F is used perhaps we should replace any resulting space with underscore. |
Now the spaces in BATCH_NAME become underscrores. |
Nop. I try with
|
Right. So the problem is that the input -T file is of course all trailing text but that means you have a single word with a tab in it. I did not consider that case. Now, I replace both spaces and tabs with undercores. Now the parameter file look like this, e.g.
|
Great. Now I only got an error with the Vatican City becuse the name has ():
|
|
That I cannot fix - needs to be a user fix I think. |
Ok. So I think it can be approved. |
Rather than have a single running number as the product prefix we may optionally build one from a C-style template and the data columns provided via the -T timefile. This allows products to be named to reflect more than just a running number. E.g.
-FE_obl_flex_G%4.2lf_I%4.0lf_%4.1lfk
will let me use${BATCH_NAME}.grd
to make more meaningful product names.This PR also fixes the bug mentioned in #6932 which assumed all product files must have extensions.
Documentation has been updated to reflect the enhancements. Apart from the bug fix, no default behavior has changed.