Re: newpdf option ...

From: Ufuk Utku Turuncoglu (BE) <u.utku.turuncoglu_at_nyahnyahspammersnyahnyah>
Date: Tue Oct 11 2011 - 11:27:44 MDT

Hi Mary,

The operating system is Linux and i am using NCL 6.0.0
(ncl_ncarg-6.0.0.Linux_RedHat_x86_64_gcc412.tar). The file
/etc/fonts/fonts.conf also exist in the system. This problem won't
happen all time. For example, your script works without any problem but
attached script gives error. So, if you want i cat also put the input
file into your FTP.

Thanks,
Best wishes,

--ufuk

---- plot_domain.ncl ----
;-----------------------------------------------------------
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "plot_func.ncl"
;-----------------------------------------------------------
begin
   ;--- read grid ---
   grid = addfile ("../input/lake_grid.nc", "r")
   h = grid->h
   lat2d = grid->lat_rho
   lon2d = grid->lon_rho

   ;--- create plot ---
   wks = gsn_open_wks ("newpdf", "plot_domain")

   ;--- create colorbar ---
   color_topo = (/(/255, 255, 255 /), (/0, 0, 0/), (/99, 52, 0 /), \
                  (/162, 79, 0/), (/175, 106, 0/), (/199, 166, 52/), \
                  (/210, 189, 74/), (/242, 237, 109/), (/252, 255, 133/), \
                  (/231, 239, 0/), (/219, 226, 0/), (/178, 184, 0/), \
                  (/162, 168, 0/), (/124, 129, 0/), (/103, 122, 0/), \
                  (/0, 124, 0/), (/0, 147, 0/), (/0, 201, 76/), \
                  (/54, 223, 113/), (/171, 255, 191/), (/83, 189, 159/), \
                  (/50, 166, 150/), (/50, 150, 180/), (/5, 112, 176/), \
                  (/5, 80, 140/), (/9, 31, 150/), (/6, 47, 107/), \
                  (/6, 30, 70/), (/44, 2, 70/)/)*1.0
   color_topo = color_topo/255.0

   ;gsn_define_colormap (wks, "precip_11lev")
   gsn_define_colormap(wks, color_topo)
   i = NhlNewColor(wks,0.8,0.8,0.8)
   j = NhlNewColor(wks,0.8,0.0,0.0)

   ;--- set plot resource ---
   res = True
   res@gsnDraw = False
   res@gsnFrame = False
   res@gsnMaximize = True
   res@cnFillOn = True
   res@cnFillMode = "RasterFill"
   res@cnLinesOn = True
   res@cnLineLabelsOn = False
   res@cnFillDrawOrder = "PreDraw"
   res@gsnSpreadColors = True
   ;res@gsnSpreadColorEnd = -3
   res@gsnSpreadColorStart = 28
   res@gsnSpreadColorEnd = 19
   res@cnInfoLabelOn = False
   res@pmTickMarkDisplayMode = "Always"
   res@tmYRLabelsOn = False
   res@tmYROn = False
   res@tmXTLabelsOn = False
   res@tmXTOn = False
   res@tiXAxisString = "Longitude"
   res@tiYAxisString = "Latitude"
   res@tiXAxisFontHeightF = 0.012
   res@tiYAxisFontHeightF = 0.012
   res@tmXBLabelFontHeightF = 0.010
   res@tmYLLabelFontHeightF = 0.010
   res@tmLabelAutoStride = True
   res@lbOrientation = "vertical"
   res@pmLabelBarParallelPosF = 0.25
   res@pmLabelBarOrthogonalPosF = -0.01
   res@pmLabelBarHeightF = 0.25
   res@pmLabelBarWidthF = 0.08
   res@lbLabelFontHeightF = 0.006
   res@lbTitleString = "Depth (m)"
   res@lbTitleFontHeightF = 0.006

   res@cnLevelSelectionMode = "ExplicitLevels"
   res@cnLevels = (/ 0.0, 10.0, 25.0, 50.0, 100.0, \
                     150.0, 200.0, 250.0, 350.0, 450.0 /)

   res@gsnRightString = ""
   res@gsnLeftString = ""

   ;--- mapping properties ---
   res@mpDataBaseVersion = "HighRes"
   res@mpProjection = "LambertConformal"
   res@mpOutlineDrawOrder = "PostDraw"
   res@mpGridAndLimbOn = False
   res@mpLambertParallel1F = grid->PLAT(0)
   res@mpLambertParallel2F = grid->PLAT(1)

   res@mpLimitMode = "Corners"
   res@mpLeftCornerLatF = grid->P1-0.05
   res@mpLeftCornerLonF = grid->P2
   res@mpRightCornerLatF = grid->P3+0.07
   res@mpRightCornerLonF = grid->P4
   res@mpLambertMeridianF = 43.0

   lat2d = grid->lat_rho
   lon2d = grid->lon_rho
   h@lat2d = lat2d
   h@lon2d = lon2d

   map = gsn_csm_contour_map(wks, h, res)
   draw(map)

   ;--- plot domain box ---
   dims = dimsizes(lat2d)
   im = dims(1)
   jm = dims(0)
   delete(dims)

   xbox = (/ lon2d(0,0),lon2d(0,im-1),lon2d(jm-1,im-1), \
             lon2d(jm-1,0),lon2d(0,0) /)
   ybox = (/ lat2d(0,0),lat2d(0,im-1),lat2d(jm-1,im-1), \
             lat2d(jm-1,0),lat2d(0,0) /)

   ;--- create box array ---
   x_out = new(dimsizes(xbox), "float")
   y_out = new(dimsizes(ybox), "float")

   res_line = True
   res_line@gsLineThicknessF = 2.0
   res_line@gsLineColor = "red"
   datatondc(map, doubletofloat(xbox), doubletofloat(ybox), x_out, y_out)
   gsn_polyline_ndc(wks, x_out, y_out, res_line)

   ;--- get zones ---
   ;zones = getZones("CAS")
   ;dstr_zone = zones@name_zone
   ;xbox_zone = zones@xbox_zone
   ;ybox_zone = zones@ybox_zone

   ;--- define resource for source region boundaries ---
   ;res_region = True
   ;res_region@gsLineThicknessF = 2.0
   ;res_region@gsLineColor = "violetred"

   ;tx_res = True
   ;tx_res@txFont = 22
   ;tx_res@txFontHeightF = 0.012
   ;tx_res@txFontColor = "violetred"

   ;--- plot source region ---
   ;do i = 0, dimsizes(xbox_zone(:,0))-1
   ; gsn_polyline(wks, map, xbox_zone(i,:), ybox_zone(i,:), res_region)
   ; gsn_text(wks, map, dstr_zone(i), xbox_zone(i,2)+0.5,
ybox_zone(i,2)-0.25, tx_res)
   ;end do

   ;--- get cross sections ---
   cs = getCrossSections("LAKE_VAN")

   xo = cs@xo
   yo = cs@yo
   labels = cs@labels
   labele = cs@labele
   cs_lon = cs@plon
   cs_lat = cs@plat
   dir = cs@dir

   ;--- define slice path resource ---
   res_line = True
   res_line@gsLineThicknessF = 2.0
   res_line@gsLineColor = "red"

   nslice = dimsizes(xo(:,0))
   do i = 0, nslice-1
     gsn_polyline(wks, map, xo(i,:), yo(i,:), res_line)
   end do

   ;--- add text to plot ---
   tx_res = True
   tx_res@txFont = 22
   tx_res@txFontHeightF = 0.012
   tx_res@txFontColor = "violetred"

   m_res = True
   m_res@gsMarkerIndex = 4
   m_res@gsMarkerSizeF = 16.0
   m_res@gsMarkerColor = "violetred"

   do i = 0, nslice-1
     xoo = xo(i,0)-(xo(i,0)*0.0005)
     yoo = yo(i,0)+(yo(i,0)*0.0005)
     gsn_text(wks, map, labels(i), xoo, yoo, tx_res)
     gsn_polymarker(wks, map, xoo, yoo, m_res)

     xoo = xo(i,100)+(xo(i,100)*0.0005)
     yoo = yo(i,100)+(yo(i,100)*0.0005)
     gsn_text(wks, map, labele(i), xoo, yoo, tx_res)
     gsn_polymarker(wks, map, xoo, yoo, m_res)
   end do

   ;--- get individual points ---
   points = getPoints("LAKE_VAN")
   npoints = dimsizes(points@lat)

   m_res = True
   m_res@gsMarkerIndex = 16
   m_res@gsMarkerSizeF = 6.0
   m_res@gsMarkerColor = "violetred"

   do i = 0, npoints-1
     gsn_text(wks, map, points@name(i), points@lon(i)+0.03,
points@lat(i)+0.03, tx_res)
     gsn_polymarker(wks, map, points@lon(i), points@lat(i), m_res)
   end do

   frame(wks)
end

----
On 10/11/11 4:55 PM, Mary Haley wrote:
> Hi Ufuk,
>
> I haven't seen this error before, so I googled it. The general 
> implicatiion seems to be that fontconfig is not installed or 
> configured properly on your system.
>
> Are on a Linux system? If so, check if you have a 
> /etc/fonts/fonts.conf file.  This could be the source of your problem 
> if it doesn't exist.
>
> I'm not sure why this is affecting your NCL script, honestly, because 
> I didn't think NCL depended on some system fontconfig file. I would 
> have to look into this.
>
> Does this happen any time you use newpdf?  For example, what happens 
> if you type:
>
>     ng4ex xy01n -W newpdf -clean
>
> This will create a file called "xy01n.pdf"
>
> --Mary
>
> On Oct 11, 2011, at 3:16 AM, Ufuk Utku Turuncoglu (BE) wrote:
>
>> Hi,
>>
>> When i try to change the output type from pdf to newpdf, i am getting
>> following warning,
>>
>> Fontconfig error: Cannot load default config file
>>
>> but the plot looks fine. Any suggestion?
>>
>> Regards,
>>
>> --ufuk
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
Received on Tue Oct 11 11:28:02 2011

This archive was generated by hypermail 2.1.8 : Wed Oct 12 2011 - 15:59:45 MDT