Opened 11 years ago

Closed 11 years ago

#1801 closed defect (fixed)

r3.in.ascii fails in GRASS6.4.3

Reported by: helena Owned by: grass-dev@…
Priority: critical Milestone: 6.4.3
Component: Raster3D Version: svn-releasebranch64
Keywords: r3.in.ascii, raster3d import Cc:
CPU: OSX/Intel Platform: MacOSX

Description (last modified by neteler)

r3.in.ascii produces the following error in GRASS6.4.3svn compiled today

GRASS 6.4.3svn (nc_spm_05):~ > r3.in.ascii JR_7408MR_2m3dtest.asci out=testr3inasci
Loading data ... (570x594x8)
ERROR: asciiToG3d: read failed

running r3.info on the created (but broken) 3d raster shows that following command was used:
r3.in.ascii input="JR_7408MR_2m3dtest.asci" output="testin3d" nv="no\   |
 |    ne" type="default" precision="default" compression="default" tiledim\   |
 |    ension="default"

and running r3.in.ascii --help also shows that default value is the string default rather than a valid number. I tried to run it with some reasonable numbers but I got

ERROR: Error getting standard parameters

Change History (9)

comment:1 by martinl, 11 years ago

Keywords: r3.in.ascii added

comment:2 by neteler, 11 years ago

Description: modified (diff)

comment:3 by neteler, 11 years ago

(This also applies to GRASS 7)

The default:default looks confusing and useless to me:

             nv   String representing NULL value data cell (use 'none' if no such value)
                  default: none
           type   Data type used in the output file
                  options: default,double,float
                  default: default
      precision   Precision used in the output file (default, max, or 0 to 52)
                  default: default
    compression   The compression method used in the output file
                  options: default,rle,none
                  default: default
  tiledimension   The dimensions of the tiles used in the output file
                  default: default

Bad initialization in lib/g3d/g3dparam.c I suppose.

comment:4 by helena, 11 years ago

I found that r3.in.ascii fails when there is nulls exported as * in the ascii file

GRASS 6.4.3svn (nc_spm_05):~/grassdata/indata/test3d > r3.in.ascii hatelevnull3d.asci out=test3d_importfpnull

Loading data ... (484x654x10)

ERROR: asciiToG3d: read failed

if I replace * with 0 it reads the file OK

GRASS 6.4.3svn (nc_spm_05):~/grassdata/indata/test3d > r3.in.ascii hatelev_test3d.asci out=test3d_importfp0

Loading data ... (484x654x10)

r3.in.ascii complete.

but as mentioned above, the initialization of the parameters has bugs, for example, if I try to define null as * (which is the default for r3.out.ascii) I get error

GRASS 6.4.3svn (nc_spm_05):~/grassdata/indata/test3d > r3.in.ascii hatelevnull3d.asci out=test3d_importfpnull nv=* --o

ERROR: getParams: NULL-value value invalid

(nv="*" does not help)

perhaps because it expects number instead of string in main.c ?

param.nv = G_define_option(); param.nv->key = "nv"; param.nv->type = TYPE_STRING; param.nv->required = NO; param.nv->multiple = NO; param.nv->answer = "none"; param.nv->description =

_("String representing NULL value data cell (use 'none' if no such value)");

}

/*---------------------------------------------------------------------------*/

static void getParams(char input, char output, int *convertNull, double *nullValue) {

*input = param.input->answer; *output = param.output->answer; *convertNull = (strcmp(param.nv->answer, "none") != 0); if (*convertNull)

if (sscanf(param.nv->answer, "%lf", nullValue) != 1)

fatalError("getParams: NULL-value value invalid");

G_debug(3, "getParams: input: %s, output: %s", *input, *output);

}

The default,default issue seems to be indeed in g3dparam.c -for example, I think the answer should be float instead of default here:

param->type->answer = "default";

param->type->options = "default,double,float"; param->type->description = _("Data type used in the output file");

It is supposed to get value described in G3D Defaults, but it does not.

in reply to:  4 comment:5 by mmetz, 11 years ago

Replying to helena:

I found that r3.in.ascii fails when there is nulls exported as * in the ascii file

GRASS 6.4.3svn (nc_spm_05):~/grassdata/indata/test3d > r3.in.ascii hatelevnull3d.asci out=test3d_importfpnull

Loading data ... (484x654x10)

ERROR: asciiToG3d: read failed

if I replace * with 0 it reads the file OK

GRASS 6.4.3svn (nc_spm_05):~/grassdata/indata/test3d > r3.in.ascii hatelev_test3d.asci out=test3d_importfp0

Loading data ... (484x654x10)

r3.in.ascii complete.

but as mentioned above, the initialization of the parameters has bugs, for example, if I try to define null as * (which is the default for r3.out.ascii) I get error

GRASS 6.4.3svn (nc_spm_05):~/grassdata/indata/test3d > r3.in.ascii hatelevnull3d.asci out=test3d_importfpnull nv=* --o

ERROR: getParams: NULL-value value invalid

(nv="*" does not help)

Fixed for relbr64 and devbr6 in r54862-3. Trunk was not affected. I have also changed the default nv answer to "*", as in trunk.

Markus M

in reply to:  3 comment:6 by mmetz, 11 years ago

Replying to neteler:

(This also applies to GRASS 7)

The default:default looks confusing and useless to me:

             nv   String representing NULL value data cell (use 'none' if no such value)
                  default: none
           type   Data type used in the output file
                  options: default,double,float
                  default: default
      precision   Precision used in the output file (default, max, or 0 to 52)
                  default: default
    compression   The compression method used in the output file
                  options: default,rle,none
                  default: default
  tiledimension   The dimensions of the tiles used in the output file
                  default: default

Bad initialization in lib/g3d/g3dparam.c I suppose.

In trunk, the defaults are read from environment variables. If the corresponding variables are not set, internal defaults are used. With regard to the affected options, I would suggest to remove the default answer, i.e. have

             nv   String representing NULL value data cell (use 'none' if no such value)
                  default: none
           type   Data type used in the output file
                  options: double,float
      precision   Precision used in the output file (max, or 0 to 52)
    compression   The compression method used in the output file
                  options: rle,none
  tiledimension   The dimensions of the tiles used in the output file

If no answer is given to these options, use internal defaults. OK?

Markus M

in reply to:  description ; comment:7 by hellik, 11 years ago

Replying to helena:

r3.in.ascii produces the following error in GRASS6.4.3svn compiled today

tested with test data mentioned here

http://lists.osgeo.org/pipermail/grass-dev/2013-February/061990.html

with the lastest osgeo4w-wingrass6.4.3svn nightly build, it works.

Helmut

comment:8 by hamish, 11 years ago

Hi,

fyi there's a 'vox' demo data here to try as another data point:

http://grasswiki.osgeo.org/wiki/Help_with_3D#Examples

I got as far as adding iso surfaces in NVIZ, it wouldn't let me enter a value for a New Constant and left it as 0.00000. But that's for another bug report I guess..

Hamish

ps- I guess backwards compatibility is not an issue here, since "=default" wouldn't have worked?

in reply to:  7 comment:9 by hamish, 11 years ago

Resolution: fixed
Status: newclosed

Replying to hellik:

tested with test data mentioned here http://lists.osgeo.org/pipermail/grass-dev/2013-February/061990.html with the lastest osgeo4w-wingrass6.4.3svn nightly build, it works.

ok, thanks. closing ticket.

Hamish

Note: See TracTickets for help on using tickets.