[GRASS-dev] null value in vector (v.in.ascii, v.surf.*)

Hi,

I am importing a large amount of ascii files as 3D vectors, some of
them have null values (currently set to an arbitrary high constant
value)

Is there a filter for v.in.ascii to set null values,
and/or
in v.surf.* to avoid using those points with specific values?

Yann

--
Yann Chemin
Researcher@IWMI
Skype/FB: yann.chemin

Yann wrote:

I am importing a large amount of ascii files as 3D vectors,
some of them have null values (currently set to an arbitrary
high constant value)

Is there a filter for v.in.ascii to set null values,
and/or in v.surf.* to avoid using those points with
specific values?

I typically do it with a pipe through 'grep -v',

NULL=99999.99
grep -vw "$NULL" infile.csv | v.in.ascii ...

and try to make the regex in the grep search as explicit as
possible to avoid false positives.

Hamish

Does this mean that v.in.ascii recognizes 99999.99 as a grass vector null value?

If I use 99999.99 in v.surf.* will it be discarded from the interpolation?

On 16 May 2013 11:44, Hamish <hamish_b@yahoo.com> wrote:

Yann wrote:

I am importing a large amount of ascii files as 3D vectors,
some of them have null values (currently set to an arbitrary
high constant value)

Is there a filter for v.in.ascii to set null values,
and/or in v.surf.* to avoid using those points with
specific values?

I typically do it with a pipe through 'grep -v',

NULL=99999.99
grep -vw "$NULL" infile.csv | v.in.ascii ...

and try to make the regex in the grep search as explicit as
possible to avoid false positives.

Hamish

--
Yann Chemin
Researcher@IWMI
Skype/FB: yann.chemin

Yann:

Does this mean that v.in.ascii recognizes 99999.99 as a grass
vector null value?

If I use 99999.99 in v.surf.* will it be discarded from the
interpolation?

Nope, the 'grep -v' means that entire row of data is excluded
from the datastream and never sent to v.in.ascii in the first
place.

I just used NULL=99999.99 as an example, NULL= could be set to
anything.

If you need the x,y row there, but with empty values instead of
9999s in some column, then db.execute might be a faster way
than v.db.update to clear them (only open and close the DB once),
but v.extract with where="value < 9998" might be fastest of all.

Hamish

Thanks Hamish,

thinking in vector mode is different than in raster mode...

Yann

On 16 May 2013 12:45, Hamish <hamish_b@yahoo.com> wrote:

Yann:

Does this mean that v.in.ascii recognizes 99999.99 as a grass
vector null value?

If I use 99999.99 in v.surf.* will it be discarded from the
interpolation?

Nope, the 'grep -v' means that entire row of data is excluded
from the datastream and never sent to v.in.ascii in the first
place.

I just used NULL=99999.99 as an example, NULL= could be set to
anything.

If you need the x,y row there, but with empty values instead of
9999s in some column, then db.execute might be a faster way
than v.db.update to clear them (only open and close the DB once),
but v.extract with where="value < 9998" might be fastest of all.

Hamish

--
Yann Chemin
Researcher@IWMI
Skype/FB: yann.chemin

On Thu, May 16, 2013 at 9:15 AM, Hamish <hamish_b@yahoo.com> wrote:

Yann:

Does this mean that v.in.ascii recognizes 99999.99 as a grass
vector null value?

If I use 99999.99 in v.surf.* will it be discarded from the
interpolation?

Nope, the 'grep -v' means that entire row of data is excluded
from the datastream and never sent to v.in.ascii in the first
place.

I just used NULL=99999.99 as an example, NULL= could be set to
anything.

If you need the x,y row there, but with empty values instead of
9999s in some column, then db.execute might be a faster way
than v.db.update to clear them (only open and close the DB once),
but v.extract with where="value < 9998" might be fastest of all.

How about having a "exclude" parameter in v.in.ascii POINT mode?

Eg. g.mlist has
  exclude=string
     Map name exclusion pattern (default: none)
  See: http://grass.osgeo.org/grass70/manuals/g.mlist.html

?
Markus