[ncl-talk] contour plot with 2d x,y locations ...
Ufuk Utku Turuncoglu (BE)
u.utku.turuncoglu at be.itu.edu.tr
Mon Nov 17 06:33:50 MST 2014
Thanks. Yes you are correct. I'll attach the correct one to this mail.
Regards,
--ufuk
On 17/11/14 12:23, Karin Meier-Fleischer wrote:
> Sorry, you appended the wrong data file.
>
>
> Am 17.11.2014 um 10:15 schrieb Ufuk Utku Turuncoglu (BE) <u.utku.turuncoglu at be.itu.edu.tr>:
>
>> Hi,
>>
>> I am trying to create a contour plot from ocean float dataset but i could not create correct plot. To map data to x,y locations, i tried to use "TriangularMesh" resource but in this case gsn_csm_contour does not produce anything (just empty plot with weird axis). If i remove "TriangularMesh" definition, then NCL creates the plot but it does not create the axises and gives following warnings.
>>
>> warning:PlotManagerSetValues: TickMark annotation cannot be added after NhlCreate
>> warning:tmXBLabelFontHeightF is not a valid resource in plot_glpr_2d_contour.PlotManager at this time
>> warning:tmYLLabelFontHeightF is not a valid resource in plot_glpr_2d_contour.PlotManager at this time
>>
>> So, what is the correct way to create this kind of float plots.
>>
>> PS: i also attached the data file to mail.
>>
>> Thanks,
>> Regards,
>>
>> --ufuk
>>
>> ;-----------------------------------------------------------
>> 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"
>> ;-----------------------------------------------------------
>> begin
>> ;--- parameters ---
>> ifile = "GL_PR_PF_1901200.nc"
>>
>> ;--- open file ---
>> nc1 = addfile(ifile, "r")
>>
>> ;--- read variables ---
>> time = nc1->TIME
>> pres = nc1->PRES
>> date = cd_calendar(time, 4)
>> plat = nc1->LATITUDE
>> plon = nc1->LONGITUDE
>> data = nc1->TEMP
>>
>> dims = dimsizes(pres)
>> ntime = plat(0)
>> nlev = plat(1)
>>
>> ;--- calculate depth from pressure ---
>> ;--- UNESCO Technical Papers in Marine Science No. 44 ---
>> ;--- http://www.seabird.com/document/an69-conversion-pressure-depth ---
>> x = (sin(plat/57.29578))^2
>> x2d = conform(pres, x, (/ 0 /))
>> g = 9.780318*(1.0+(5.2788e-3+2.36e-5*x2d)*x2d)+1.092e-6*pres
>> depth = pres
>> depth = ((((-1.82e-15*pres+2.279e-10)*pres-2.2512e-5)*pres+9.72659)*pres)/g
>>
>> ;--- plot data ---
>> wks = gsn_open_wks ("newpdf", "plot_glpr_2d")
>> gsn_define_colormap (wks, "matlab_jet")
>> i = NhlNewColor(wks,0.8,0.8,0.8)
>>
>> res = True
>> res at vpHeightF = 0.15
>> res at vpWidthF = 0.75
>> res at tiYAxisString = "Depth (m)"
>> res at tiXAxisString = "Time"
>> res at gsnLeftString = ""
>> res at gsnRightString = ""
>> res at gsnSpreadColors = True
>> res at gsnSpreadColorEnd = -3
>> res at cnFillOn = True
>> res at cnFillMode = "RasterFill"
>> res at cnInfoLabelOn = False
>> res at cnLinesOn = False
>> res at cnLineLabelsOn = False
>> res at lbLabelBarOn = False
>> res at pmTickMarkDisplayMode = "Always"
>> res at tiXAxisFontHeightF = 0.008
>> res at tiYAxisFontHeightF = 0.008
>> res at tmXBLabelFontHeightF = 0.008
>> res at tmYLLabelFontHeightF = 0.008
>>
>> xa = conform(pres, date, (/ 0 /))
>> copy_VarCoords(pres, xa)
>> xa = mask(xa, ismissing(depth), False)
>> res at sfXArray = xa(DEPTH|:,TIME|:)
>> res at sfYArray = depth(DEPTH|:,TIME|:)
>> res at trGridType = "TriangularMesh"
>> res at trYReverse = True
>>
>> plot1 = gsn_csm_contour(wks, data(DEPTH|:,TIME|:), res)
>> end
>> <GL_TS_PF_1901200.nc>_______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
> ____________________________________
> Dipl. Geophys. Karin Meier-Fleischer
> Visualisierung
> Abteilung Anwendungen
>
> Deutsches Klimarechenzentrum GmbH (DKRZ)
> Bundesstrasse 45a * D-20146 Hamburg
> Germany
>
> Phone: +49 (0)40 460094 126
> Fax: +49 (0)40 460094 270
> E-Mail: meier-fleischer at dkrz.de
> URL: http://www.dkrz.de/
>
> Geschäftsführer: Prof. Dr. Thomas Ludwig
> Sitz der Gesellschaft: Hamburg
> Amtsgericht Hamburg HRB 39784
>
>
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GL_PR_PF_1901200.nc
Type: application/octet-stream
Size: 332568 bytes
Desc: not available
Url : http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141117/34b62541/attachment-0001.obj
More information about the ncl-talk
mailing list