[GRASS-user] question on i.nightlights.intercalibration code

Nikos Alexandris nik at nikosalexandris.net
Fri Jul 6 00:55:50 PDT 2018


* Gabriel Cotlier <gabiklm01 at gmail.com> [2018-07-05 18:28:30 -0300]:

>Dear Markus,
>Thanks a lot for the explanation. For some reasoner every time I try to run
>g.region I can's and I got this pop up dialog box as in the figure below,
>and apparently g.region does not run...
>How could be possible to solve it?
>Thanks a lot again.
>Best regards,
>Gabriel

It is friendly, from the Operating System's side, trying to help in
handling GRASS GIS' .region files. Obviously, though, not required in
this case. It looks like you would need to search for how to tell the
Operating System to ignore .region files.


Thanks for the summary. In a shorter version:

r.in.gdal -a input=Fxy # for all images
g.region raster=Fx     # only once
i.nightlights.intercalibration ...

or

r.in.gdal input=Fxy  # for all images
r.region -a map=Fxy  # for all images
g.region raster=Fx   # only once
i.nightlights.intercalibration ...


More detailed

# import *all* images with
r.in.gdal -a input=Fxy

(
This is the import command for one image. All related images have to be
imported like that. Easier via a for loop, i.e., under Linux, and within
from the directory where all images reside,

for RASTER in Fxy*.tif ;do r.in.gdal -a input=$RASTER output=$(basename $RASTER .tif) ;done

This is a somewhat more elaborated one-line command. This is easily
to be done through the GUI: you can select a "directory" from
inside which to import images.

I recall also a related post from Helmut, on how to approach this in
Windows, in the command line.
)

# set the computational region
g.region raster=Fxy

# inter-calibrate your images
i.nightlights.intercalibration ...


What about r.region?

First, some clarifications:

- `r.in.gdal` imports a raster/image in to the GRASS GIS data base, by
  converting it in a GRASS GIS native raster format. It also sets the
  extent and resolution of a raster/image.

- `r.region` works directly on the images extent. It is a tool to modify
  the raster's metadata directly.

- `g.region` set the computational region for a GRASS GIS Location/Mapset,
which is then what almost all raster modules will consider as the
"active" region to perform computations on.


The `r.region -a` would come in play in case you have already imported
the image without the `-a` option for `r.in.gal`, say Fxy. and then you'd want to fix the pixel size
imprecision issue that Markus pointed out.

That would be:

r.in.gdal input=Fxy  # for all images
r.region -a map=Fxy  # for all images
g.region raster=Fxy  # only once!
i.nightlights.intercalibration  # for all related images


Since you are re-importing the images, using `r.in.gdal -a`, you don't
need to employ r.region at any step.


Finally,

if the above won't work, then there be something else that causes the
problem.

Please, do not hesitate to write back about this. We all have our own way
of learning. If whatever is discussed so far, is still not clear enough,
then let us try one more time: I will try to learn/improve how to better
communicate, in written form, these command instructions. And you could try to
go through what is written one more time, and take notes, one-by-one.

Best, Nikos
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20180706/fc27c2f4/attachment.sig>


More information about the grass-user mailing list