Opened 4 years ago

Last modified 4 years ago

#2931 new defect

r.neighbors shifts output raster by 360 degrees (WGS 84)

Reported by: markinpt Owned by: grass-dev@…
Priority: normal Milestone: 6.4.6
Component: Default Version: 6.4.3
Keywords: Cc:
CPU: x86-64 Platform: MSWindows 8

Description

Input raster is an elevation raster that goes from -180 to 180 longitude (WGS 84). I am using r.neighbors to calculate the elevation standard deviation over 9 cells circular.

The output comes back as 180 to 540 degrees in longitude. Not exactly a desirable outcome as I have to then shift it back to +- 180.

Change History (2)

comment:1 in reply to:  description Changed 4 years ago by glynn

Replying to markinpt:

Input raster is an elevation raster that goes from -180 to 180 longitude (WGS 84). I am using r.neighbors to calculate the elevation standard deviation over 9 cells circular.

The output comes back as 180 to 540 degrees in longitude. Not exactly a desirable outcome as I have to then shift it back to +- 180.

Does this happen if you use the -a flag?

Without that flag, r.neighbors aligns the region to the input map with

    if (!flag.align->answer) {
	Rast_get_cellhd(ncb.oldcell, "", &cellhd);
	G_get_window(&window);
	Rast_align_window(&window, &cellhd);
	Rast_set_window(&window);
    }

It's possible that Rast_align_window doesn't handle lat/lon correctly.

Also, is the current region correct when running r.neighbors? The bounds and resolution of the output map are dictated primarily by the current region, and are unaffected by any input maps unless the module specifically sets the region (as is the case for r.neighbors when run without the -a flag).

comment:2 Changed 4 years ago by markinpt

Sorry, I left out one key item. I am running r.neighbors through the QGIS GUI.

Given that context, what do you mean by "Current Region"? The Grass region extent? I left that as default because the source raster is the same extent that I wanted as an output.

Also, I am not sure if the -a flag is used or not in QGIS. I assumed this was a Grass issue but perhaps it is the way QGIS is calling r.neighbors?

Note: See TracTickets for help on using tickets.