爱气象,爱气象家园! 

气象家园

 找回密码
 立即注册

QQ登录

只需一步,快速开始

搜索
查看: 10252|回复: 10

[作图] NCL 6.2.0已经发布~~~

[复制链接]
发表于 2014-4-3 08:59:08 | 显示全部楼层 |阅读模式

登录后查看更多精彩内容~

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
What's new in the current release[previous releases | next release]
Version 6.2.0 - April 2, 2014 - [download]


Improvements to NetCDF, HDF, and GRIB readers


  • Numerous improvements and bug fixes have been made to the NetCDF-4 file I/O:
    • Fixed issues with writing NetCDF4Classic files.
    • Fixed issues with reading multiple NetCDF4 files.
    • Fixed issues handling groups with special characters.
    • addfiles now works on NetCDF4 files.
  • Variables read off HDF-EOS2 files will now have all the metadata included, without having to first read the file as an HDF file, and then as an HDF-EOS file.
  • GRIB improvements:
    • Implemented support for reading GRIB2 files that are greater than 2GB in size. (Support for reading files larger than 2GB has been available for GRIB1 files for a number of years.)
    • If a center id is not recognized, NCL still gives a warning but the center attribute will be set to "unknown", rather than eliminating the attribute.
    • The sub_center attribute was incorrectly giving the name of NCEP sub-centers for centers other than NCEP. One non-NCEP subcenter is explcitly recognized: the Max Plank Institute for Meterology. When there is no information to identify a subcenter, the id number (converted to a string) is given as the sub_center value, unless it is 0 or 255, which means there is no sub_center, in which case the sub_center attribute is not generated.
    • NCL was crashing if a text version of a parameter table was specified using the NCL_GRIB_PTABLE_PATH, but the file contained no header line (4 colon-separated numbers starting with -1).
      This has been fixed, and now a warning about an invalid ptable file is issued.

    • NCL now gives NCEP table 2 values for parameters above 127 in cases where it does not recognize a valid parameter table / center combination. A warning is still issued for these parameters.
    • Some updates to the NCEP sub-center description strings, based on the current docs at the NCEP GRIB site.
    • An attribute called "generating_process_type" is now conditionally added to distinguish variables in GRIB2 files with otherwise identical metadata. In this situation the variable names are only distinguished with the addition of a suffix '_n', where 'n' is an integer. This was necessary to properly decode certain NCEP RTMA (Real-Time Mesoscale Analysis) products.
    • Fix for problem of improperly separating variables in certain ECMWF ERA files based on faulty comparison of their Grid Description Sections.
    • Fix for problem of excessive memory growth when using addfiles to read many GRIB files.
    • Added a new naming convention and a new set of attributes to handle GRIB1 variables with "time period indicators" greater than 50. These indicate various types of statistical processing. Low numbered values of this indicator continue to be represented with string suffixes such as "_avg" and "acc", but the higher numbered values have more verbose descriptions. They are distinguished with a new suffix '_Sn', where n is the 2 or 3 digit number of the time period indicator. Attributes have been added to describe the statistical process, including "statistical_process_descriptor", "statistical_process_duration", and "N". "N" indicates the number of inputs to the statistical process used, and may be an array if the N varies, for example in monthly averages due to the different number of days in each month.
    • Implemented support for JRA55 (Japanese 55-year reanalysis project). This required supporting alternate definitions for certain level types and statistical processes where the JRA55 has local definitions that are different the NCEP definitions.
    • Added support for GRIB1 parameter tables from the Max Planck Institute for Meterology: tables 128, 180, 181, 199.
    • Fixed a problem that occurred when the first record of a variable is missing.





Contouring improvements


  • There are significant improvements to the speed of raster contouring.
  • Raster contouring now supports transparency. Once significant difference is that missing value areas will now be transparent rather than filled in the background color. Users of graphics display tools that depend on ghostscript, including gv, gs, and ImageMagick's display, should be aware that older versions of ghostscript have a bug that is sometimes triggered by raster graphics containing transparent cells output to PostScript. This bug was fixed sometime between versions 8.70 and 9.06 of ghostscript. The symptom of the bug is horizontal rows of cells that seem wrong. Update your version of ghostscript to fix this issue.
  • There is alpha-level support for using OpenMP to generated raster graphics using multiple threads. Currently availablity is limited to graphics generated by using 1D values for the resources sfDataArray, sfXArray, andsfYArray and not setting sfXCellBounds, sfYCellBounds, or sfElementNodes. Set the environment variable "OMP_NUM_THREADS" to a number greater than one to activate this capability. Currently using more than 9 or so threads sometimes causes artifacts to appear in the plot. Also using map projections other than cylindrical equidistant may result in lines appearing at the edge of the blocks assigned to each thread.
  • The CellFill contouring method can now render data on unstructured grids, including triangular grids, quadrilateral grids such as HOMME, and geodesic grids with 5, 6, or more sided cells. The outlines of each cell can be rendered by setting the resource cnCellFillEdgeColor to a non-transparent color. The user must specify the cell vertices using the resources sfXCellBounds and sfYCellBounds. Also to avoid errors, the resources sfXArray and sfYArray must be specified. However, this requirement will be eliminated in the future.
  • In most cases, users can now have constant or near-constant fields rendered as a filled area, rather than having the contoured area remain blank. In order to activate this behavior, set the newly implemented resource, cnConstFEnableFill, to True. By default, the constant field informational text box will still appear; turn it off by setting cnConstFLabelOn to False. In the future, cnConstFEnableFill will likely default to True, with cnConstFLabelOn defaulting to False unless contour line drawing is enabled.
  • Better error reporting in situations where out-of-range (lat-lon) coordinate values cannot be handled. The error message suggests a possible fix for the problem: switching to use of the triangular mesh algorithm for plotting.



Significant improvements to the speed of drawing shapefile polylines or polygons

The gsn_add_shapefile_polylines and gsn_add_shapefile_polygons functions were significantly sped up via the use of a new resource called gsSegments. Previously, an object was created for every segment added, which could cause thousands of objects to be created. Now, only one object is created.

We saw speed ups of 80 times faster in the case of drawing the France "Fra_adm5.shp" shapefile fromgadm.org/country which has 37,188 polyline segments.

Note, too, that the use of these two functions is not really needed, since attaching shapefile polylines and polygons is now simplified. The following two segments of code are identical, assuming "plot" is some map plot that you want to attach shapefile polylines or polygons to:

Method 1:

  f = addfile("file.shp","r")  lnres             = True  lnres@gsLineColor = "NavyBlue"  lnres@gsSegments  = f->segments(:,0)  poly = gsn_add_polyline(wks, plot, f->x, f->y, lnres)  draw(plot)  frame(wks)

Method 2:

  lnres             = True  lnres@gsLineColor = "NavyBlue"  polyid = gsn_add_shapefile_polylines(wks,plot,"file.shp",lnres)  draw(plot)  frame(wks)

Improvements to ESMF regridding routines


  • Two new interpolation methods have been added: "neareststod" and "nearestdtos".
  • When regridding to or from an unstructured grid, a triangular mesh is generated internally by NCL. This can be a slow and memory intensive operation, so a new option was added to allow the user to input their own triangular mesh via SrcTriangularMesh or DstTriangularMesh.
  • Large file (opt@LargeFile=True) support is now turned on by default.
  • ESMF_regrid / ESMF_regrid_gen_weights - A bug was fixed in which the "pole" option was only being recognized if you set it as "pole" and not "Pole".



Improvement to "thin line" graphical issue


On rare occasions, plots from postscript, pdf, or SVG workstations may exhibit faint, light-colored gaps between adjacent filled regions. The effect is most noticeable when the regions are of the same color, and share a long, straight boundary. This artifact is believed to be caused by a bug in the underlying cairographics library. The problem has been reported to them.

We've improved the appearance of the plots by implementing a temporary internal work-around for NCL V6.2.0. See the two sets of images below for comparison (click on either thumbnail to see the problem more clearly.)

The first set of images is a modified version of the "ng4ex" example "cn05n". The second set of images were generated by this map_thin_line.ncl script.




New Functions



  • area_poly_sphere - Finds the area enclosed by an arbitrary polygon on the sphere.
  • calculate_monthly_values - Calculate monthly values [avg, sum, min, max] from high frequency temporal values.
  • kolsm2_n - Test if two samples are compatible with coming from the same distribution using the Kolmogorov-Smirnov two sample test.
  • lspoly_n - This function is the same as lspoly, except it allows you to provide a dimension on which to calculate a set of coefficients for a weighted least squares polynomial fit to the given data. lspoly always operates on the rightmost dimension.
    See the "bugs fixed" section below about a bug fix to lspoly.

  • omega_to_w - Convert omega vertical velocity (Pa/s) to (m/s).
  • print_clock - Prints the given string along with a current timestamp.
  • reg_multlin_stats - Performs multiple linear regression analysis including confidence estimates and creates an ANOVA table. This is a driver which invokes the builtin reg_multlin function. It is the preferred function for performing multiple linear regression.
  • regline_stats - Performs simple linear regression analysis including confidence estimates and creates an ANOVA table. It is the preferred function for performing simple linear regression.
  • w_to_omega - Convert w vertical velocity (m/s) to (Pa/s).
  • New WRF functions:
    • wrf_omega - Calculates approximate omega, based on vertical velocity, water vapor mixing ratio, temperature, and pressure.
    • wrf_virtual_temp - Calculates virtual temperature, given temperature and mixing ratio.

    • wrf_wetbulb - Calculates wet bulb temperature, given pressure, temperature, and water vapor mixing ratio.



  • New color-related functions:
    • color_index_to_rgba - Converts one or more absolute color index values into its equivalent RGBA quadruplet. This is useful for discovering the RGBA values encoded into the high-numbered integers that may be returned from performing a getvalues call for a color-related resource such as cnFillColors. Note this function does not currently work for color indexes less than 256 that are dependent on the setting of wkColorMap.
    • get_color_index - Chooses a color index for a scalar value, given a color map and a range of values.
    • get_color_rgba - Chooses an RGB triplet or RGBA quadruplet for a scalar value, given a color map and a range of values.
    • namedcolor2rgba - Returns the RGBA quadruplets of the given list of named colors.
    • rgba_to_color_index - Converts one or more RGBA quadruplets into its equivalent absolute color index.
    • span_color_indexes - Given the number of desired color values, return an array of indexes that nicely span the given color map.
    • span_color_rgba - Given the number of desired color values, return an array of RGB triplets or RGBA quadruplets that nicely span the given color map.




New graphical resources


  • cnConstFEnableFill - Setting this to True will force constant contour fields, or fields that fall between two contour levels, to be filled in the appropriate color or shaded pattern.
  • gsnCenterStringFuncCode, gsnLeftStringFuncCode, gsnRightStringFuncCode, gsnStringFuncCode - resources for setting the function code character for the three subtitles at the top of a plot.
  • gsnXYBarChartFillDotSizeF - increases the dot size in stipple-filled bar charts.
  • gsnXYBarChartFillLineThicknessF - increases the thickness of lines in a pattern-filled bar chart.
  • gsnXYBarChartFillScaleF - changes the fill scale for pattern-filled bar charts.
  • gsnXYBarChartFillOpacityF - sets the opacity for solid-filled bar charts.
  • gsnXYFillOpacities - sets an array of opacities for solid-filled bar charts which corresponds with thegsnXYFillColors array.
  • gsColors - This resource allows you to set an array of fill or line colors for polygons or line segments being attached to a plot via the new gsSegments resource.
  • gsSegments - This resource allows you specify the start and end of line or polygon segments via one large array. Using this resource can significantly speed up code (we saw one script run 80 times faster) that is adding thousands of segments to a plot. It is only available with polyline and polygon drawing codes likegsn_add_polyline and gsn_add_polygon.
  • mpPolyMode - This new resource takes three possible values: "StandardPoly", "FastPoly", and "AutoPoly". It should be used to set what method to use when adding polygons to a map plot.
    The default is "AutoPoly", meaning that the drawing code decides which type of polygon to draw based on the great circle distance of each component line segment, and on the polygon's graphic style attributes. If the great circle distance of any component line segment is greater than 10 degress or if any fill pattern other than solid is in effect, the "standard" method that was used in NCL versions 6.1.2 and earlier is used. Otherwise a faster method introduced in version 6.2.0 is used. The faster method may sometimes fail for polygons that have complicated crossing with the visible edges of curvilinear map projections.

  • lbBoxSeparatorLinesOn - Setting this resource False allows you to have a perimeter line drawn around the "bar" of the LabelBar without having lines separating each component box within the bar.


New graphical output format

The "SVG" format is now supported in NCL. It can be used with gsn_open_wks in the same way as other formats like "png" and "pdf":


   wks = gsn_open_wks("svg","example")      ; Will create "example.svg"

New color tables

Over 120 new color tables were added to NCL. You can view and download these color tables now via the color table gallery. Special thanks to Nicolas Barrier of Laboratoire de Physique des Océans, Melissa Bukovsky of NCAR, and Carl Schreck of Cooperative Institute for Climate and Satellites - North Carolina for contributing these tables, which came from ColorBrewer, GMT, GrADS, matplotlib, and Ncview.



Library for generating KML output from NCL

NCL_GETools is a library for generating KML output with NCL. It was developed by Mohammad Abouali during the summer 2013 SIParCS internship program. The library is being made available on a preliminary basis to gauge user interest and to gather further use-cases and requirements.



Updated functions




Bugs fixed


  • A bug was fixed where byte value were being printed in hexadecimal format instead of decimal format, when using print.
  • addfiles: if the aggregated time coordinate has different units in the individual aggregated files, the values are now adjusted to conform to the units of the first file in the aggregation.
  • ESMF_regrid / ESMF_regrid_gen_weights - - See ESMF Regridding improvements above.
  • ezfftf / ezfftb - A bug was fixed for the case where the number of points is odd.
  • covcorm - A bug was fixed in which "iopt" behaved the opposite of how it was described in the documentation:
    • iopt=(/0,1/) behaves as if you had set iopt=(/1,0/)
    • iopt=(/1,0/) behaves as if you had set iopt=(/0,1/)
    • iopt=(/0,0/) or (/1,1/) works as described

  • gsn_contour_shade - A bug was fixed that didn't allow you to use the gsnShadeHigh, gsnShadeMid, andgsnShadeLow resources together.
  • lspoly - This function was failing in certain cases where the input data were "scaled" down. We decided to replace this routine with a SLATEC version. It takes the same arguments, but uses a different algorithm under the hood. You can get the "old" (pre NCL V6.2.0) version of lspoly by using "lspoly_old", but we don't recommend it for regular use.
  • pdfxy - Fixed a bug in which values that exactly matched the rightmost edge of the rightmost bin were not getting counted. There should be minimal effect on user results.
  • poisson_grid_fill - Fixed a bug that when the data are cyclic, the leftmost boundary index was off-by-one. The bug will have little or no impact on most users.
  • read_colormap_file - This function now works on any NCL color map (previously, it only worked on *.rgb color maps in $NCARG_ROOT/lib/ncarg/colormaps).
  • relhum - A bug was fixed in which all variables had to have the _FillValue attribute if any one of the input variables had an _FillValue attribute. Note that there is a potential incompatible change with this fix. The return missing value is now whatever the default missing value is for the type being returned, and *not* the _FillValue associated with the input variable 't', as it was in the past.
  • stat_dispersion - Fixed a bug that caused this function to fail when large arrays contained lots or all missing values.
  • str_split_csv - A bug was fixed in which if you had a mix of commas and quotes, the fields were not parsed properly.
  • wrf_map_overlays - A bug was fixed to correctly plot rotated lat-lon grids.


Change in HDF4 build instructions

If you are planning to build NCL V6.2.0 from source code, then take note that there's a change in where it expects to find the HDF4 include files.

Previously, you had to install them to an "hdf" subdirectory via a special "--includedir" option on the "configure" line. This is no longer required. This means if you are linking against previously-compiled versions of HDF4, you may need to move the include files out of "/xxxx/include/hdf" to "/xxxx/include".



密码修改失败请联系微信:mofangbao
发表于 2014-4-3 09:03:33 | 显示全部楼层
o(∩∩)o...哈哈,昨天看还没有呢!
多谢告知!
密码修改失败请联系微信:mofangbao
发表于 2014-4-3 09:35:18 | 显示全部楼层
感谢告知。
密码修改失败请联系微信:mofangbao
回复

使用道具 举报

发表于 2014-4-3 09:49:02 | 显示全部楼层
nn的,我刚刚给他们report了一个bug,看来要在下一版本了
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2014-4-3 09:53:20 | 显示全部楼层
freekiller 发表于 2014-4-3 09:49
nn的,我刚刚给他们report了一个bug,看来要在下一版本了

哈哈哈,估计很快就修正了~~~
密码修改失败请联系微信:mofangbao
发表于 2014-4-3 10:01:01 | 显示全部楼层
freekiller 发表于 2014-4-3 09:49
nn的,我刚刚给他们report了一个bug,看来要在下一版本了

这么快就发现bug了,能透露一下么?
密码修改失败请联系微信:mofangbao
发表于 2014-4-3 10:06:46 | 显示全部楼层
再等几天去更新咯
密码修改失败请联系微信:mofangbao
发表于 2014-4-3 11:21:15 | 显示全部楼层
longlivehj 发表于 2014-4-3 10:01
这么快就发现bug了,能透露一下么?

在IBM机器上
print(tosigned(157B))
返回的结果为
(0)     157

而正确的结果为
(0)     -99

用NCL来处理TRMM卫星数据的同学应该碰到这个问题。 在linux没问题
密码修改失败请联系微信:mofangbao
发表于 2014-4-3 12:24:26 | 显示全部楼层
freekiller 发表于 2014-4-3 11:21
在IBM机器上
print(tosigned(157B))
返回的结果为

哇,这个错的离谱!
密码修改失败请联系微信:mofangbao
 楼主| 发表于 2014-4-4 16:33:05 | 显示全部楼层
longlivehj 发表于 2014-4-3 09:03
o(∩∩)o...哈哈,昨天看还没有呢!
多谢告知!

小试了一下,发现以下问题:
1.jpg

新版本要加上res@cnMissingValFillColor = "white"才行

原始数据并非没有数值。
2.jpg

加上res@cnMissingValFillColor = "white",警告还在,但是空白没了,补上了。


密码修改失败请联系微信:mofangbao
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Copyright ©2011-2014 bbs.06climate.com All Rights Reserved.  Powered by Discuz! (京ICP-10201084)

本站信息均由会员发表,不代表气象家园立场,禁止在本站发表与国家法律相抵触言论

快速回复 返回顶部 返回列表