• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Rast_is_d_null_value函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Rast_is_d_null_value函数的典型用法代码示例。如果您正苦于以下问题:C++ Rast_is_d_null_value函数的具体用法?C++ Rast_is_d_null_value怎么用?C++ Rast_is_d_null_value使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Rast_is_d_null_value函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: read_range

int read_range(void)
{
    struct FPRange drange;
    struct Range range;
    CELL tmp_min, tmp_max;
    DCELL tmp_dmin, tmp_dmax;
    char buff[1024];
    int i;

    /* read the fpranges and ranges of all input maps */
    for (i = 0; i < noi; i++) {
        if (Rast_read_fp_range(name[i], G_mapset(), &drange) <= 0) {
            sprintf(buff, "Can't read f_range for map %s", name[i]);
            G_fatal_error("%s", buff);
        }
        Rast_get_fp_range_min_max(&drange, &tmp_dmin, &tmp_dmax);

        if (Rast_read_range(name[i], G_mapset(), &range) <= 0) {
            sprintf(buff, "Can't read range for map %s", name[i]);
            G_fatal_error("%s", buff);
        }
        Rast_get_range_min_max(&range, &tmp_min, &tmp_max);
        if (!i || tmp_max > old_max || Rast_is_c_null_value(&old_max))
            old_max = tmp_max;
        if (!i || tmp_min < old_min || Rast_is_c_null_value(&old_min))
            old_min = tmp_min;
        if (!i || tmp_dmax > old_dmax || Rast_is_d_null_value(&old_dmax))
            old_dmax = tmp_dmax;
        if (!i || tmp_dmin < old_dmin || Rast_is_d_null_value(&old_dmin))
            old_dmin = tmp_dmin;
    }				/* for loop */

    return 0;
}
开发者ID:rkrug,项目名称:grass-ci,代码行数:34,代码来源:read_rules.c


示例2: Rast3d_read_colors

int
Rast3d_read_colors(const char *name, const char *mapset, struct Colors *colors)
 /* adapted from Rast_read_colors */
{
    const char *err;
    struct FPRange drange;
    DCELL dmin, dmax;

    Rast_init_colors(colors);

    Rast_mark_colors_as_fp(colors);

    switch (read_colors(name, mapset, colors)) {
    case -2:
	if (Rast3d_read_range(name, mapset, &drange) >= 0) {
	    Rast_get_fp_range_min_max(&drange, &dmin, &dmax);
	    if (!Rast_is_d_null_value(&dmin) && !Rast_is_d_null_value(&dmax))
		Rast_make_rainbow_fp_colors(colors, dmin, dmax);
	    return 0;
	}
	err = "missing";
	break;
    case -1:
	err = "invalid";
	break;
    default:
	return 1;
    }

    G_warning("color support for [%s] in mapset [%s] %s", name, mapset, err);
    return -1;
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:32,代码来源:color.c


示例3: get_cell

static int get_cell(DCELL *result, int fd, double x, double y)
{
    static DCELL *row1, *row2;
    static int cur_row = -1;
    static int row, col;
    DCELL *tmp;

    if (!row1) {
	row1 = Rast_allocate_d_buf();
	row2 = Rast_allocate_d_buf();
    }

    col = (int)floor(x - 0.5);
    row = (int)floor(y - 0.5);
    x -= col + 0.5;
    y -= row + 0.5;

    if (row < 0 || row + 1 >= Rast_window_rows() ||
	col < 0 || col + 1 >= Rast_window_cols()) {
	Rast_set_d_null_value(result, 1);
	return 0;
    }

    if (cur_row != row) {
	if (cur_row == row + 1) {
	    tmp = row1; row1 = row2; row2 = tmp;
	    Rast_get_d_row(fd, row1, row);
	}
	else if (cur_row == row - 1) {
	    tmp = row1; row1 = row2; row2 = tmp;
	    Rast_get_d_row(fd, row2, row + 1);
	}
	else {
	    Rast_get_d_row(fd, row1, row);
	    Rast_get_d_row(fd, row2, row + 1);
	}
	cur_row = row;
    }

    if (Rast_is_d_null_value(&row1[col]) || Rast_is_d_null_value(&row1[col+1]) ||
	Rast_is_d_null_value(&row2[col]) || Rast_is_d_null_value(&row2[col+1])) {
	Rast_set_d_null_value(result, 1);
	return 0;
    }

    *result = Rast_interp_bilinear(x, y,
				row1[col], row1[col+1],
				row2[col], row2[col+1]);

    return 1;
}
开发者ID:caomw,项目名称:grass,代码行数:51,代码来源:main.c


示例4: getpoint

/************************************************************************
getpoint-- finds crossing point using linear interpolation, 
	  converts from row-column to x-y space, and adds point to current  line.
************************************************************************/
static void getpoint(struct cell *curr, double level,
		     struct Cell_head Cell, struct line_pnts *Points)
{
    double x, y;
    double ratio;
    int p1, p2;

    p1 = curr->edge;
    p2 = (curr->edge + 1) % 4;
    if (Rast_raster_cmp(&curr->z[p1], &curr->z[p2], DCELL_TYPE) == 0)
	ratio = 1;
    else if (Rast_is_d_null_value(&curr->z[p1]))
	ratio = 1 / 2;
    else if (Rast_is_d_null_value(&curr->z[p2]))
	ratio = 1 / 2;
    else
	ratio = (level - curr->z[p1]) / (curr->z[p2] - curr->z[p1]);

    switch (curr->edge) {

    case 0:
	y = curr->r;
	x = curr->c + ratio;
	break;
    case 1:
	y = curr->r + ratio;
	x = curr->c + 1;
	break;
    case 2:
	y = curr->r + 1;
	x = curr->c + 1 - ratio;
	break;
    case 3:
	y = curr->r + 1 - ratio;
	x = curr->c;
	break;
    default:
	G_fatal_error(_("Edge number out of range"));
    }
    /* convert r/c values to x/y values */

    y = Cell.north - (y + .5) * Cell.ns_res;
    x = Cell.west + (x + .5) * Cell.ew_res;

    Vect_append_point(Points, x, y, level);

}
开发者ID:caomw,项目名称:grass,代码行数:51,代码来源:cont.c


示例5: add_null_area

/* calculate the running area of null data cells */
void add_null_area(DCELL * rast, struct Cell_head *region, double *area)
{
    int col;

    for (col = 0; col < region->cols; col++) {
	if (Rast_is_d_null_value(&(rast[col]))) {
	    *area += region->ew_res * region->ns_res;
	}
    }
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:11,代码来源:area.c


示例6: Rast_get_fp_range_min_max

/*!
 * \brief Get minumum and maximum value from fp range
 *
 * Extract the min/max from the range structure <i>range</i>.  If the
 * range structure has no defined min/max (first!=0) there will not be
 * a valid range. In this case the min and max returned must be the
 * NULL-value.
 *
 * \param range pointer to FPRange which holds fp range info
 * \param[out] min minimum value
 * \param[out] max maximum value
 */
void Rast_get_fp_range_min_max(const struct FPRange *range,
			       DCELL * min, DCELL * max)
{
    if (range->first_time) {
	Rast_set_d_null_value(min, 1);
	Rast_set_d_null_value(max, 1);
    }
    else {
	if (Rast_is_d_null_value(&(range->min)))
	    Rast_set_d_null_value(min, 1);
	else
	    *min = range->min;

	if (Rast_is_d_null_value(&(range->max)))
	    Rast_set_d_null_value(max, 1);
	else
	    *max = range->max;
    }
}
开发者ID:caomw,项目名称:grass,代码行数:31,代码来源:range.c


示例7: apply_filter

/**************************************************************
 * apply_filter: apply the filter to a single neighborhood
 *
 *  filter:    filter to be applied
 *  input:     input buffers
 **************************************************************/
DCELL apply_filter(FILTER * filter, DCELL ** input)
{
    int size = filter->size;
    double **matrix = filter->matrix;
    double divisor = filter->divisor;
    int r, c;
    DCELL v;

    v = 0;

    if (divisor == 0) {
	int have_result = 0;

	for (r = 0; r < size; r++)
	    for (c = 0; c < size; c++) {
		if (Rast_is_d_null_value(&input[r][c]))
		    continue;
		v += input[r][c] * matrix[r][c];
		divisor += filter->dmatrix[r][c];
		have_result = 1;
	    }

	if (have_result)
	    v /= divisor;
	else
	    Rast_set_d_null_value(&v, 1);
    }
    else {
	for (r = 0; r < size; r++)
	    for (c = 0; c < size; c++) {
		if (Rast_is_d_null_value(&input[r][c])) {
		    Rast_set_d_null_value(&v, 1);
		    return v;
		}
		v += input[r][c] * matrix[r][c];
	    }

	v /= divisor;
    }

    return v;
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:48,代码来源:apply.c


示例8: loglike

static double loglike(DCELL * x, struct SubSig *SubSig, int nbands)
{
    int b1, b2;
    double diff1, diff2;
    double sum;

    sum = 0;
    for (b1 = 0; b1 < nbands; b1++)
	for (b2 = 0; b2 < nbands; b2++) {
	    if (Rast_is_d_null_value(&x[b1])
		|| Rast_is_d_null_value(&x[b2]))
		continue;
	    diff1 = x[b1] - SubSig->means[b1];
	    diff2 = x[b2] - SubSig->means[b2];
	    sum += diff1 * diff2 * SubSig->Rinv[b1][b2];
	}

    sum = -0.5 * sum + SubSig->cnst;
    return (sum);
}
开发者ID:felipebetancur,项目名称:grass-ci,代码行数:20,代码来源:subcluster.c


示例9: w_kurt

void w_kurt(DCELL * result, DCELL(*values)[2], int n, const void *closure)
{
    DCELL sum, ave, sumsq, sumqt, var;
    int count;
    int i;

    sum = 0.0;
    count = 0;

    for (i = 0; i < n; i++) {
	if (Rast_is_d_null_value(&values[i][0]))
	    continue;

	sum += values[i][0] * values[i][1];
	count += values[i][1];
    }

    if (count == 0) {
	Rast_set_d_null_value(result, 1);
	return;
    }

    ave = sum / count;

    sumsq = 0;

    for (i = 0; i < n; i++) {
	DCELL d;

	if (Rast_is_d_null_value(&values[i][0]))
	    continue;

	d = values[i][0] - ave;
	sumsq += d * d * values[i][1];
	sumqt += d * d * d * values[i][1];
    }

    var = sumsq / count;

    *result = sumqt / (count * var * var) - 3;
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:41,代码来源:c_kurt.c


示例10: c_skew

void c_skew(DCELL * result, DCELL * values, int n, const void *closure)
{
    DCELL sum, ave, sumsq, sumcb, sdev;
    int count;
    int i;

    sum = 0.0;
    count = 0;

    for (i = 0; i < n; i++) {
	if (Rast_is_d_null_value(&values[i]))
	    continue;

	sum += values[i];
	count++;
    }

    if (count == 0) {
	Rast_set_d_null_value(result, 1);
	return;
    }

    ave = sum / count;

    sumsq = 0;

    for (i = 0; i < n; i++) {
	DCELL d;

	if (Rast_is_d_null_value(&values[i]))
	    continue;

	d = values[i] - ave;
	sumsq += d * d;
	sumcb += d * d * d;
    }

    sdev = sqrt(sumsq / count);

    *result = sumcb / (count * sdev * sdev * sdev);
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:41,代码来源:c_skew.c


示例11: report_range

int report_range(void)
{
    char buff[300], buff2[300];

    if (Rast_is_d_null_value(&old_dmin) || Rast_is_d_null_value(&old_dmax))
        G_message(_("Old data range is empty"));
    else {
        sprintf(buff, "%.15g", old_dmin);
        sprintf(buff2, "%.15g", old_dmax);
        G_trim_decimal(buff);
        G_trim_decimal(buff2);
        G_message(_("Old data range is %s to %s"), buff, buff2);
    }
    if (Rast_is_c_null_value(&old_min) || Rast_is_c_null_value(&old_max))
        G_message(_("Old integer data range is empty"));
    else
        G_message(_("Old integer data range is %d to %d"),
                  (int)old_min, (int)old_max);

    return 0;
}
开发者ID:rkrug,项目名称:grass-ci,代码行数:21,代码来源:read_rules.c


示例12: p_cubic_f

void p_cubic_f(struct cache *ibuffer,	/* input buffer                  */
		void *obufptr,	/* ptr in output buffer          */
		int cell_type,	/* raster map type of obufptr    */
		double *row_idx,	/* row index                     */
		double *col_idx,	/* column index          */
	    struct Cell_head *cellhd	/* cell header of input layer    */
    )
{
    /* start nearest neighbor to do some basic tests */
    int row, col;		/* row/col of nearest neighbor   */
    DCELL *cellp, cell;

    /* cut indices to integer */
    row = (int)floor(*row_idx);
    col = (int)floor(*col_idx);

    /* check for out of bounds - if out of bounds set NULL value     */
    if (row < 0 || row >= cellhd->rows || col < 0 || col >= cellhd->cols) {
        Rast_set_null_value(obufptr, 1, cell_type);
        return;
    }

    cellp = CPTR(ibuffer, row, col);
    /* if nearest is null, all the other interps will be null */
    if (Rast_is_d_null_value(cellp)) {
        Rast_set_null_value(obufptr, 1, cell_type);
        return;
    }
    cell = *cellp;
    
    p_cubic(ibuffer, obufptr, cell_type, row_idx, col_idx, cellhd);
    /* fallback to bilinear if cubic is null */
    if (Rast_is_d_null_value(obufptr)) {
        p_bilinear(ibuffer, obufptr, cell_type, row_idx, col_idx, cellhd);
        /* fallback to nearest if bilinear is null */
	if (Rast_is_d_null_value(obufptr))
	    Rast_set_d_value(obufptr, cell, cell_type);
    }
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:39,代码来源:cubic_f.c


示例13: c_var

void c_var(DCELL * result, DCELL * values, int n, const void *closure)
{
    DCELL sum, ave, sumsq;
    int count;
    int i;

    sum = 0.0;
    count = 0;

    for (i = 0; i < n; i++) {
	if (Rast_is_d_null_value(&values[i]))
	    continue;

	sum += values[i];
	count++;
    }

    if (count == 0) {
	Rast_set_d_null_value(result, 1);
	return;
    }

    ave = sum / count;

    sumsq = 0;

    for (i = 0; i < n; i++) {
	DCELL d;

	if (Rast_is_d_null_value(&values[i]))
	    continue;

	d = values[i] - ave;
	sumsq += d * d;
    }

    *result = sumsq / count;
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:38,代码来源:c_var.c


示例14: c_maxx

void c_maxx(DCELL * result, DCELL * values, int n, const void *closure)
{
    DCELL max, maxx;
    int i;

    Rast_set_d_null_value(&max, 1);
    Rast_set_d_null_value(&maxx, 1);

    for (i = 0; i < n; i++) {
	if (Rast_is_d_null_value(&values[i]))
	    continue;

	if (Rast_is_d_null_value(&max) || max < values[i]) {
	    max = values[i];
	    maxx = i;
	}
    }

    if (Rast_is_d_null_value(&maxx))
	Rast_set_d_null_value(result, 1);
    else
	*result = maxx;
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:23,代码来源:c_maxx.c


示例15: convert_row

static void convert_row(
    unsigned char *out_buf, const DCELL *raster, int ncols,
    int is_fp, int bytes, int swap_flag, double null_val)
{
    unsigned char *ptr = out_buf;
    int i;

    for (i = 0; i < ncols; i++) {
	DCELL x = Rast_is_d_null_value(&raster[i])
	    ? null_val
	    : raster[i];
	convert_cell(ptr, x, is_fp, bytes, swap_flag);
	ptr += bytes;
    }
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:15,代码来源:main.c


示例16: convert_and_write_di

static void convert_and_write_di(int fd, const void *vbuf)
{
    const DCELL *buf = vbuf;
    struct fileinfo *fcb = &R__.fileinfo[fd];
    CELL *p = (CELL *) fcb->data;
    int i;

    for (i = 0; i < fcb->cellhd.cols; i++)
	if (Rast_is_d_null_value(&buf[i]))
	    Rast_set_c_null_value(&p[i], 1);
	else
	    p[i] = (CELL) buf[i];

    Rast_put_c_row(fd, p);
}
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:15,代码来源:put_row.c


示例17: Rast_update_fp_range

/*!
 * \brief Update range structure (floating-point)
 *
 * Compares the <i>cat</i> value with the minimum and maximum values
 * in the <i>range</i> structure, modifying the range if <i>cat</i>
 * extends the range.
 *
 * NULL-values must be detected and ignored.
 *
 * \param val raster value
 * \param range pointer to Range structure which holds range info
 */
void Rast_update_fp_range(DCELL val, struct FPRange *range)
{
    if (!Rast_is_d_null_value(&val)) {
	if (range->first_time) {
	    range->first_time = 0;
	    range->min = val;
	    range->max = val;
	    return;
	}
	if (val < range->min)
	    range->min = val;
	if (val > range->max)
	    range->max = val;
    }
}
开发者ID:caomw,项目名称:grass,代码行数:27,代码来源:range.c


示例18: report_range

int report_range(void)
{
    struct FPRange drange;
    struct Range range;
    char buff[1024], buff2[300];
    RASTER_MAP_TYPE inp_type;

    inp_type = Rast_map_type(name, "");
    if (inp_type != CELL_TYPE) {
	if (Rast_read_fp_range(name, "", &drange) <= 0)
	    G_fatal_error(_("Unable to read f_range for map %s"), name);

	Rast_get_fp_range_min_max(&drange, &old_dmin, &old_dmax);
	if (Rast_is_d_null_value(&old_dmin) || Rast_is_d_null_value(&old_dmax))
	    G_message(_("Data range is empty"));
	else {
	    sprintf(buff, "%.10f", old_dmin);
	    sprintf(buff2, "%.10f", old_dmax);
	    G_trim_decimal(buff);
	    G_trim_decimal(buff2);
	    G_message(_("Data range of %s is %s to %s (entire map)"), name,
		      buff, buff2);
	}
    }
    if (Rast_read_range(name, "", &range) <= 0)
	G_fatal_error(_("Unable to read range for map <%s>"), name);

    Rast_get_range_min_max(&range, &old_min, &old_max);
    if (Rast_is_c_null_value(&old_min) || Rast_is_c_null_value(&old_max))
	G_message(_("Integer data range of %s is empty"), name);
    else
	G_message(_("Integer data range of %s is %d to %d"),
		  name, (int)old_min, (int)old_max);

    return 0;
}
开发者ID:rashadkm,项目名称:grass_cmake,代码行数:36,代码来源:read_rules.c


示例19: gather_values

static int gather_values(RASTER3D_Map * map, DCELL * buff, int x,
			 int y, int z)
{
    int i, j, k, l;
    DCELL value;

    int start_z = z - z_dist;
    int start_y = y - y_dist;
    int start_x = x - x_dist;
    int end_z = start_z + z_size;
    int end_y = start_y + y_size;
    int end_x = start_x + x_size;

    if (start_z < 0)
	start_z = 0;

    if (start_y < 0)
	start_y = 0;

    if (start_x < 0)
	start_x = 0;

    if (end_z > nz)
	end_z = nz;

    if (end_y > ny)
	end_y = ny;

    if (end_x > nx)
	end_x = nx;

    l = 0;

    for (i = start_z; i < end_z; i++) {
	for (j = start_y; j < end_y; j++) {
	    for (k = start_x; k < end_x; k++) {
		value = (DCELL) Rast3d_get_double(map, k, j, i);

		if (Rast_is_d_null_value(&value))
		    continue;

		buff[l] = value;
		l++;
	    }
	}
    }
    return l;
}
开发者ID:caomw,项目名称:grass,代码行数:48,代码来源:main.c


示例20: is_null_value

int is_null_value(struct RASTER_MAP_PTR buf, int col)
{
    switch (buf.type) {
    case CELL_TYPE:
	return Rast_is_c_null_value(&buf.data.c[col]);
	break;
    case FCELL_TYPE:
	return Rast_is_f_null_value(&buf.data.f[col]);
	break;
    case DCELL_TYPE:
	return Rast_is_d_null_value(&buf.data.d[col]);
	break;
    }

    return -1;
}
开发者ID:rashadkm,项目名称:grass_cmake,代码行数:16,代码来源:random.c



注:本文中的Rast_is_d_null_value函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Rast_open_old函数代码示例发布时间:2022-05-30
下一篇:
C++ Rast_close函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap