NAME

RvalueScaleIs - test value scale on compatibility CSF version 1 and 2

SYNOPSIS

#include "csf.h"

int RvalueScaleIs
(
	const MAP *m,
	CSF_VS vs
);

PARAMETERS

const MAP *m
a version 1 map handle
CSF_VS vs
a version 2 value scale that is compatible with map's value scale yes or no?

Possible values for a

CSF_VS
are as follows: * version 1 datatypes, these can be returned by BUT NOT passed to a csf2 function * version 2 datatypes these two can be returned by or passed to a csf2 function * this one CANNOT be returned by NOR passed to a csf2 function

DESCRIPTION

RvalueScaleIs tests if the map's value scale is compatible with a certain value scale. Here is list of compatible but different value scales:

VS_NOTDETERMINED: always returns 0

VS_CLASSIFIED: VS_NOTDETERMINED

VS_CONTINUOUS: VS_NOTDETERMINED

VS_BOOLEAN: VS_CLASSIFIED, VS_NOTDETERMINED

VS_NOMINAL: VS_CLASSIFIED, VS_NOTDETERMINED

VS_ORDINAL: VS_CLASSIFIED, VS_NOTDETERMINED

VS_LDD: VS_CLASSIFIED, VS_NOTDETERMINED (only if cell representation is UINT1 or INT2)

VS_SCALAR: VS_CONTINUOUS, VS_NOTDETERMINED

VS_DIRECTION: none

RETURNS

0 if not compatible or if vs argument is VS_NOTDETERMINED or in case of error, nonzero if compatible.

MERRNO

BAD_VALUESCALE

EXAMPLE

#include 
#include 
#include "csf.h"

/* a simple csf-mask to stdout
 * program, with minimal checking
 * a mask is boolean-map, here we
 * use version 1 compatibility. 
 */

void main(int argc, char *argv[] )
{

  UINT1 *row;
  MAP *map;                      
  size_t r,c;

  if (argc != 2)
  {
   fprintf(stderr,"%s: no file specified\n",argv[0]);
   exit(1);
  }

  map = Mopen(argv[1], M_READ);

  if (! RvalueScaleIs(map, VS_BOOLEAN))
  {    /* it's not VS_BOOLEAN, VS_CLASSIFIED 
        * or VS_NOTDETERMINED 
        */
       fprintf(stderr,"'%s' is not a boolean map\n",argv[1]);
       exit(1);
  }

  RuseAs(map, VS_BOOLEAN); 
  row = (UINT1 *)Rmalloc(map, RgetNrCols(map));

  for(r=0; r < RgetNrRows(map); r++)
  {
   RgetRow(map, r, row);
   for(c=0; c < RgetNrCols(map); c++)
     printf("%d ",(int)row[c]);
   printf("\n");
  }

  free(row);
  Mclose(map);

  exit(0);
}