Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the commonly used interpolation functions in NCL

2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

In this issue, the editor will bring you about the interpolation functions commonly used in NCL. The article is rich in content and analyzes and describes for you from a professional point of view. I hope you can get something after reading this article.

As a professional meteorological language, NCL has many algorithms and commands commonly used in meteorology, such as a variety of powerful interpolation functions. Usually, whether we do scientific research or business, we can not escape all kinds of interpolation: the site is inserted into the grid, the grid is inserted into the site, the high resolution is interpolated into the low resolution grid, and the low resolution is interpolated into the high resolution. There are also various modes of output products to sites, grid points. Before NCL came out, I used fortran to write interpolation. I was always worried about it (not good! The age is exposed! )

Later, with NCL, the mentor is no longer afraid that you will be stuck there for a month without any progress because of interpolation. However, NCL has stopped. )

All right, now let's interpolate happily together!

The interpolation functions of NCL are all in the ngmath library (which is a collection of mathematical commands that can be called directly by Fortran, C, and NCL). According to the different interpolation methods, the interpolation functions of NCL can be divided into the following categories:

Csagrid series: this series of functions use a cubic spline approximation algorithm to fit the functions of input data. The input value of a function is a randomly spaced set of data that can be one-dimensional, two-dimensional, or three-dimensional. Note that csagrid is the only software package in the ngmath database that provides fitting surface approximation for 3D data.

Interpolation and approximation methods can be divided into two basic categories: fitting function method and weighted average method. The fitting function method is to fit an algebraic surface to the known data, and then extract the interpolation or approximate value from the fitting surface. The weighted average method is to calculate the interpolation or approximate value as the weighted average of the known value.

Generally speaking, the results from csagrid look better than those obtained by using the inverse distance weighted averaging algorithm of dsgrid series.

What looks like an ugly orange is the interpolation result of dsgrid:

Cssgrid series: use tension spline interpolation to interpolate irregular data on a unit sphere into a straight line grid, which uses cubic splines to calculate interpolation functions. Note: only cssgrid series functions have the function of spherical data interpolation.

Dsgrid series: includes functions starting with dsgrid and dspn that interpolate site data onto the grid using inverse distance weighted interpolation. This is one of our commonly used interpolation methods.

This series of functions inputs a set of randomly spaced three-dimensional coordinates and corresponding data, and outputs a set of interpolation function values on the coordinates specified by the user. Note: the coordinates in the output grid must be monotonously incremented in each coordinate direction, but do not need to be evenly distributed.

Natgrid series: using natural adjacency interpolation (the specific method is the nngridr package developed by Dr. Dave Watson), this method belongs to a weighted average method, and the reverse distance weighted average method mentioned above is much more complex. This series of function inputs are a set of randomly spaced two-dimensional coordinates and corresponding data, and output the interpolation function values on the rectangular grid coordinates specified by the user. The coordinates in the output grid must be monotonously incremented in each coordinate direction, but do not need to be evenly distributed. It can also be interpolated at a single point.

Fitgrid series: this function uses splines under tension to interpolate. The spline under tension is controlled by a scalar tension factor, which can be adjusted to achieve a smooth transition from cubic spline interpolation to linear interpolation. The function should first fit the tension spline of the input data, and then extract the interpolation result from the fitted spline function.

This series of interpolation functions can achieve the following functions: interpolation of one-dimensional single-valued function; interpolation of plane to curve; calculation of interpolation surface through rectangular grid of function value; interpolation of one-dimensional periodic function; calculation of integral and derivative of interpolation function.

Shgrid series: implements an improved Shepard algorithm for inserting random data in 3D space. It also provides the function of efficiently finding a given point or the nearest point in three-dimensional space. The output of the interpolation function is the value of a set of coordinates on a user-specified grid, which may be a single point.

For myself, the commonly used interpolation functions are: cressman interpolation: site interpolation to the grid. The command is obj_anal_ic_deprecated, but the difficulty lies in the selection of the radius rscan, which is expressed in latitude and must be monotonously decreasing, such as rscan= (/ 10L5 / 3 /). If the interpolation grid has a high resolution, the two values after the rscan should also be reduced, otherwise the interpolation result may be too smooth and the information may be lost. Specific how to choose the radius, but also according to the actual situation to try several times, choose the right one.

Rcm2points: interpolates the data on the curvilinear grid outputted by WRF, RCM, NARR, and so on to the site.

Rcm2grid: interpolates the data on the curvilinear grid outputted by WRF, RCM, NARR and other modes to grid points. The reverse is rgrid2rcm.

Vinth3p: interpolates the mixed coordinate results of the CAM mode output to the pressure coordinates.

Vinth3p_ecmwf: interpolates the mixed coordinate products output from CESM to the pressure coordinates, but extrapolates the values below the ground using the ECMWF formula.

Handling of WRF products: commands with wrf, interp, or intrp or vert fields.

These are the interpolation functions commonly used in NCL that Xiaobian shares with you. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report