MB-System Unix Manual Page

mbstripNaN

Section: MB-System 5.0 (1)
Updated: 3 June 2013
Index
 

NAME

mbstripNaN - filter to remove NaN nodes

 

VERSION

Version 5.0

 

SYNOPSIS

mbstripNaN

 

DESCRIPTION

mbstripNaN is a utility for removing NaN nodes that are produced by the GMT utilities grd2xyz and blockmean with the -bo option. The standard output of mbstripNaN may be fed into the standard input of surface with the -bi option. This is used by the mbm_grd2geovrml utility in order to spline fill areas of no data so that irregular bathymetry may be effectively visualized using GeoVRML which has no concept of NaN.

Note that mbstripNaN works with a double precision data stream.

The code is simple. Here it is:


  #include <stdio.h>
  #include <math.h>


  /*
   * Read double x,y,z on stdin and send to stdout all
   * triplets but ones where z == NaN
   */
  main () {
          struct node { double lon, lat, height; };

          struct node n;

          while ( ( fread(&n, 24, 1, stdin) > 0 ) ) {

                  if ( ! isnan(n.height) ) {

                          fwrite(&n, 24, 1, stdout);

                  }

          }

   }

 

MB-SYSTEM AUTHORSHIP

David W. Caress

  Monterey Bay Aquarium Research Institute
Dale N. Chayes

  Center for Coastal and Ocean Mapping

  University of New Hampshire
Christian do Santos Ferreira

  MARUM - Center for Marine Environmental Sciences

  University of Bremen

 

EXAMPLE

This is a command that mbm_grd2geovrml constructs and executes:


  #
  # Convert grid to xyz format for filling in blank
  # areas, preprocess w/blockmean, use surface to
  # extrapolate to no data areas
  #
  grd2xyz -bo Samp_OregonMarginI_bath.grd | blockmean \
    -bi -bo -V -I0.00336363636363635/0.00134545454545457 \
    -R-125.2/-124.867/45/45.1332 | mbstripNaN | surface \
    -bi -I0.00336363636363635/0.00134545454545457 \
    -S0.333312 -T0.35 -GTmp_OregonMarginI_bath.grd -V \
    -R-125.2/-124.867/45/45.1332

 

SEE ALSO

grd2xyz(1), blockmean(1), surface(1), mbm_grd2geovrml(1)

 

BUGS

How many bugs can there be in an 8 line program?


 

Index

NAME
VERSION
SYNOPSIS
DESCRIPTION
MB-SYSTEM AUTHORSHIP
EXAMPLE
SEE ALSO
BUGS


Last Updated: 3 June 2013