# Scaling the input coordinates

## Scale requirements for the input data

For reasons of accuracy, Natgrid requires that the input data values not be terribly out of scale. In particular, where:
```   XB = the breadth of the X coordinate values (maximum X - minimum X)
YB = the breadth of the Y coordinate values (maximum Y - minimum Y)
ZB = the breadth of the Z coordinate values (maximum Z - minimum Z)
```
the ratio of XB to YB should lie between 1/2 and 2; the ratio of ZB to XB should be between 1/60 and 60; the ratio of ZB to YB should be between 1/60 and 60.

If you are computing aspects or slopes, then the above ratios are a requirement, otherwise see below.

## Automatic scaling

If you are not computing aspects or slopes, then Natgrid provides an automatic scaling feature that adjusts the input values appropriately before any calculations are done, and readjusts the values appropriately on output. Automatic scaling is the default state.

Whether automatic scaling is in effect is governed by the control parameter asc. If you are computing aspects or slopes and your input data do not adhere to the ratios mentioned above, then, to avoid getting an error message, you will need to turn automatic scaling off and scale your data by setting one or more of the scaling control parameters magx, magy, and magz. For example, setting magx to 2. will scale all X coordinate values by 2. before calculations begin. Setting the value for magx in such a manner is equivalent to your having multiplied all X coordinate values by 2. before doing the gridding. Of course all output values will reflect any scaling values you set when automatic scaling has been turned off.

There are three parameters that can be interrogated to determine what automatic scaling values were in effect during the last call to one of the primary interpolation procedures NATGRIDS, NATGRIDD, c_natgrids, or c_natgridd. These parameters are xas, yas, zas. When any of the primary interpolation procedures is called, each of xas, yas, zas is initialized to 1., then it is determined if scaling is necessary, and if it is, then xas, yas, and zas are automatically set to appropriate values. It is these values that can be interrogated.

home | contents | defs | params | procedures | exmpls | index