tools: add --link and --out parameters for raster and vector files#7182
tools: add --link and --out parameters for raster and vector files#7182tangelll wants to merge 8 commits intoOSGeo:mainfrom
Conversation
|
Hi @wenzeslaus, I have successfully implemented a 'one-step' execution flow where a user can link external data, run a module, and save the output externally in a single command. It currently handles: r.external / v.external linking before execution. r.external.out / v.external.out for direct external output. Does this align with the vision for CLI, or should I adjust the approach before moving further into the --region and import/export tasks? |
wenzeslaus
left a comment
There was a problem hiding this comment.
This needs more testing and a deeper analysis. What happens when you use the command twice in a same project (with --project)? How are multiple parameters and parameter interactions handled?
Also, this completely misses tests which are explicitly mentioned in the GSoC idea.
| create_parser.add_argument( | ||
| "--link-raster", | ||
| action="append", | ||
| help="link a raster map to the project (can be used multiple times)", | ||
| ) |
There was a problem hiding this comment.
What would be the use case for these in a workflow?
| run_subparser.add_argument( | ||
| "--link-raster", | ||
| type=str, | ||
| nargs="+", |
There was a problem hiding this comment.
This eats the "named arguments" unless used with =. Needs more config.
|
I would like to confirm if my testing methodology is on the right track. I noticed that there is currently no testsuite folder under v.external. Should I go ahead and create a new testsuite directory and add my test files there? Once I have your approval on this structure, I will proceed with the rest of the tests. |
|
Yes, you can create a |
After reading v.external.md, I decided not to add a testsuite because v.external is difficult to test reliably with existing GRASS testing mechanisms, and I chose to focus on revising my existing changes instead. Could you please start my Github workflow? |
This pr open for this issue :#7176
Description:
There is a project in Grass Gsoc ideas list which name is Subcommand CLI for GRASS. I am being able to finish Add
--link-raster=some/file.tiffwhich links (r.external) a raster file (same for vector and similarly for r.external.out).Before Start
Before starting the test, ensure that you have copied your updated cli.py to the GRASS installation directory.
For me (macOS m4):
Test
Run test_r_external.py under /r.external/testsuite
Result
Test For v.external under testsuite
Reading band -1 of 1...
ERROR 5: elevation.nc: GDALDataset::GetRasterBand(-1) - Illegal band #
ERROR: Selected band (-1) does not exist
Reading band 1 of 1...
Link to raster map <test_external_map> created.
Reading band 1 of 1...
Link to raster map <test_external_map> created.
Reading band 1 of 1...
Link to raster map <test_external_map> created.
Reading band 1 of 1...
Link to raster map <test_external_map> created.
ERROR 4: /Users/tangel/Works/grass/raster/r.external/testsuite/non_existent_file.tif: No such file or directory
Reading band 1 of 1...
Link to raster map <map_1> created.
Default region for this project updated
Region for the current mapset updated
Reading band 1 of 1...
Link to raster map <map_2> created.
Default region for this project updated
Region for the current mapset updated
Reading band 1 of 1...
Link to raster map <test_external_map> created.
Default region for this project updated
Region for the current mapset updated
Reading band 1 of 1...
Link to raster map <test_external_map> created.
Default region for this project updated
Region for the current mapset updated
Reading band 1 of 1...
Link to raster map <test_external_map> created.
Default region for this project updated
Region for the current mapset updated
Reading band 1 of 1...
Link to raster map <second_map> created.
Default region for this project updated
Region for the current mapset updated
Reading band 1 of 1...
Link to raster map <test_external_map> created.
Default region for this project updated
Region for the current mapset updated
No projection information available
Over-riding projection check
WARNING: Imagery group <test_external_map> already exists and will be
overwritten.
Reading band 1 of 5...
Link to raster map <test_external_map.1> created.
Reading band 2 of 5...
Link to raster map <test_external_map.2> created.
Reading band 3 of 5...
Link to raster map <test_external_map.3> created.
Reading band 4 of 5...
Link to raster map <test_external_map.4> created.
Reading band 5 of 5...
Link to raster map <test_external_map.5> created.
Imagery group <test_external_map> created
No projection information available
Over-riding projection check
WARNING: Imagery group <test_external_map> already exists and will be
overwritten.
Reading band 1 of 5...
Link to raster map <test_external_map.1> created.
Reading band 2 of 5...
Link to raster map <test_external_map.2> created.
Reading band 3 of 5...
Link to raster map <test_external_map.3> created.
Reading band 4 of 5...
Link to raster map <test_external_map.4> created.
Reading band 5 of 5...
Link to raster map <test_external_map.5> created.
Imagery group <test_external_map> created
No projection information available
Over-riding projection check
Reading band 2 of 5...
Link to raster map <test_external_map> created.
Ok