null_val.c File Reference

#include <string.h>
#include <grass/gis.h>
#include <grass/glocale.h>

Include dependency graph for null_val.c:

Go to the source code of this file.

Functions

void G__init_null_patterns (void)
void G__set_null_value (void *rast, int numVals, int null_is_zero, RASTER_MAP_TYPE data_type)
void G_set_null_value (void *buf, int numVals, RASTER_MAP_TYPE data_type)
void G_set_c_null_value (CELL *cellVals, int numVals)
void G_set_f_null_value (FCELL *fcellVals, int numVals)
void G_set_d_null_value (DCELL *dcellVals, int numVals)
int G_is_null_value (const void *rast, RASTER_MAP_TYPE data_type)
 If the data_type is CELL_TYPE, calls G_is_c_null_value ((CELL *) rast); If the data_type is FCELL_TYPE, calls G_is_f_null_value ((FCELL *) rast); If the data_type is DCELL_TYPE, calls G_is_d_null_value ((DCELL *) rast);.
int G_is_c_null_value (const CELL *cellVal)
 Returns 1 if cell is NULL, 0 otherwise. This will test if the value cell is the largest int.
int G_is_f_null_value (const FCELL *fcellVal)
 Returns 1 if fcell is NULL, 0 otherwise. This will test if the value fcell is a NaN. It isn't good enough to test for a particular NaN bit pattern since the machine code may change this bit pattern to a different NaN. The test will be.
int G_is_d_null_value (const DCELL *dcellVal)
 Returns 1 if dcell is NULL, 0 otherwise. This will test if the value dcell is a NaN. Same test as in G_is_f_null_value().
int G_insert_null_values (void *rast, char *null_row, int ncols, RASTER_MAP_TYPE data_type)
 Insert NULL value.
int G_insert_c_null_values (CELL *cellVal, char *null_row, int ncols)
 Insert CELL NULL value.
int G_insert_f_null_values (FCELL *fcellVal, char *null_row, int ncols)
 Insert FCELL NULL value.
int G_insert_d_null_values (DCELL *dcellVal, char *null_row, int ncols)
 Insert DCELL NULL value.
int G__check_null_bit (unsigned char *flags, int bit_num, int n)
int G__set_flags_from_01_random (char *zero_ones, unsigned char *flags, int col, int n, int ncols)
int G__convert_01_flags (char *zero_ones, unsigned char *flags, int n)
int G__convert_flags_01 (char *zero_ones, unsigned char *flags, int n)
int G__init_null_bits (unsigned char *flags, int cols)


Function Documentation

int G__check_null_bit ( unsigned char *  flags,
int  bit_num,
int  n 
)

Definition at line 641 of file null_val.c.

References G__null_bitstream_size(), and G_warning().

Referenced by G__set_flags_from_01_random().

int G__convert_01_flags ( char *  zero_ones,
unsigned char *  flags,
int  n 
)

Definition at line 729 of file null_val.c.

References G__null_bitstream_size().

Referenced by G__set_flags_from_01_random().

int G__convert_flags_01 ( char *  zero_ones,
unsigned char *  flags,
int  n 
)

Definition at line 771 of file null_val.c.

References G__null_bitstream_size().

int G__init_null_bits ( unsigned char *  flags,
int  cols 
)

Definition at line 809 of file null_val.c.

References G__null_bitstream_size().

void G__init_null_patterns ( void   ) 

Definition at line 134 of file null_val.c.

int G__set_flags_from_01_random ( char *  zero_ones,
unsigned char *  flags,
int  col,
int  n,
int  ncols 
)

Definition at line 676 of file null_val.c.

References G__check_null_bit(), G__convert_01_flags(), and G__null_bitstream_size().

void G__set_null_value ( void *  rast,
int  numVals,
int  null_is_zero,
RASTER_MAP_TYPE  data_type 
)

Definition at line 191 of file null_val.c.

References G_raster_size(), G_set_null_value(), and G_zero().

int G_insert_c_null_values ( CELL *  cellVal,
char *  null_row,
int  ncols 
)

Insert CELL NULL value.

For each of the count flags which is true(!=0), set the corresponding cell to the NULL value.

Parameters:
cell 
flags 
count 
Returns:
int

Definition at line 571 of file null_val.c.

int G_insert_d_null_values ( DCELL *  dcellVal,
char *  null_row,
int  ncols 
)

Insert DCELL NULL value.

For each for the count flag which is true(!=0), set the corresponding dcell to the NULL value.

Parameters:
dcell 
flags 
count 
Returns:
int

Definition at line 627 of file null_val.c.

int G_insert_f_null_values ( FCELL *  fcellVal,
char *  null_row,
int  ncols 
)

Insert FCELL NULL value.

For each of the count flags which is true(!=0), set the corresponding fcell to the NULL value.

Parameters:
fcell 
flags 
count 
Returns:
int

Definition at line 599 of file null_val.c.

int G_insert_null_values ( void *  rast,
char *  null_row,
int  ncols,
RASTER_MAP_TYPE  data_type 
)

Insert NULL value.

If the data_type is CELL_TYPE, calls G_insert_c_null_values ((CELL *) rast, flags, count); If the data_type is FCELL_TYPE, calls G_insert_f_null_values ((FCELL *) rast, flags, count); If the data_type is DCELL_TYPE, calls G_insert_d_null_values ((DCELL *) rast, flags, count);

Parameters:
rast 
flags 
count 
data_type 
Returns:
int

Definition at line 542 of file null_val.c.

int G_is_c_null_value ( const CELL *  cellVal  ) 

int G_is_d_null_value ( const DCELL *  dcellVal  ) 

Returns 1 if dcell is NULL, 0 otherwise. This will test if the value dcell is a NaN. Same test as in G_is_f_null_value().

Parameters:
dcell 
Returns:
int

Definition at line 489 of file null_val.c.

Referenced by G_fpreclass_perform_dd(), G_fpreclass_perform_df(), G_fpreclass_perform_di(), G_get_fp_range_min_max(), G_is_null_value(), G_make_colors(), G_quant_get_cell_value(), G_quant_perform_d(), G_quantize_fp_map(), G_read_colors(), G_set_d_color(), G_set_d_raster_cat(), G_set_raster_value_d(), and G_update_fp_range().

int G_is_f_null_value ( const FCELL *  fcellVal  ) 

Returns 1 if fcell is NULL, 0 otherwise. This will test if the value fcell is a NaN. It isn't good enough to test for a particular NaN bit pattern since the machine code may change this bit pattern to a different NaN. The test will be.

  if(fcell==0.0) return 0;
  if(fcell>0.0) return 0;
  if(fcell<0.0) return 0;
  return 1;
or (as suggested by Mark Line)
  return (fcell != fcell);

Parameters:
fcell 
Returns:
int

Definition at line 446 of file null_val.c.

Referenced by G_fpreclass_perform_fd(), G_fpreclass_perform_ff(), G_fpreclass_perform_fi(), G_is_null_value(), G_quant_perform_f(), and G_set_raster_value_f().

int G_is_null_value ( const void *  rast,
RASTER_MAP_TYPE  data_type 
)

If the data_type is CELL_TYPE, calls G_is_c_null_value ((CELL *) rast); If the data_type is FCELL_TYPE, calls G_is_f_null_value ((FCELL *) rast); If the data_type is DCELL_TYPE, calls G_is_d_null_value ((DCELL *) rast);.

Parameters:
rast 
data_type 
Returns:
int

Definition at line 354 of file null_val.c.

References G_is_c_null_value(), G_is_d_null_value(), G_is_f_null_value(), and G_warning().

Referenced by G__lookup_colors(), G_get_raster_cat(), G_get_raster_row_colors(), G_get_raster_value_c(), G_get_raster_value_d(), G_get_raster_value_f(), G_raster_cmp(), and G_row_update_fp_range().

void G_set_c_null_value ( CELL *  cellVals,
int  numVals 
)

void G_set_d_null_value ( DCELL *  dcellVals,
int  numVals 
)

void G_set_f_null_value ( FCELL *  fcellVals,
int  numVals 
)

void G_set_null_value ( void *  buf,
int  numVals,
RASTER_MAP_TYPE  data_type 
)


Generated on Sun Apr 6 17:32:22 2008 for GRASS by  doxygen 1.5.5