
<section id='NMPlot_WorkingWithGrids_id'
webfilename='workingwithgrids'>
    <title>
        Working With Grids
    </title>
    <para>
        Using NMPlot, you can modify grids in a variety of ways. As an
        analogy, consider a word processor, which allows you to open,
        view, edit, save, and rename word processing documents. NMPlot
        allows you to work with grid files in a similar fashion.
    </para>
    <para>
        Typically, you will open a grid, modify it by choosing commands
        from the <menutext>Grid</menutext> menu, and then save it by choosing
        either <menutext>Save</menutext> or <menutext>Save As</menutext>
        from the <menutext>File</menutext> menu.
    </para>
    <note type='tip'>
        <para>
            If you are modifying a grid, but want to preserve the original
            grid file unchanged, it is recommended that you follow these steps.
        </para>
        <orderedlist>
            <listitem>
                <para>
                    Open the grid you want to modify.
                </para>
            </listitem>
            <listitem>
                <para>
                    Choose <menutext>Save As</menutext> from the <menutext>File</menutext>
                    menu, and save the grid using a new name.
                </para>
            </listitem>
            <listitem>
                <para>
                    Make your modifications to the grid.
                </para>
            </listitem>
            <listitem>
                <para>
                    Choose <menutext>Save</menutext> from the <menutext>File</menutext>
                    menu to save your modifications.
                </para>
            </listitem>
        </orderedlist>
        <para>
            This does introduce an extra step that is not strictly necessary:
            you could skip the second step and simply choose <menutext>Save
            As</menutext> after making your modifications. However, it is
            all too easy to forget and choose <menutext>Save</menutext> instead,
            overwriting the original grid file with the modified version.
        </para>
    </note>
    <para>
        When NMPlot modifies a grid, it updates the grid's <link
        target='#NMPlot_GridBookkeepingInformation_id'>bookkeeping information</link>
        with a description of the modifications. The original bookkeeping
        information is preserved, resulting in an audit trail of changes
        made to the grid.
    </para>
    <section id='NMPlot_AddingConstantToGridDataPoints_id'>
        <title>
            Adding a User-Supplied Value to a Grid
        </title>
        <para>
            NMPlot allows you to add a user-supplied constant to the value
            of every data point in a grid. To do so, choose <menutext>Add
            Value to Grid</menutext> from the <menutext>Grid</menutext> menu.
            The Add Value to Grid dialog box appears.
        </para>
        <exhibit>
            <img src='NMPlot_ScreenCap_AddConstantToGrid.png'/>
        </exhibit>
        <para>
            Type the value to add, then press OK. The grid is immediately
            modified.
        </para>
        <para>
            Invalid data points (i.e., data points with values outside the
            <link target='#NMPlot_GridValidDataLimits_id'>valid data limits</link>)
            are not changed.
        </para>
    </section>
    <section id='NMPlot_MultiplyingGridDataPointsByConstant_id'>
        <title>
            Multiplying a Grid by a User-Supplied Value
        </title>
        <para>
            NMPlot allows you to multiply the value of every data point in
            a grid by a user-supplied constant. To do so, choose <menutext>Multiply
            Grid by Value</menutext> from the <menutext>Grid</menutext> menu.
            The Multiply Grid by Value dialog box appears.
        </para>
        <exhibit>
            <img src='NMPlot_ScreenCap_MultiplyGridByConstant.png'/>
        </exhibit>
        <para>
            Type the value to multiply by, then press OK. The grid is immediately
            modified.
        </para>
        <para>
            Invalid data points (i.e., data points with values outside the
            <link target='#NMPlot_GridValidDataLimits_id'>valid data limits</link>)
            are not changed.
        </para>
    </section>
    <section id='NMPlot_MergingGrids_id'>
        <title>
            Merging Two Grids
        </title>
        <para>
            Merging refers to creating a new grid that contains the data points
            from two or more existing grids.
        </para>
        <exhibit>
            <img src='NMPlot_Figure_MergingGrids.png'
            standard_colors='true'/>
        </exhibit>
        <para>
            For example, assume that you are modeling the noise levels around
            an airport with a noise analyses program that can only generate
            regular rectangular grids. To model the noise adequately, you
            generate two grids.
        </para>
        <para>
            The first grid captures the gross structure of the noise over
            a large area around the airport. It covers an area 20 miles across
            with a resolution (i.e., a distance between adjacent data points)
            of 1000 feet. The second grid captures the fine structure of the
            noise near the airport. It covers an area only two miles across
            with a finer resolution of 100 feet.
        </para>
        <para>
            Using NMPlot, you merge these two grids into a single grid. You
            then plot noise level contours based upon this merged grid. This
            plot adequately displays the noise levels at all scales of interest.
        </para>
        <note type='caution'>
            <para>
                Do not confuse merging grids with combining grids. To insure that
                you choose the correct action, you should review <iref
                target='NMPlot_CombiningGrids_id'/>.
            </para>
        </note>
        <section>
            <title>
                Step-by-step Guide To Merging Grids
            </title>
            <para>
                To merge two or more grids, follow these steps.
            </para>
            <orderedlist>
                <listitem>
                    <para>
                        Open the first grid.
                    </para>
                </listitem>
                <listitem>
                    <para>
                        Choose <menutext>Save As</menutext> from the <menutext>File</menutext>
                        menu, and give the grid a new name.
                    </para>
                </listitem>
                <listitem>
                    <para>
                        Choose <menutext>Merge Grids</menutext> from the <menutext>Grid</menutext>
                        menu. The Merge Grids dialog box appears.
                    </para>
                    <exhibit>
                        <img src='NMPlot_ScreenCap_MergeGrids.png'/>
                    </exhibit>
                </listitem>
                <listitem>
                    <para>
                        Type the name of the file containing the second grid. Press the
                        Browse button <img src='WCF_ThreeDotsButton_Figure.png'/>, located
                        to the right of the text box, to display the Open File dialog
                        box, which allows you to browse for the file.
                    </para>
                </listitem>
                <listitem>
                    <para>
                        Press OK. The data points from the second grid are merged into
                        the first grid.
                    </para>
                </listitem>
                <listitem>
                    <para>
                        Repeat steps 3 through 5 for any additional grids you want to
                        merge.
                    </para>
                </listitem>
                <listitem>
                    <para>
                        Choose <menutext>Save</menutext> from the <menutext>File</menutext>
                        menu to save the merged grid.
                    </para>
                </listitem>
            </orderedlist>
        </section>
        <section>
            <title>
                Merging Grids With Different Metrics
            </title>
            <para>
                If you merge two grids with different <link
                target='#NMPlot_GridDataMetric_id'> metrics or physical units</link>
                (for example, trying to merge a data set of noise levels with
                a data set of air pollutant levels), a warning is added to the
                merged grid.
            </para>
            <note type='caution'>
                <para>
                    NMPlot does not prevent the merging of grids with different metrics.
                    The decision to allow this was a pragmatic one. It is not uncommon
                    for the same metric to be referred to by different names. For
                    example, one person might refer to the outside temperature as
                    "Air Temperature", while another might use "Ambient Temp.". To
                    facilitate the merging of grids from different sources, NMPlot
                    allows you to merge grids with different metrics. You are responsible
                    for determining whether the metrics are equivalent.
                </para>
            </note>
        </section>
        <section>
            <title>
                Merging Grids That Cover Different Geographic Areas
            </title>
            <para>
                NMPlot can merge any two grids. The geographic area covered by
                the two grids can overlap totally, partially, or not at all. The
                grids can have different coordinate systems.
            </para>
        </section>
        <section>
            <title>
                The Merged Grid's Defined Area Polygon
            </title>
            <para>
                The <link target='#NMPlot_GridDefinedAreaPolygon_id'>defined area
                polygon</link> of the merged grid is equal to the union of the
                two original grids' defined area polygons. That is, the new defined
                area polygon consists of the geographic area in the first grid's
                defined area polygon, the second data grid's defined area polygon,
                or both.
            </para>
            <exhibit>
                <img
                src='NMPlot_Figure_MergingGridsWithDifferentDefinedAreaPolygons.png'
                standard_colors='true'/>
            </exhibit>
        </section>
        <section>
            <title>
                Geographic Annotations
            </title>
            <para>
                NMPlot does not merge <link
                target='#NMPlot_GridGeographicAnnotations_id'> geographic annotations</link>.
                This capability may be added in the future.
            </para>
        </section>
    </section>
    <section id='NMPlot_CombiningGrids_id'>
        <title>
            Combining Two Grids
        </title>
        <para>
            Combining refers to creating a new grid by performing a mathematical
            operation, such as addition or subtraction, on the data points
            in two existing grids.
        </para>
        <exhibit>
            <img src='NMPlot_Figure_CombiningGrids.png'
            standard_colors='true'/>
        </exhibit>
        <para>
            As an example, assume that you have two grids. The first represents
            the existing levels of an air pollutant across a city, while the
            second represents the predicted levels a few years in the future,
            after several proposed changes have been made at local factories.
            You use NMPlot to subtract the first grid from the second, and
            display the combined grid using contours on a background map of
            the city. This contour plot clearly indicates whether a particular
            neighborhood can expect its air quality to improve or deteriorate.
        </para>
        <note type='caution'>
            <para>
                Do not confuse combining grids with merging grids. To insure that
                you choose the correct action, you should review <iref
                target='NMPlot_MergingGrids_id'/>.
            </para>
        </note>
        <section>
            <title>
                Step-by-step Guide To Combining Two Grids
            </title>
            <para>
                To combine two grids, follow these steps.
            </para>
            <orderedlist>
                <listitem>
                    <para>
                        Open the first grid.
                    </para>
                </listitem>
                <listitem>
                    <para>
                        Choose <menutext>Save As</menutext> from the <menutext>File</menutext>
                        menu, and give the grid a new name.
                    </para>
                </listitem>
                <listitem>
                    <para>
                        Choose <menutext>Combine Grids</menutext> from the <menutext>Grid</menutext>
                        menu. The Combine Grids dialog box appears.
                    </para>
                    <exhibit>
                        <img src='NMPlot_ScreenCap_CombineGrids.png'/>
                    </exhibit>
                </listitem>
                <listitem>
                    <para>
                        Type the name of the file containing the second grid. Press the
                        Browse button <img src='WCF_ThreeDotsButton_Figure.png'/>, located
                        to the right of the text box, to display the Open File dialog
                        box, which allows you to browse for the file.
                    </para>
                </listitem>
                <listitem>
                    <para>
                        Select the method for combining the grids. You have five options.
                        In the list of options, P1 and P2 represent grid data values from
                        the first and second grids being combined, respectively.
                    </para>
                    <unorderedlist>
                        <listitem>
                            <para>
                                Arithmetic addition &nbsp; (P1 + P2)
                            </para>
                        </listitem>
                        <listitem>
                            <para>
                                Arithmetic subtraction &nbsp; (P1 - P2)
                            </para>
                        </listitem>
                        <listitem>
                            <para>
                                Addition of noise decibels &nbsp; (10 Log<subscript>10</subscript>
                                (10<superscript>P1/10</superscript> + 10<superscript>P2/10</superscript>))
                            </para>
                        </listitem>
                        <listitem>
                            <para>
                                Subtraction of noise decibels &nbsp; (10 Log<subscript>10</subscript>
                                (10<superscript>P1/10</superscript> - 10<superscript>P2/10</superscript>))
                                &nbsp; If P1 &lt;= P2, this function is undefined, and -9999 is
                                returned.
                            </para>
                        </listitem>
                        <listitem>
                            <para>
                                Maximum &nbsp; (max (P1, P2))
                            </para>
                        </listitem>
                    </unorderedlist>
                </listitem>
                <listitem>
                    <para>
                        Select the method for computing the combined grid's <link
                        target='#NMPlot_GridDefinedAreaPolygon_id'>defined area polygon</link>.
                        You have two options.
                    </para>
                    <unorderedlist>
                        <listitem>
                            <para>
                                <italic>Intersection</italic> - The combined grid's defined area
                                polygon is the area covered by both of the two existing grids'
                                defined area polygons. This is the recommended option for most
                                situations.
                            </para>
                            <exhibit>
                                <img
                                src='NMPlot_Figure_IntersectionOfDefinedAreaPolygons.png'
                                standard_colors='true'/>
                            </exhibit>
                        </listitem>
                        <listitem>
                            <para>
                                <italic>Union</italic> - The combined grid's defined area polygon
                                is the area covered by either or both of the two existing grids'
                                defined area polygons.
                            </para>
                            <exhibit>
                                <img src='NMPlot_Figure_UnionOfDefinedAreaPolygons.png'
                                standard_colors='true'/>
                            </exhibit>
                        </listitem>
                    </unorderedlist>
                </listitem>
                <listitem>
                    <para>
                        Select how to handle a grid's data points that are outside the
                        <link target='#NMPlot_GridDefinedAreaPolygon_id'>defined area
                        polygon</link> of the other grid. You have two options.
                    </para>
                    <unorderedlist>
                        <listitem>
                            <para>
                                <italic>Do Not Include The Points</italic> - The data points are
                                discarded. This is the recommended option for most situations.
                            </para>
                        </listitem>
                        <listitem>
                            <para>
                                <italic>Include the Points Unchanged</italic> - The data points
                                are included in the combined grid. Their values are not changed.
                            </para>
                        </listitem>
                    </unorderedlist>
                </listitem>
                <listitem>
                    <para>
                        Type the minimum tolerance distance that must separate two data
                        points in order for them to be considered distinct. If a data
                        point in one grid is located within the tolerance distance of
                        a data point in the other grid, the data points are considered
                        to be at the same location. In this case, only one will appear
                        in the combined grid.
                    </para>
                    <para>
                        Typically, the tolerance distance should be set to a small value:
                        1 meter is a reasonable default value. However, there are situations
                        where you may want to use a larger tolerance. It is recommended
                        that after combining grids, you <link
                        target='#NMPlot_CreatingNewPlot_id'>create a plot</link> of the
                        combined grid and <link
                        target='#NMPlot_DisplayingGridDataPoints_id'>display its grid
                        points</link>. You may see spurious points.
                    </para>
                    <exhibit>
                        <img src='NMPlot_Figure_CombiningGrids_ExtraGridPoints.png'
                        standard_colors='true'/>
                    </exhibit>
                    <para>
                        If this happens, use the <link
                        target='#NMPlot_MouseToolMeasurement_id'>Measurement tool</link>
                        to measure the distance between the pairs of points, and set the
                        tolerance to a somewhat larger distance. Then recombine the grids.
                        The spurious points should be gone.
                    </para>
                    <exhibit>
                        <img
                        src='NMPlot_Figure_CombiningGrids_ExtraGridPointsGone.png'
                        standard_colors='true'/>
                    </exhibit>
                </listitem>
                <listitem>
                    <para>
                        Press OK. The data points from the second grid are combined with
                        those in the first grid.
                    </para>
                </listitem>
                <listitem>
                    <para>
                        Choose <menutext>Save</menutext> from the <menutext>File</menutext>
                        menu to save the combined grid.
                    </para>
                </listitem>
            </orderedlist>
        </section>
        <section>
            <title>
                Combining Grids That Cover Different Geographic Areas
            </title>
            <para>
                NMPlot can combine grids that do not have identical data point
                locations. In this case, interpolation is used to combine the
                two grids. The geographic areas covered by the two grids do not
                have to be identical. However, there must be at least some overlap
                between them. The grids can have different coordinate systems.
            </para>
        </section>
        <section>
            <title>
                Combining Multiple Grids
            </title>
            <para>
                You may find that you need to combine a large number of grids.
                For example, in performing a noise analysis of an airport, you
                may run your noise model once for each type of aircraft, and then
                sum the individual aircraft grids to create a grid of the total
                airport noise.
            </para>
            <para>
                NMPlot provides a tool that streamlines the process of combining
                a large number of grids. To access it, choose <menutext>Multiple
                Grid Combining Tool</menutext> from the <menutext>Tools</menutext>
                menu.
            </para>
            <exhibit>
                <img src='NMPlot_ScreenCap_MultipleGridCombiningTool.png'/>
            </exhibit>
            <para>
                NMPlot will read each of the specified input grids, combine them
                using the selected method, and then write the combined grid to
                the specified output grid file.
            </para>
            <note type='note'>
                <para>
                    The multiple grid combining tool assumes that each of the input
                    grids covers approximately the same geographical area. The tool
                    uses the intersection method of calculating the combined grid's
                    defined area polygon.
                </para>
            </note>
        </section>
    </section>
    <section>
        <title>
            Creating a Plot of a Grid
        </title>
        <para>
            If you are viewing a grid, you can easily create a plot of it
            by choosing <menutext>Create Plot Of This Grid</menutext> from
            the <menutext>Grid</menutext> menu.
        </para>
    </section>
</section>
