Skip to main content
  • Home
  • Documentation
  • FAQ
  • Downloads
  • Support
  • Current Release Notes
  • Ferret Users Guide
    • Users Guide Index
    • Commands Reference
    • 1. Introduction
    • 2. Data Set Basics
    • 3. Variables & Expressions
    • 4. Grids & Regions
    • 5. Animations & Gif Images
    • 6. Customizing Plots
    • 7. Handling String Data Symbols
    • 8. Working with Special Data Sets
    • 9. Computing Environment
    • 10. Converting to NetCDF
    • 11. Writing External Functions
    • Glossary
    • Appendix A: Functions
    • Appendix B: PPLUS Guide
    • Appendix C: Ferret-Specific PPLUS Enhancements
  • Previous Release Notes
  • Tutorials and Demos
    • Ferret Tour
    • DSG files: Discrete Sampling Geometries Demo
    • Ferret sorting demo
    • Fast Fourier Transforms demo
    • Empirical Orthogonal Functions demo
    • Ferret objective analysis demo
    • Ferret Palette Demo
    • Map projections
    • Ferret polygon vector demo
    • Ferret Graticules demo
    • Ferret Polytube Demo
    • Ferret Polymark Demo
    • Ferret Constant-Array demo
    • Ferret land_detail demo
    • COADS Tour
    • Levitus Tour
    • Use OPeNDAP
    • Ferret binary read demo
  • PyFerret
    • PyFerret Downloads and Install ../../faq/ferret-faqs.html
    • What is PyFerret?
    • Why use PyFerret?
    • PyFerret for the Ferret user
    • PyFerret command syntax: quick-start notes
    • PyFerret for the Python user
    • Graphics in PyFerret ?
    • New Ferret functionality
    • PyFerret Python functions and constants
    • PyFerret Python objects and methods
    • Ferret external functions in Python
    • Ferret Fortran external functions
    • PyFerret metadata-and-data dictionaries
  • OPeNDAP
    • OPeNDAP usage in Ferret
    • Use OPeNDAP Demo
    • Test OPeNDAP

CURV_TO_RECT_MAP

CURV_TO_RECT_MAP(lon_in, lat_in, grid_out, radius)

Computes mapping parameters for regridding from a curvilinear grid to a rectilinear latitude-longitude grid. The mapping is applied to data with the function CURV_TO_RECT which interpolates the data to the rectilinear grid. This computation uses a spherical interpolation code written at GFDL; the Ferret developers are responsible for its implementation as an external function.

The curvilinear grid here is described as having longitude and latitude units. The function should work with 2-dimensional curvilinear coordinate variables having other units; it has not been tested with coordinate systems other than longitude/ latitude. The destination grid must have the same units as the units of the curvilinear coordinate variables.

The output of this function is a set of mapping parameters; this mapping may be saved and applied to interpolate any field on the curvilinear grid onto the output rectangular grid.

Define the output grid so that its longitudes are on the same branch of modulo longitudes as what is in the curvilinear coordinate variable; that is if the longitudes in the curvilienar grid are in the range -180 to 180, then define your output longitude axis so that its longitudes are also in that range.

Arguments:

lon_in

Source grid longitudes, in degrees (2-D field of longitudes describing the curvilinear grid)

 

lat_in

Source grid latitudes, in degrees (2-D field of latitudes describing the curvilinear grid)

 

grid_out

Any variable on the output recangular lon-lat grid. This grid may have irregularly spaced longitude and/or latitude axes

 

radius

Source points falling within radius (in degrees) of destination point are included in the mapping to the destination point. Described further below.

Result Axes:

X

Inherited from grid_out

 

Y

Inherited from grid_out

 

Z

Abstract

 

T

Abstract

For an example of a call to this function see the documentation for the function CURV_TO_RECT.

 

This function does large amounts of calculation, and so runs slowly. It is recommended that you compute mappings from the curvilinear grid to desired rectilinear grid(s) and save them for use with your data fields.

The following figure illustrates a destination grid location (*) with a radius of influence R. Valid source curvilinear grid locations (o) which fall within the radius of influence of the destination point are used in the mapping. Missing source points (x) do not contribute to the mapping. In this case, 3 valid source grid points fall within the radius of influence.

AppA_schematics/images/documentation/users-guide/user_guide_images/AppA_schematic.gif/image_mini

The radius parameter should be chosen to be somewhat larger than the size of the input curvilinear grid cells so that any output grid location will have some input data contributing to its value.

The variable MAP, the result of a call to function CURV_TO_RECT_MAP, contains weights and the indices of the longitudes and latitudes of the curvilinear grid that correspond to the coordinates of the output grid. Below, in_curv_lon and in_curv_lat are the index value from the input curvilinear grid that correspond to the longitude and latitude of the rectangular output grid. The parameter num_neighbors is 4; the code looks around at four neighboring grid cells.

The weights are based on the distance from the source to the result grid points. The output variable map, then contains:

for each m = 1, nlon_out
for each n = 1, nlat_out
for each k=1, num_neighbors
MAP(m,n,k,1) = weight(m,n,k)
MAP(m,n,k,2) = in_curv_lon(m,n,k)
MAP(m,n,k,3) = in_curv_lat(m,n,k)

This may be used to determine the range of indices required in order to specify a subset of data on a curvilinear grid. See the FAQ, Plotting subsets of data on a curvilinear grid, for an outline of the procedure.