[GRASS-dev] Error reading null row 2725 for <MASK>

When running several r.mapcalc in a loop (via R) the function stops with an error:

ERROR: Error reading null row 2725 for

The row number varies. This seems to happen at random, and when I repeat the same r.mapcalc calculation that stopped with the error before, things run without problem.

I tried after removing the mask, and this time no problem so it may have to do something with the MASK? (as these error messages only occur once in a while, I can’t be completely sure it only happens when a MASK is defined).

I ran it through R, using the execGRASS() function of the spgrass6 package. I ran the same, but using the system call instead of execGRASS. Still got the same error messages. I therefore guess this has nothing to do with R?

I forgot to mention that I am using GRASS 7.1 (rev 61757, had it before with rev 61413, but I think I had a similar problem about a year ago).

···

On Wed, Aug 27, 2014 at 10:13 AM, Paulo van Breugel <p.vanbreugel@gmail.com> wrote:

When running several r.mapcalc in a loop (via R) the function stops with an error:

ERROR: Error reading null row 2725 for

The row number varies. This seems to happen at random, and when I repeat the same r.mapcalc calculation that stopped with the error before, things run without problem.

I tried after removing the mask, and this time no problem so it may have to do something with the MASK? (as these error messages only occur once in a while, I can’t be completely sure it only happens when a MASK is defined).

I ran it through R, using the execGRASS() function of the spgrass6 package. I ran the same, but using the system call instead of execGRASS. Still got the same error messages. I therefore guess this has nothing to do with R?

On Wed, Aug 27, 2014 at 3:25 PM, Paulo van Breugel
<p.vanbreugel@gmail.com> wrote:

I forgot to mention that I am using GRASS 7.1 (rev 61757, had it before with
rev 61413, but I think I had a similar problem about a year ago).

On Wed, Aug 27, 2014 at 10:13 AM, Paulo van Breugel <p.vanbreugel@gmail.com>
wrote:

When running several r.mapcalc in a loop (via R) the function stops with
an error:

ERROR: Error reading null row 2725 for <MASK>

The error comes from read_null_bits() in
lib/raster/get_row.c

around
http://trac.osgeo.org/grass/browser/grass/trunk/lib/raster/get_row.c#L827

Maybe some off_t definition is missing?

The row number varies. This seems to happen at random, and when I repeat
the same r.mapcalc calculation that stopped with the error before, things
run without problem.

Please tell us also
- how many raster cells are involved
- how many files are opened in the loop?

I tried after removing the mask, and this time no problem so it may have
to do something with the MASK? (as these error messages only occur once in a
while, I can't be completely sure it only happens when a MASK is defined).

I ran it through R, using the execGRASS() function of the spgrass6
package. I ran the same, but using the system call instead of execGRASS.
Still got the same error messages. I therefore guess this has nothing to do
with R?

Could you "simulate" the loops in a GRASS script outside of R to see
if it the same?

Markus

On Wed, Aug 27, 2014 at 8:20 PM, Markus Neteler <neteler@osgeo.org> wrote:

On Wed, Aug 27, 2014 at 3:25 PM, Paulo van Breugel
<p.vanbreugel@gmail.com> wrote:
> I forgot to mention that I am using GRASS 7.1 (rev 61757, had it before
with
> rev 61413, but I think I had a similar problem about a year ago).
>
> On Wed, Aug 27, 2014 at 10:13 AM, Paulo van Breugel <
p.vanbreugel@gmail.com>
> wrote:
>>
>> When running several r.mapcalc in a loop (via R) the function stops with
>> an error:
>>
>> ERROR: Error reading null row 2725 for <MASK>

The error comes from read_null_bits() in
lib/raster/get_row.c

around
http://trac.osgeo.org/grass/browser/grass/trunk/lib/raster/get_row.c#L827

Maybe some off_t definition is missing?

I don't know what that means; indication of something being wrong with the
data, or in the code?

>> The row number varies. This seems to happen at random, and when I repeat
>> the same r.mapcalc calculation that stopped with the error before,
things
>> run without problem.

Please tell us also
- how many raster cells are involved
- how many files are opened in the loop?

Last time the error occured in the r.mapcalc below:

  The command:
r.mapcalc --overwrite expression="OUTPUT = if(MESSC==0, 100000* 100.0 *
(MESSB-12300000)/(382900000-12300000), if(MESSC<=5000000, 2*MESSC,
if(MESSC<=10000000, 2*(10000000-MESSC),100000 * 100.0 * (382900000-
MESSB)/(382900000-12300000))))"
produced an error (1) during execution:
ERROR: Error reading null row 2725 for <MASK>

These layers have 6515140 raster cells, with 3366825 total null cells. The
command is part of a sequence of commands that is run in a loop, but these
are run in sequence so at the time of the error I guess two layers were
open. As I mentioned, running the command again and it will normally run
without problems with the given input layers, and it may go wrong with
other input layers again, without any discernible logic to me.

>> I tried after removing the mask, and this time no problem so it may have
>> to do something with the MASK? (as these error messages only occur once
in a
>> while, I can't be completely sure it only happens when a MASK is
defined).
>>
>> I ran it through R, using the execGRASS() function of the spgrass6
>> package. I ran the same, but using the system call instead of execGRASS.
>> Still got the same error messages. I therefore guess this has nothing
to do
>> with R?

Could you "simulate" the loops in a GRASS script outside of R to see
if it the same?

I'll have to figure out how to do that. Perhaps running the r.mapcalc above
several times will do the trick.

Markus

On Thu, Aug 28, 2014 at 7:34 AM, Paulo van Breugel <p.vanbreugel@gmail.com>
wrote:

On Wed, Aug 27, 2014 at 8:20 PM, Markus Neteler <neteler@osgeo.org> wrote:

On Wed, Aug 27, 2014 at 3:25 PM, Paulo van Breugel
<p.vanbreugel@gmail.com> wrote:
> I forgot to mention that I am using GRASS 7.1 (rev 61757, had it before
with
> rev 61413, but I think I had a similar problem about a year ago).
>
> On Wed, Aug 27, 2014 at 10:13 AM, Paulo van Breugel <
p.vanbreugel@gmail.com>
> wrote:
>>
>> When running several r.mapcalc in a loop (via R) the function stops
with
>> an error:
>>
>> ERROR: Error reading null row 2725 for <MASK>

The error comes from read_null_bits() in
lib/raster/get_row.c

around
http://trac.osgeo.org/grass/browser/grass/trunk/lib/raster/get_row.c#L827

Maybe some off_t definition is missing?

I don't know what that means; indication of something being wrong with the
data, or in the code?

>> The row number varies. This seems to happen at random, and when I
repeat
>> the same r.mapcalc calculation that stopped with the error before,
things
>> run without problem.

Please tell us also
- how many raster cells are involved
- how many files are opened in the loop?

Last time the error occured in the r.mapcalc below:

  The command:
r.mapcalc --overwrite expression="OUTPUT = if(MESSC==0, 100000* 100.0 *
(MESSB-12300000)/(382900000-12300000), if(MESSC<=5000000, 2*MESSC,
if(MESSC<=10000000, 2*(10000000-MESSC),100000 * 100.0 * (382900000-
MESSB)/(382900000-12300000))))"
produced an error (1) during execution:

ERROR: Error reading null row 2725 for <MASK>

These layers have 6515140 raster cells, with 3366825 total null cells. The
command is part of a sequence of commands that is run in a loop, but these
are run in sequence so at the time of the error I guess two layers were
open. As I mentioned, running the command again and it will normally run
without problems with the given input layers, and it may go wrong with
other input layers again, without any discernible logic to me.

>> I tried after removing the mask, and this time no problem so it may
have
>> to do something with the MASK? (as these error messages only occur
once in a
>> while, I can't be completely sure it only happens when a MASK is
defined).
>>
>> I ran it through R, using the execGRASS() function of the spgrass6
>> package. I ran the same, but using the system call instead of
execGRASS.
>> Still got the same error messages. I therefore guess this has nothing
to do
>> with R?

Could you "simulate" the loops in a GRASS script outside of R to see
if it the same?

I'll have to figure out how to do that. Perhaps running the r.mapcalc
above several times will do the trick.

I ran the same calculations, but this time as a list of grass commands in a
text file, which I subsequently ran from the command line
(./runMyscript.txt). Same error, so this does not seem to be related to R.

Perhaps totally coincidence, but in all cases I remember I encountered this
problem, I was running r.mapcalc expressions with an 'if' function

Markus

On Mon, Sep 1, 2014 at 10:45 AM, Paulo van Breugel <p.vanbreugel@gmail.com>
wrote:

On Thu, Aug 28, 2014 at 7:34 AM, Paulo van Breugel <p.vanbreugel@gmail.com
> wrote:

On Wed, Aug 27, 2014 at 8:20 PM, Markus Neteler <neteler@osgeo.org>
wrote:

On Wed, Aug 27, 2014 at 3:25 PM, Paulo van Breugel
<p.vanbreugel@gmail.com> wrote:
> I forgot to mention that I am using GRASS 7.1 (rev 61757, had it
before with
> rev 61413, but I think I had a similar problem about a year ago).
>
> On Wed, Aug 27, 2014 at 10:13 AM, Paulo van Breugel <
p.vanbreugel@gmail.com>
> wrote:
>>
>> When running several r.mapcalc in a loop (via R) the function stops
with
>> an error:
>>
>> ERROR: Error reading null row 2725 for <MASK>

The error comes from read_null_bits() in
lib/raster/get_row.c

around
http://trac.osgeo.org/grass/browser/grass/trunk/lib/raster/get_row.c#L827

Maybe some off_t definition is missing?

I don't know what that means; indication of something being wrong with
the data, or in the code?

>> The row number varies. This seems to happen at random, and when I
repeat
>> the same r.mapcalc calculation that stopped with the error before,
things
>> run without problem.

Please tell us also
- how many raster cells are involved
- how many files are opened in the loop?

Last time the error occured in the r.mapcalc below:

  The command:
r.mapcalc --overwrite expression="OUTPUT = if(MESSC==0, 100000* 100.0 *
(MESSB-12300000)/(382900000-12300000), if(MESSC<=5000000, 2*MESSC,
if(MESSC<=10000000, 2*(10000000-MESSC),100000 * 100.0 * (382900000-
MESSB)/(382900000-12300000))))"
produced an error (1) during execution:

ERROR: Error reading null row 2725 for <MASK>

These layers have 6515140 raster cells, with 3366825 total null cells.
The command is part of a sequence of commands that is run in a loop, but
these are run in sequence so at the time of the error I guess two layers
were open. As I mentioned, running the command again and it will normally
run without problems with the given input layers, and it may go wrong with
other input layers again, without any discernible logic to me.

>> I tried after removing the mask, and this time no problem so it may
have
>> to do something with the MASK? (as these error messages only occur
once in a
>> while, I can't be completely sure it only happens when a MASK is
defined).
>>
>> I ran it through R, using the execGRASS() function of the spgrass6
>> package. I ran the same, but using the system call instead of
execGRASS.
>> Still got the same error messages. I therefore guess this has nothing
to do
>> with R?

Could you "simulate" the loops in a GRASS script outside of R to see
if it the same?

I'll have to figure out how to do that. Perhaps running the r.mapcalc
above several times will do the trick.

I ran the same calculations, but this time as a list of grass commands in
a text file, which I subsequently ran from the command line
(./runMyscript.txt). Same error, so this does not seem to be related to R.

Perhaps totally coincidence, but in all cases I remember I encountered
this problem, I was running r.mapcalc expressions with an 'if' function

And a further update: I the same r.mapcalc calculations with and without
MASK defined, and it as far as I can see, this seems to happen only when a
MASK is defined.

Markus

On Thu, Aug 28, 2014 at 7:34 AM, Paulo van Breugel
<p.vanbreugel@gmail.com> wrote:

On Wed, Aug 27, 2014 at 8:20 PM, Markus Neteler <neteler@osgeo.org> wrote:

On Wed, Aug 27, 2014 at 3:25 PM, Paulo van Breugel
> I forgot to mention that I am using GRASS 7.1 (rev 61757, had it before
> with rev 61413, but I think I had a similar problem about a year ago).
>
> On Wed, Aug 27, 2014 at 10:13 AM, Paulo van Breugel
>> When running several r.mapcalc in a loop (via R) the function stops
>> with an error:
>>
>> ERROR: Error reading null row 2725 for <MASK>

The error comes from read_null_bits() in
lib/raster/get_row.c

around
http://trac.osgeo.org/grass/browser/grass/trunk/lib/raster/get_row.c#L827

Maybe some off_t definition is missing?

I don't know what that means; indication of something being wrong with the
data, or in the code?

Question: did you compile with --with-pthread?
AFAIK it causes troubles.

Markus

>> The row number varies. This seems to happen at random, and when I
>> repeat
>> the same r.mapcalc calculation that stopped with the error before,
>> things run without problem.

Please tell us also
- how many raster cells are involved
- how many files are opened in the loop?

Last time the error occured in the r.mapcalc below:

  The command:
r.mapcalc --overwrite expression="OUTPUT = if(MESSC==0, 100000* 100.0 *
(MESSB-12300000)/(382900000-12300000), if(MESSC<=5000000, 2*MESSC,
if(MESSC<=10000000, 2*(10000000-MESSC),100000 * 100.0 * (382900000-
MESSB)/(382900000-12300000))))"
produced an error (1) during execution:
ERROR: Error reading null row 2725 for <MASK>

These layers have 6515140 raster cells, with 3366825 total null cells. The
command is part of a sequence of commands that is run in a loop, but these
are run in sequence so at the time of the error I guess two layers were
open. As I mentioned, running the command again and it will normally run
without problems with the given input layers, and it may go wrong with other
input layers again, without any discernible logic to me.

>> I tried after removing the mask, and this time no problem so it may
>> have
>> to do something with the MASK? (as these error messages only occur once
>> in a
>> while, I can't be completely sure it only happens when a MASK is
>> defined).
>>
>> I ran it through R, using the execGRASS() function of the spgrass6
>> package. I ran the same, but using the system call instead of
>> execGRASS.
>> Still got the same error messages. I therefore guess this has nothing
>> to do
>> with R?

Could you "simulate" the loops in a GRASS script outside of R to see
if it the same?

I'll have to figure out how to do that. Perhaps running the r.mapcalc above
several times will do the trick.

Markus

I did. I recompile and see if that takes care of the problem.

···

On Wed, Sep 10, 2014 at 1:10 AM, Markus Neteler <neteler@osgeo.org> wrote:

On Thu, Aug 28, 2014 at 7:34 AM, Paulo van Breugel
<p.vanbreugel@gmail.com> wrote:

On Wed, Aug 27, 2014 at 8:20 PM, Markus Neteler <neteler@osgeo.org> wrote:

On Wed, Aug 27, 2014 at 3:25 PM, Paulo van Breugel

I forgot to mention that I am using GRASS 7.1 (rev 61757, had it before
with rev 61413, but I think I had a similar problem about a year ago).

On Wed, Aug 27, 2014 at 10:13 AM, Paulo van Breugel

When running several r.mapcalc in a loop (via R) the function stops
with an error:

ERROR: Error reading null row 2725 for

The error comes from read_null_bits() in
lib/raster/get_row.c

around
http://trac.osgeo.org/grass/browser/grass/trunk/lib/raster/get_row.c#L827

Maybe some off_t definition is missing?

I don’t know what that means; indication of something being wrong with the
data, or in the code?

Question: did you compile with --with-pthread?
AFAIK it causes troubles.

Markus

The row number varies. This seems to happen at random, and when I
repeat
the same r.mapcalc calculation that stopped with the error before,
things run without problem.

Please tell us also

  • how many raster cells are involved
  • how many files are opened in the loop?

Last time the error occured in the r.mapcalc below:

The command:
r.mapcalc --overwrite expression=“OUTPUT = if(MESSC==0, 100000* 100.0 *
(MESSB-12300000)/(382900000-12300000), if(MESSC<=5000000, 2MESSC,
if(MESSC<=10000000, 2
(10000000-MESSC),100000 * 100.0 * (382900000-
MESSB)/(382900000-12300000))))”
produced an error (1) during execution:
ERROR: Error reading null row 2725 for

These layers have 6515140 raster cells, with 3366825 total null cells. The
command is part of a sequence of commands that is run in a loop, but these
are run in sequence so at the time of the error I guess two layers were
open. As I mentioned, running the command again and it will normally run
without problems with the given input layers, and it may go wrong with other
input layers again, without any discernible logic to me.

I tried after removing the mask, and this time no problem so it may
have
to do something with the MASK? (as these error messages only occur once
in a
while, I can’t be completely sure it only happens when a MASK is
defined).

I ran it through R, using the execGRASS() function of the spgrass6
package. I ran the same, but using the system call instead of
execGRASS.
Still got the same error messages. I therefore guess this has nothing
to do
with R?

Could you “simulate” the loops in a GRASS script outside of R to see
if it the same?

I’ll have to figure out how to do that. Perhaps running the r.mapcalc above
several times will do the trick.

Markus