[ncl-talk] Graphical error
Md. Jalal Uddin
dmjalal90 at gmail.com
Tue Apr 24 04:43:45 MDT 2018
Dear Sir,
Thanks for your kind help. I followed your instruction, tot_prc =
dim_sum_n_Wrap(prc,0) . I am getting errors when I used two-dimensional
TRMM 3B42 data. I got a map without precipitation which is in the
attachment.
For two dimensional data,
warning:Non-monotonic coordinate array generated -- check validity of the
aggregated (leftmost) dimension
sum_op_ncl : dim_sum_n over dimension(s): lat
(0) Error: scalar_field: If the input data is 1-dimensional, you must set
sfXArray and sfYArray to 1-dimensional arrays of the same length.
warning:create: Bad HLU id passed to create, ignoring it
warning:ContourPlotSetValues: Data values out of range of levels set by
EXPLICITLEVELS mode
When I added multiple files manually, it gives me a right map (in the
attachment). I also tried to plot for three-dimensional data, but it gives
me following warning.
gsn_csm_contour_map_ce: Fatal: the input data array must be 1D or 2D
I am looking forward to your kind advice and positive response.
Cheers,
Jalal
On Tue, Apr 24, 2018 at 4:40 AM, Rashed Mahmood <rashidcomsis at gmail.com>
wrote:
> Hi Jalal,
> The simplest answer would be to use one of the "dim_sum*" functions, e.g.
> in your case you could try:
> tot_prc = dim_sum_n_Wrap(prc,0)
>
> This should give you sum for the time period you are selecting using
> addfiles. Note that you might need to consider/think about the units, e.g.
> total precipitation during the selected time period etc.
>
> Cheers,
> Rashed
>
> Post doctoral fellow,
> University of Victoria, Victoria BC.
>
>
>
> On Sat, Apr 21, 2018 at 5:07 AM, Md. Jalal Uddin <dmjalal90 at gmail.com>
> wrote:
>
>> Dear Sir,
>> My precipitation data is TRMM 3B42 that is 3 hourly. What should I add in the
>> following script to sum precipitation?
>>
>>
>> diri = "./"
>> fili = systemfunc("cd "+diri+" ; ls 3B42RT.2013*.7.nc4")
>> pthi = diri+fili
>> print(fili)
>>
>> f = addfiles(pthi, "r")
>> prc = f[:]->precipitation
>>
>> printVarSummary(prc)
>>
>> Best Wishes
>> Jalal
>>
>> On Mon, Apr 9, 2018 at 3:50 AM, Dennis Shea <shea at ucar.edu> wrote:
>>
>>> How about addfiles
>>>
>>> https://www.ncl.ucar.edu/Document/Functions/Built-in/addfiles.shtml
>>> -------------
>>>
>>> diri = "./"
>>> fili = systemfunc("cd "+diri+" ; ls 3B42RT.2013*.7.nc4")
>>> pthi = diri+fili
>>> print(fili)
>>>
>>> f = addfiles(pthi, "r")
>>> prc = f[:]->precipitation
>>>
>>> printVarSummary(prc)
>>>
>>> On Sun, Apr 8, 2018 at 6:51 AM, Guido Cioni <guidocioni at gmail.com>
>>> wrote:
>>>
>>>> You should provide clean code when writing to ncl-talk. There are a lot
>>>> of commented lines in your script and it is hard to understand what you are
>>>> actually doing. Everyone's time here is valuable ;)
>>>>
>>>> I suspect that your error is coming from this line
>>>>
>>>> prc_all = (prc1 + prc2 + prc3 + prc4 + prc5 + prc6 + prc7 + prc8 + prc9 + prc10 + prc11 + prc12 + prc13 + prc14 + prc15 + prc16 + prc17 + prc18 + prc19 + prc20 + prc21 + prc22 + prc23 + prc24 + prc25 + prc26 + prc27 + prc28 + prc29 + prc30 + prc31 + prc32 + prc33 + prc34 + prc35 + prc36 + prc37 + prc38 + prc39 + prc40 + prc41 + prc42 + prc43 + prc44 + prc45 + prc46 + prc47 + prc48 + prc49)
>>>>
>>>>
>>>> In this assignment every metadata (including coordinate variables) will
>>>> be lost. Thus, NCL doesn't know how to interpret the coordinates of the
>>>> variable that you are trying to plot. It's weird because it appears that in
>>>> a commented part of your code you were exactly trying to fix this problem
>>>>
>>>> ;prc_last := prc_all->precipitation
>>>> ;prc!0 = "lat" ; 1st ... name the dimensions
>>>> ;prc!1 = "lon"
>>>> ;prc&lat = lat ; create coordinate variable
>>>> ;prc&lon = lon
>>>>
>>>>
>>>> So...few options to fix this.
>>>>
>>>> [1] Re-assign coordinate variables as you did in the aforementioned
>>>> part of the code which is now commented out. Note that you should use the
>>>> names lat2d and lon2d if your coordinate variables are 2d instead of 1d.
>>>>
>>>> [2] Directly copy var coordinates (and possibly attributes) using one
>>>> of the function https://www.ncl.ucar.edu/Document/Functions/Contrib
>>>> uted/copy_VarCoords.shtml: https://www.ncl.ucar.edu/Document
>>>> /Functions/Contributed/copy_VarMeta.shtml.
>>>>
>>>> Doing copy_VarCoords(prc1,prc_all) should do the trick.
>>>>
>>>> [3] Manually assign the coordinate variables to the plotting routine
>>>> using the resources sfXarray and sfYArray. (this
>>>> https://www.ncl.ucar.edu/Applications/contour1d.shtml can help).
>>>>
>>>>
>>>> Cheers
>>>>
>>>> On 8. Apr 2018, at 13:48, Md. Jalal Uddin <dmjalal90 at gmail.com> wrote:
>>>>
>>>> Dear Sir/ Madam,
>>>>
>>>> I am a new user in NCL. I am getting following error in NCL. I tried to
>>>> fix it by following NCL guidelines, but don't know why it is not fixing. I
>>>> used TRMM3B42 3 hourly data. Could you help me, please?
>>>>
>>>> (0) check_for_y_lat_coord: Warning: Data either does
>>>> not contain a valid latitude coordinate array or doesn't
>>>> contain one at all
>>>> (0) check_for_lon_coord: Warning: Data either does
>>>> not contain a valid longitude coordinate array or doesn't
>>>> contain one at all
>>>>
>>>> (0) is_valid_lat_ycoord: Warning: The units attribute of
>>>> the Y coordinate array is not set to one of the allowable
>>>> units values (i.e. 'degrees_north'). Your latitude labels
>>>> may not be correct.
>>>>
>>>> (0) is_valid_lat_xcoord: Warning: The units attribute of
>>>> the X coordinate array is not set to one of the allowable
>>>> units values (i.e. 'degrees_east'). Your longitude labels
>>>> may not be correct.
>>>>
>>>> ;;;;;My script
>>>>
>>>>
>>>> ;***********************************************
>>>> ;
>>>> ; These files are loaded by default in NCL V6.2.0 and newer
>>>> ; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
>>>> ; load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>>>>
>>>> begin
>>>> ;************************************************
>>>> ; Read the file
>>>> ;************************************************
>>>> f1 = addfile("3B42RT.2013051100.7.nc4","r")
>>>> prc1 = f1->precipitation ;; prc1 here is two dimensional
>>>>
>>>> f2 = addfile("3B42RT.2013051103.7.nc4","r")
>>>> prc2 = f2->precipitation
>>>>
>>>> f3 = addfile("3B42RT.2013051106.7.nc4","r")
>>>> prc3 = f3->precipitation
>>>>
>>>> f4 = addfile("3B42RT.2013051109.7.nc4","r")
>>>> prc4 = f4->precipitation
>>>>
>>>> f5 = addfile("3B42RT.2013051112.7.nc4","r")
>>>> prc5 = f5->precipitation
>>>>
>>>> f6 = addfile("3B42RT.2013051115.7.nc4","r")
>>>> prc6 = f6->precipitation
>>>>
>>>> f7 = addfile("3B42RT.2013051118.7.nc4","r")
>>>> prc7 = f7->precipitation
>>>>
>>>> f8 = addfile("3B42RT.2013051121.7.nc4","r")
>>>> prc8 = f8->precipitation
>>>>
>>>> f9 = addfile("3B42RT.2013051200.7.nc4","r")
>>>> prc9 = f9->precipitation
>>>>
>>>> f10 = addfile("3B42RT.2013051203.7.nc4","r")
>>>> prc10 = f10->precipitation
>>>>
>>>> f11 = addfile("3B42RT.2013051206.7.nc4","r")
>>>> prc11 = f11->precipitation
>>>>
>>>> f12 = addfile("3B42RT.2013051209.7.nc4","r")
>>>> prc12 = f12->precipitation
>>>>
>>>> f13 = addfile("3B42RT.2013051212.7.nc4","r")
>>>> prc13 = f13->precipitation
>>>>
>>>> f14 = addfile("3B42RT.2013051215.7.nc4","r")
>>>> prc14 = f14->precipitation
>>>>
>>>> f15 = addfile("3B42RT.2013051218.7.nc4","r")
>>>> prc15 = f15->precipitation
>>>>
>>>> f16 = addfile("3B42RT.2013051221.7.nc4","r")
>>>> prc16 = f16->precipitation
>>>>
>>>> f17 = addfile("3B42RT.2013051300.7.nc4","r")
>>>> prc17 = f17->precipitation
>>>>
>>>> f18 = addfile("3B42RT.2013051303.7.nc4","r")
>>>> prc18 = f18->precipitation
>>>>
>>>> f19 = addfile("3B42RT.2013051306.7.nc4","r")
>>>> prc19 = f19->precipitation
>>>>
>>>> f20 = addfile("3B42RT.2013051309.7.nc4","r")
>>>> prc20 = f20->precipitation
>>>>
>>>> f21 = addfile("3B42RT.2013051312.7.nc4","r")
>>>> prc21 = f21->precipitation
>>>>
>>>> f22 = addfile("3B42RT.2013051315.7.nc4","r")
>>>> prc22 = f22->precipitation
>>>>
>>>> f23 = addfile("3B42RT.2013051318.7.nc4","r")
>>>> prc23 = f23->precipitation
>>>>
>>>> f24 = addfile("3B42RT.2013051321.7.nc4","r")
>>>> prc24 = f24->precipitation
>>>>
>>>> f25 = addfile("3B42RT.2013051400.7.nc4","r")
>>>> prc25 = f25->precipitation
>>>>
>>>> f26 = addfile("3B42RT.2013051403.7.nc4","r")
>>>> prc26 = f26->precipitation
>>>>
>>>> f27 = addfile("3B42RT.2013051406.7.nc4","r")
>>>> prc27 = f27->precipitation
>>>>
>>>> f28 = addfile("3B42RT.2013051409.7.nc4","r")
>>>> prc28 = f28->precipitation
>>>>
>>>> f29 = addfile("3B42RT.2013051412.7.nc4","r")
>>>> prc29 = f29->precipitation
>>>>
>>>> f30 = addfile("3B42RT.2013051415.7.nc4","r")
>>>> prc30 = f30->precipitation
>>>>
>>>> f31 = addfile("3B42RT.2013051418.7.nc4","r")
>>>> prc31 = f31->precipitation
>>>>
>>>> f32 = addfile("3B42RT.2013051421.7.nc4","r")
>>>> prc32 = f32->precipitation
>>>>
>>>> f33 = addfile("3B42RT.2013051500.7.nc4","r")
>>>> prc33 = f33->precipitation
>>>>
>>>> f34 = addfile("3B42RT.2013051503.7.nc4","r")
>>>> prc34 = f34->precipitation
>>>>
>>>> f35 = addfile("3B42RT.2013051506.7.nc4","r")
>>>> prc35 = f35->precipitation
>>>>
>>>> f36 = addfile("3B42RT.2013051509.7.nc4","r")
>>>> prc36 = f36->precipitation
>>>>
>>>> f37 = addfile("3B42RT.2013051512.7.nc4","r")
>>>> prc37 = f37->precipitation
>>>>
>>>> f38 = addfile("3B42RT.2013051515.7.nc4","r")
>>>> prc38 = f38->precipitation
>>>>
>>>> f39 = addfile("3B42RT.2013051518.7.nc4","r")
>>>> prc39 = f39->precipitation
>>>>
>>>> f40 = addfile("3B42RT.2013051521.7.nc4","r")
>>>> prc40 = f40->precipitation
>>>>
>>>> f41 = addfile("3B42RT.2013051600.7.nc4","r")
>>>> prc41 = f41->precipitation
>>>>
>>>> f42 = addfile("3B42RT.2013051603.7.nc4","r")
>>>> prc42 = f42->precipitation
>>>>
>>>> f43 = addfile("3B42RT.2013051606.7.nc4","r")
>>>> prc43 = f43->precipitation
>>>>
>>>> f44 = addfile("3B42RT.2013051609.7.nc4","r")
>>>> prc44 = f44->precipitation
>>>>
>>>> f45 = addfile("3B42RT.2013051612.7.nc4","r")
>>>> prc45 = f45->precipitation
>>>>
>>>> f46 = addfile("3B42RT.2013051615.7.nc4","r")
>>>> prc46 = f46->precipitation
>>>>
>>>> f47 = addfile("3B42RT.2013051618.7.nc4","r")
>>>> prc47 = f47->precipitation
>>>>
>>>> f48 = addfile("3B42RT.2013051621.7.nc4","r")
>>>> prc48 = f48->precipitation
>>>>
>>>> f49 = addfile("3B42RT.2013051700.7.nc4","r")
>>>> prc49 = f49->precipitation
>>>>
>>>> prc_all = (prc1 + prc2 + prc3 + prc4 + prc5 + prc6 + prc7 + prc8 + prc9 + prc10 + prc11 + prc12 + prc13 + prc14 + prc15 + prc16 + prc17 + prc18 + prc19 + prc20 + prc21 + prc22 + prc23 + prc24 + prc25 + prc26 + prc27 + prc28 + prc29 + prc30 + prc31 + prc32 + prc33 + prc34 + prc35 + prc36 + prc37 + prc38 + prc39 + prc40 + prc41 + prc42 + prc43 + prc44 + prc45 + prc46 + prc47 + prc48 + prc49)
>>>>
>>>> ;prc_last := prc_all->precipitation
>>>> ;prc!0 = "lat" ; 1st ... name the dimensions
>>>> ;prc!1 = "lon"
>>>> ;prc&lat = lat ; create coordinate variable
>>>> ;prc&lon = lon
>>>>
>>>>
>>>> ;lat_p = (/-35,-30,-25,-20,-15,-10,-5,0,5,10,15,20,25,30/)
>>>> ;lon_p = (/0,10,20,30,40,50,60,70,80,90,100,110,120,130,135/)
>>>> ;X!0 = "lat"
>>>> ;Y!1 = "lon"
>>>> ;X&lat at units = "degrees_north"
>>>> ;Y&lon at units = "degrees_east"
>>>> ;grid = new((/14,15),float)
>>>>
>>>> ;grid&lat = lat_p
>>>> ;grid&lon = lon_p
>>>>
>>>> printVarSummary(prc_all)
>>>>
>>>> ;************************************************
>>>> ; create colors
>>>> ;*************************************************
>>>> wks = gsn_open_wks("png","Mahasen") ; open a workstation and send data to eps
>>>>
>>>> colors = (/ (/255,255,255/), (/244,255,244/), \
>>>> (/217,255,217/), (/163,255,163/), (/106,255,106/), \
>>>> (/43,255,106/), (/0,224,0/), (/0,134,0/),(/255,255,0/),\
>>>> (/255,127,0/) /) / 255. ; be sure to make this a float!
>>>>
>>>> ;************************************************
>>>> ; create panel plots
>>>> ;*************************************************
>>>> res = True ; plot options desired
>>>>
>>>> res at cnFillOn = True ; turn on color fill
>>>> res at cnLinesOn = False ; turn off contour lines
>>>> res at cnFillPalette = colors
>>>>
>>>> res at cnLevelSelectionMode = "ExplicitLevels" ; set explicit contour levels
>>>> res at cnLevels = (/5,10,15,20,25,30,35,40,45,50,55/)
>>>> ;res at cnLevels = (/0.1,0.2,0.4,0.8,1.6,3.2,6.4,12.8,20,25,30/)
>>>>
>>>>
>>>> res at mpFillOn = True ; turn on gray continents
>>>> res at pmTickMarkDisplayMode = "Always"
>>>>
>>>> res at mpLimitMode = "LatLon" ; select subregion
>>>> res at mpMinLatF = -35.
>>>> res at mpMaxLatF = 30.
>>>> res at mpMinLonF = 0.
>>>> res at mpMaxLonF = 135.
>>>> ;res at mpProjection = "Mercator"
>>>> res at lbOrientation = "horizontal"
>>>> res at trGridType = "TriangularMesh"
>>>> ;res at trGridType = "curvilinear"
>>>>
>>>> res at tmYROn = False ; turn off right and top tickmarks
>>>> res at tmXTOn = False
>>>>
>>>> ; add polygon to plot
>>>> y = (/10.3, 10.8, 11.4, 11.9, 12.3, 13.1, 13.7, 14.2, 14.7, 15.6, 16.5, 17.5, 18.5, 19.7, 20.7, 22.4, 24.3/)
>>>> x = (/87.0, 86.7, 86.5, 86.2, 85.6, 85.4, 85.4, 85.8, 86.2, 86.7, 87.2, 87.6, 88.4, 89.0, 89.9, 91.1, 92.6/)
>>>> resp = True ; mods yes
>>>> resp at gsLineThicknessF = 3.0 ; line thickness
>>>> resp at gsLineColor = "black"
>>>>
>>>> ;Add markers to the trajectories.
>>>> amres = True ; marker resources for best track
>>>> amres at gsMarkerIndex = 14 ; marker style (filled circle)
>>>> amres at gsMarkerSizeF = 8.0 ; marker size
>>>> amres at gsMarkerColor = "black" ; maker color
>>>>
>>>> plot = gsn_csm_contour_map(wks, prc_all,res) ; create plot
>>>> d = gsn_add_polyline(wks,plot,x,y,resp)
>>>> d1 = gsn_add_polymarker(wks,plot,x,y,amres)
>>>> draw(plot)
>>>> frame(wks)
>>>> end
>>>>
>>>> Best Wishes
>>>> Jalal
>>>>
>>>> --
>>>> *Md. Jalal Uddin*
>>>> MSc in Applied Meteorology (English Language)
>>>> Nanjing University of Information, Science and Technology, China
>>>> Jasmine Jiangsu Government Scholar
>>>> Cell: +8613260859092
>>>> Office: Beichen Building, School of Geography and Remote Sensing, Room
>>>> No. 406
>>>>
>>>> *AND *
>>>> B.Sc. in Disaster Management (Hons.)
>>>> Patuakhali Science and Technology University, Bangladesh.
>>>> Cell: +8801792052662, +8801838613203
>>>> Email: dmjalal90 at gmail.com
>>>> Web: www.dmjalal90.weebly.com
>>>> Facebook: jalal.hossen.39
>>>> LinkedIn: https://bd.linkedin.com/in/md-jalal-uddin-80a026b0
>>>> Twitter: dmjalal90
>>>> Skype: dmjalal90
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> ncl-talk at ucar.edu
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>
>>>>
>>>>
>>>> Guido Cioni
>>>> http://guidocioni.altervista.org
>>>>
>>>>
>>>> _______________________________________________
>>>> ncl-talk mailing list
>>>> ncl-talk at ucar.edu
>>>> List instructions, subscriber options, unsubscribe:
>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>
>>>>
>>>
>>
>>
>> --
>> *Md. Jalal Uddin*
>> MSc in Applied Meteorology (English Language)
>> Nanjing University of Information, Science and Technology, China
>> Jasmine Jiangsu Government Scholar
>> Cell: +8613260859092
>> Office: Beichen Building, School of Geography and Remote Sensing, Room
>> No. 406
>>
>> *AND *
>> B.Sc. in Disaster Management (Hons.)
>> Patuakhali Science and Technology University, Bangladesh.
>> Cell: +8801792052662, +8801838613203
>> Email: dmjalal90 at gmail.com
>> Web: www.dmjalal90.weebly.com
>> Facebook: jalal.hossen.39
>> LinkedIn: https://bd.linkedin.com/in/md-jalal-uddin-80a026b0
>> Twitter: dmjalal90
>> Skype: dmjalal90
>>
>> _______________________________________________
>> ncl-talk mailing list
>> ncl-talk at ucar.edu
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
--
*Md. Jalal Uddin*
MSc in Applied Meteorology (English Language)
Nanjing University of Information, Science and Technology, China
Jasmine Jiangsu Government Scholar
Cell: +8613260859092
Office: Beichen Building, School of Geography and Remote Sensing, Room No.
406
*AND *
B.Sc. in Disaster Management (Hons.)
Patuakhali Science and Technology University, Bangladesh.
Cell: +8801792052662, +8801838613203
Email: dmjalal90 at gmail.com
Web: www.dmjalal90.weebly.com
Facebook: jalal.hossen.39
LinkedIn: https://bd.linkedin.com/in/md-jalal-uddin-80a026b0
Twitter: dmjalal90
Skype: dmjalal90
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180424/9e7b331e/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Mahasen.000002.png
Type: image/png
Size: 73666 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180424/9e7b331e/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: New_Mahasen.000002.png
Type: image/png
Size: 181223 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180424/9e7b331e/attachment-0003.png>
More information about the ncl-talk
mailing list