Re: How to boost performances of NCL scripts?

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed Mar 31 2010 - 18:19:01 MDT

The performance 'hit' was due to the pathology of the data array
at the boundaries. There were discontinuities.

NCL's technical lead [Dave Brown] looked and sent the
following response:
==========

I have isolated this problem to a pathology in the data: if you look at
the plot produced by the successful raster fill (method 2), you will see
a bunch of blue junk that look like tickmarks gone astray along the
bottom and left edges of the plot. In the data these correspond to data
that has the value -10, while surrounding it are values near the high
end of the data range (14 -20). In other words these are highly
discontinuous data points that seem suspicious in the context of the
surrounding data. By removing the left and bottom point (e.g. plotting
t(2:,2:) along with similarly subscripting lat2d and lon2d the plot
works fine.

Or it is also possible to use a where statement to turn the -10 values
in the first few rows into _FillValues and that works too:

  printVarSummary(t)
  t(:2,:) = where(t(:2,:).eq.-10,t@_FillValue,t(:2,:))
  t(:,:2) = where(t(:,:2).eq.-10,t@_FillValue,t(:,:2))
  printMinMax(t, True)
  plot=gsn_csm_contour_map(wks,t,res)

Bottom line: AreaFill using the triangularMesh doesn't work well with
this kind of [boundary] discontinuity. And I wonder if it would be such
a problem if the discontinuous region was in the middle of the data
rather than at the edge. I don't know how hard it would be to make it
more bullet proof but it definitely an issue with the LLU code, not the
higher level.
=============

I am attaching a simple script for you to use.

Try using

  res@trGridType = "TriangularMesh"
;res@cnFillMode = "RasterFill

then use
;res@trGridType = "TriangularMesh"
  res@cnFillMode = "RasterFill

Both should 'work'

Good luck

On 03/31/2010 07:45 AM, Caroline Serraud wrote:
> Hello to everyone,
>
> I would like to boost performances of my ncl scripts to make them faster
> and less cpu-consuming.
> My script is reading a netcdf file in a native lambert projection grid
> and plot temperature contour on a mercator projection. I think
> regridding with ndctodata may be one of the reason my script is slow. I
> saw that for better performances it could be recommanded to use C
> functions and procedures, but I don't know which part of my script could
> be put into C routines or if it would help in such case.
>
> Does someone have an idea on optimizing such a script?
> Any remark would be very helpful!
> Kind regards,
> Caroline

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Wed Mar 31 18:19:06 2010

This archive was generated by hypermail 2.1.8 : Thu Apr 01 2010 - 11:31:45 MDT