Re: Fwd: Contour plot on Lambert Conformal Projection (Extremely Slow!)

From: Ling Huang <hlbutterflyut_at_nyahnyahspammersnyahnyah>
Date: Tue Jul 02 2013 - 12:44:32 MDT

Dear David,

Thank you sooo.......... much! I really couldn't thank you more!!! I have
been stuck with this problem for a long time, which caused me a lot of
trouble.

I added "res@cnFillMode="RasterFill" and it run extremely faster, takes
about a second or so. But set to "MeshFill" causes problems for
unstructured grid.

Anyway, I added "RasterFill" and it worked. Thank you so much! It is such a
relief!

Regards,

Ling

On Tue, Jul 2, 2013 at 12:24 PM, David Brown <dbrown@ucar.edu> wrote:

> Hi Ling,
> If you know that the projection values you are using match the projection
> of the data, as should be the case if you set tfDoNDCOverlay to True, then
> you do not need to set the lat2d/lon2d attributes on the data variable
> (isop_dailyavg).
> You can also try setting
> res@cnFillMode = "RasterFill" ;; you might also want to try "MeshFill"
> and/or
> res@trGridType = "TriangularMesh"
> Hope this helps.
> -dave
>
>
> On Jul 2, 2013, at 10:33 AM, Ling Huang <hlbutterflyut@gmail.com> wrote:
>
>
>
> Hi,
>
> This is Ling. I am trying to make a contour plot on Lambert Conformal
> Projection. The data is a two dimensional array with 872 x 764 grids.
> However, the problem is it is extremely slow to generate a contour plot,
> sometimes more than a hour. I am wondering is there something wrong with my
> code or is there any way speed up the plotting? Following is my code.
>
> Thanks
>
> Ling
>
>
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>
> begin
>
> start_time = get_cpu_time()
> filename = "isop_200505.nc"
> latfile = "lat.csv"
> lonfile = "lon.csv"
>
> f = addfile(filename,"r")
> lat_1d = asciiread(latfile,-1,"float")
> lon_1d = asciiread(lonfile,-1,"float")
> lat2d = onedtond(lat_1d,(/872,764/))
> lon2d = onedtond(lon_1d,(/872,764/))
> dimlc = dimsizes(lat2d)
> nlat = dimlc(0)
> nlon = dimlc(1)
> isop_dailyavg = f->ISOP_DAILYAVG
> isop_dailyavg = where(ismissing(isop_dailyavg),0,isop_dailyavg)
> isop_dailyavg@lat2d = lat2d
> isop_dailyavg@lon2d = lon2d
>
> ;******************create plots*******************
> fon = "May_lambert"
> wks = gsn_open_wks("pdf",fon)
>
> res = True
> res@gsnDraw = False
> res@gsnFrame = False
> res@cnFillOn = True
> res@cnLinesOn = False
> res@cnFillPalette = "dayisop"
> res@mpGridAndLimbOn = True
> res@pmTickMarkDisplayMode = "Always"
> res@tmXTOn = False
> res@gsnAddCyclic = False
>
> res@mpLimitMode = "Corners"
> res@mpLeftCornerLatF = lat2d(0,0)
> res@mpLeftCornerLonF = lon2d(0,0)
> res@mpRightCornerLatF = lat2d(nlat-1,nlon-1)
> res@mpRightCornerLonF = lon2d(nlat-1,nlon-1)
> res@tfDoNDCOverlay = True
> res@mpProjection = "LambertConformal"
> res@mpLambertParallel1F = 33
> res@mpLambertParallel2F = 45
> res@mpLambertMeridianF = -97
>
> res@mpFillOn = False
>
> res@mpOutlineBoundarySets = "AllBoundaries"
> res@mpDataBaseVersion = "Ncarg4_1"
> res@mpDataSetName = "Earth..4"
> res@mpUSStateLineThicknessF = 1.5
> res@mpUSStateLineColor = "Black"
> res@mpNationalLineThicknessF = 1.5
> res@mpNationalLineColor = "Black"
> res@mpCountyLineThicknessF = 0.5
> res@mpCountyLineColor = "grey70"
>
> res@mpGridAndLimbOn = False
> res@mpPerimOn = True
>
> res@cnLevelSelectionMode = "ExplicitLevels"
> res@cnLevels =
> (/0.004,0.008,0.012,0.016,0.020,0.024,0.028,0.032/)
>
> res@gsnCenterString = "isoprene daily average
> emssion(tons/km2/day)"
> plot =
> gsn_csm_contour_map(wks,isop_dailyavg,res)
>
> draw(plot)
> frame(wks)
>
> end_time = get_cpu_time()
> print(end_time - start_time)
>
> end
>
>
>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
>

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Tue Jul 2 12:44:46 2013

This archive was generated by hypermail 2.1.8 : Fri Jul 05 2013 - 13:06:49 MDT