Skip to content

Comments

r.in.nasadem + r.in.srtm.region: fix PROJ parsing#500

Merged
neteler merged 3 commits intoOSGeo:masterfrom
neteler:r_in_nasadem_srtm_proj_fix
Apr 14, 2021
Merged

r.in.nasadem + r.in.srtm.region: fix PROJ parsing#500
neteler merged 3 commits intoOSGeo:masterfrom
neteler:r_in_nasadem_srtm_proj_fix

Conversation

@neteler
Copy link
Member

@neteler neteler commented Apr 3, 2021

Due to OSGeo/grass#1240 the output structure of g.proj -g has changed, leading to KeyError: 'EPSG':

r.in.nasadem user='neteler' password='XXXXXXXXX' output=nasadem resolution=30
Traceback (most recent call last):
  File "/home/mundialis/.grass7/addons/scripts/r.in.nasadem", line 631, in <module>
    main()
  File "/home/mundialis/.grass7/addons/scripts/r.in.nasadem", line 475, in main
    SRCGISRC, TMPLOC = createTMPlocation()
  File "/home/mundialis/.grass7/addons/scripts/r.in.nasadem", line 342, in createTMPlocation
    if grass.parse_command('g.proj', flags='g')['EPSG'] != str(epsg):
KeyError: 'EPSG'
ERROR: Region <r_in_nasadem_region_409609> not found
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/home/mundialis/.grass7/addons/scripts/r.in.nasadem", line 312, in cleanup
    grass.run_command("g.region", region=tmpregionname)
  File "/home/mundialis/software/grass78_git/dist.x86_64-pc-linux-gnu/etc/python/grass/script/core.py", line 441, in run_command
    return handle_errors(returncode, returncode, args, kwargs)
  File "/home/mundialis/software/grass78_git/dist.x86_64-pc-linux-gnu/etc/python/grass/script/core.py", line 342, in handle_errors
    raise CalledModuleError(module=None, code=code,
grass.exceptions.CalledModuleError: Module run None g.region region=r_in_nasadem_region_409609 ended with error
Process ended with non-zero return code 1. See errors in the (error) output.

Reason: the recent PROJ updates introduced srid in the output of g.proj -g:

{'name': 'WGS 84', 'datum': 'wgs84', 'ellps': 'wgs84', 'proj': 'll', 'no_defs': 'defined', 'srid': 'EPSG:4326', 'unit': 'degree', 'units': 'degrees', 'meters': '1.0'}

This PR addresses the needed parsing change (feedback concerning the Python style is welcome).

Fixes

  • r.in.nasadem
  • r.in.srtm.region

(perhaps other addons are affected as well)

Due to OSGeo/grass#1240 the output structure of `g.proj -g` changed, leading to

```
r.in.nasadem user='neteler' password='XXXXXXXXX' output=nasadem resolution=30
Traceback (most recent call last):
  File "/home/mundialis/.grass7/addons/scripts/r.in.nasadem", line 631, in <module>
    main()
  File "/home/mundialis/.grass7/addons/scripts/r.in.nasadem", line 475, in main
    SRCGISRC, TMPLOC = createTMPlocation()
  File "/home/mundialis/.grass7/addons/scripts/r.in.nasadem", line 342, in createTMPlocation
    if grass.parse_command('g.proj', flags='g')['EPSG'] != str(epsg):
KeyError: 'EPSG'
ERROR: Region <r_in_nasadem_region_409609> not found
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File "/home/mundialis/.grass7/addons/scripts/r.in.nasadem", line 312, in cleanup
    grass.run_command("g.region", region=tmpregionname)
  File "/home/mundialis/software/grass78_git/dist.x86_64-pc-linux-gnu/etc/python/grass/script/core.py", line 441, in run_command
    return handle_errors(returncode, returncode, args, kwargs)
  File "/home/mundialis/software/grass78_git/dist.x86_64-pc-linux-gnu/etc/python/grass/script/core.py", line 342, in handle_errors
    raise CalledModuleError(module=None, code=code,
grass.exceptions.CalledModuleError: Module run None g.region region=r_in_nasadem_region_409609 ended with error
Process ended with non-zero return code 1. See errors in the (error) output.
```

The change is the introduction of `srid`:

```
{'name': 'WGS 84', 'datum': 'wgs84', 'ellps': 'wgs84', 'proj': 'll', 'no_defs': 'defined', 'srid': 'EPSG:4326', 'unit': 'degree', 'units': 'degrees', 'meters': '1.0'}
```

which is addressed by this PR (feedback concerning the Python style is welcome).

Fixes
- r.in.nasadem
- r.in.srtm.region

(perhaps other addons are affected as well)
@neteler neteler added the bug Something isn't working label Apr 3, 2021
@neteler neteler requested a review from metzm April 3, 2021 14:20
@neteler neteler merged commit da14e61 into OSGeo:master Apr 14, 2021
@neteler neteler deleted the r_in_nasadem_srtm_proj_fix branch April 14, 2021 07:41
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

Successfully merging this pull request may close these issues.

2 participants