GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
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__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);. More...
 
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. More...
 
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. More...
 
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(). More...
 
int G_insert_null_values (void *rast, char *null_row, int ncols, RASTER_MAP_TYPE data_type)
 Insert NULL value. More...
 
int G_insert_c_null_values (CELL *cellVal, char *null_row, int ncols)
 Insert CELL NULL value. More...
 
int G_insert_f_null_values (FCELL *fcellVal, char *null_row, int ncols)
 Insert FCELL NULL value. More...
 
int G_insert_d_null_values (DCELL *dcellVal, char *null_row, int ncols)
 Insert DCELL NULL value. More...
 
int G__check_null_bit (const unsigned char *flags, int bit_num, int n)
 
int G__set_flags_from_01_random (const char *zero_ones, unsigned char *flags, int col, int n, int ncols)
 
int G__convert_01_flags (const char *zero_ones, unsigned char *flags, int n)
 
int G__convert_flags_01 (char *zero_ones, const unsigned char *flags, int n)
 
int G__init_null_bits (unsigned char *flags, int cols)
 

Function Documentation

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

Definition at line 440 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 ( const char *  zero_ones,
unsigned char *  flags,
int  n 
)

Definition at line 524 of file null_val.c.

References count, G__null_bitstream_size(), and tools::size.

Referenced by G__set_flags_from_01_random().

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

Definition at line 563 of file null_val.c.

References count, G__null_bitstream_size(), and tools::size.

int G__init_null_bits ( unsigned char *  flags,
int  cols 
)

Definition at line 598 of file null_val.c.

References dialogs::cols, G__null_bitstream_size(), and tools::size.

int G__set_flags_from_01_random ( const char *  zero_ones,
unsigned char *  flags,
int  col,
int  n,
int  ncols 
)
void G__set_null_value ( void *  rast,
int  numVals,
int  null_is_zero,
RASTER_MAP_TYPE  data_type 
)

Definition at line 90 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 370 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 426 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 398 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 341 of file null_val.c.

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 281 of file null_val.c.

Referenced by G3d_isNullValueNum(), G_fpreclass_perform_fd(), G_fpreclass_perform_ff(), G_fpreclass_perform_fi(), G_is_null_value(), G_quant_perform_f(), G_set_raster_value_f(), Gs_loadmap_as_float(), IL_resample_interp_segments_2d(), N_convert_array_2d_null_to_zero(), N_copy_array_2d(), N_norm_array_2d(), N_read_rast3d_to_array_3d(), and N_read_rast_to_array_2d().

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 207 of file null_val.c.

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

Referenced by D_draw_raster_RGB(), 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(), G_row_update_fp_range(), and N_is_array_2d_value_null().

void G_set_f_null_value ( FCELL *  fcellVals,
int  numVals 
)
void G_set_null_value ( void *  buf,
int  numVals,
RASTER_MAP_TYPE  data_type 
)