From leslie.linglai at gmail.com Wed Aug 7 02:10:25 2024 From: leslie.linglai at gmail.com (lzl lai) Date: Wed, 7 Aug 2024 16:10:25 +0800 Subject: [ncl-talk] problem of cd_calendar Message-ID: Hi, I have a problem using cd_calendar to convert time variable to a UT-referenced date. my data is ECMWF( monthly reanalysis), their valid_time type is int64 when I use cd_calendar, it shows fatal message: -------- Variable: time Type: int64 Total Size: 8120 bytes 1015 values Number of Dimensions: 1 Dimensions and sizes: [valid_time | 1015] Coordinates: valid_time: [-946771200..1719792000] Number Of Attributes: 4 long_name : time standard_name : time units : seconds since 1970-01-01 calendar : proleptic_gregorian fatal:Argument type mismatch on argument (0) of (cd_calendar) can not coerce -------------------- Can anyone help me to deal with this problem? Thank you very much -------------- next part -------------- An HTML attachment was scrubbed... URL: From dave.allured at noaa.gov Wed Aug 7 08:39:01 2024 From: dave.allured at noaa.gov (Dave Allured - NOAA Affiliate) Date: Wed, 7 Aug 2024 08:39:01 -0600 Subject: [ncl-talk] problem of cd_calendar In-Reply-To: References: Message-ID: Lzl lai, the first argument to the cd_calendar function must be one of the NCL basic "numeric" data types. See the function documentation. Your "time" variable is type int64, which is "extra-numeric", not "numeric". Please see the NCL reference manual under "Basic numeric types". The cd_calendar function needs to be updated, but NCL is not receiving maintenance right now. The easy fix is to convert your "time" variable to type "double" before input to cd_calendar. This will probably work fine for units = "seconds since 1970-01-01". However, there is a risk of loss of precision if some of your int64 time values are outside the range of exact integer representation for type double. You can check for exact conversion like this (untested): time2 = todouble (time) time3 = toint64 (time2) if (any (time3 .ne. time)) then print ("Warning, loss of precision when converting time coordinates.") max_dif = max (abs (time3 - time)) print ("Maximum precision loss = " + max_dif + " seconds.") end if On Wed, Aug 7, 2024 at 2:10?AM lzl lai via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > Hi, > I have a problem using cd_calendar to convert time variable to a > UT-referenced date. > my data is ECMWF( monthly reanalysis), their valid_time type is int64 > when I use cd_calendar, it shows fatal message: > -------- > Variable: time > Type: int64 > Total Size: 8120 bytes > 1015 values > Number of Dimensions: 1 > Dimensions and sizes: [valid_time | 1015] > Coordinates: > valid_time: [-946771200..1719792000] > Number Of Attributes: 4 > long_name : time > standard_name : time > units : seconds since 1970-01-01 > calendar : proleptic_gregorian > fatal:Argument type mismatch on argument (0) of (cd_calendar) can not > coerce > -------------------- > > Can anyone help me to deal with this problem? Thank you very much > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tabishumaransari at gmail.com Tue Aug 13 09:48:48 2024 From: tabishumaransari at gmail.com (Tabish Ansari) Date: Tue, 13 Aug 2024 17:48:48 +0200 Subject: [ncl-talk] contour map not showing colors Message-ID: Hi I have a cropped dataset over northern China from the CAMS Reanalyses product which contains 3-hourly PM2.5 concentrations for the year 2019. Here's the variable metadata: short pm2p5(time, latitude, longitude) ; pm2p5:scale_factor = 7.76424835780384e-11 ; pm2p5:add_offset = 2.54403361691801e-06 ; pm2p5:_FillValue = -32767s ; pm2p5:missing_value = -32767s ; pm2p5:units = "kg m**-3" ; pm2p5:long_name = "Particulate matter d < 2.5 um" ; pm2p5:standard_name = "mass_concentration_of_pm2p5_ambient_aerosol_particles_in_air" ; I've written a fairly straightforward NCL script just to plot the annual average PM2.5 concentration. It shows the map with contour lines and an appropriately ranged labelbar but with no colors within the map. Here's my script: ============================================================================== begin ;SOURCING FILES DIR = "/worknb/users/tans/Capstone-Maya/" a = addfile(DIR+"CAMSconc_3hourly_NCP2019.nc","r") ;READING DATA pm25NCP = short2flt(a->pm2p5) pm25NCP = pm25NCP * 10^9 pm25NCP = pm25NCP(:,::-1,:) ; flipping latitudes to correct the inverted data ;PREPARING TIME-AVERAGED DATA pm25NCPavg = dim_avg_n_Wrap(pm25NCP,0) printVarSummary(pm25NCPavg) printMinMax(pm25NCPavg,True) ;START THE GRAPHICS wks = gsn_open_wks("x11","NCPavgconc") res = True res at gsnMaximize = True ; Maximize plot in frame res at cnFillOn = True ; turn on color ;res at cnFillPalette = "MPL_Reds" ; set color map res at cnLinesOn = True ; turn contour lines on/off res at gsnAddCyclic = False res at mpFillOn = True ;SELECT NCP REGION FROM THE GLOBE res at mpProjection = "Mercator" res at mpLambertParallel1F = 30. res at mpLambertParallel2F = 40. res at mpLambertMeridianF = 115. res at mpLimitMode = "Corners" ; choose region of map res at mpLeftCornerLatF = 20. res at mpLeftCornerLonF = 100. res at mpRightCornerLatF = 50. res at mpRightCornerLonF = 130. plot = gsn_csm_contour_map(wks, pm25NCPavg, res) end =================================================================== The output of the script is as follows: Copyright (C) 1995-2019 - All Rights Reserved University Corporation for Atmospheric Research NCAR Command Language Version 6.6.2 The use of this software is governed by a License Agreement. See http://www.ncl.ucar.edu/ for more details. Variable: pm25NCPavg Type: float Total Size: 6724 bytes 1681 values Number of Dimensions: 2 Dimensions and sizes: [latitude | 41] x [longitude | 41] Coordinates: latitude: [20..50] longitude: [100..130] Number Of Attributes: 8 _FillValue : -32767 units : kg m**-3 long_name : Particulate matter d < 2.5 um standard_name : mass_concentration_of_pm2p5_ambient_aerosol_particles_in_air _FillValue_original : -32767 missing_value_original : -32767 missing_value : -32767 average_op_ncl : dim_avg_n over dimension(s): time (0) (0) Particulate matter d < 2.5 um (kg m**-3) : min=3.35468 max=205.552 And I have attached the resulting map as a png file. I'd really appreciate it if someone can point out what is needed for the plot to show the contour colors. Thanks a lot. best regards, Tabish -------------------------------------------------------------------------------------- Dr Tabish Ansari Research Associate Air Quality Modelling Group Research Institute for Sustainability (RIFS) - Helmholtz Centre Potsdam Potsdam, Germany -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: NCPavgconc.png Type: image/png Size: 148397 bytes Desc: not available URL: From brownrig at ucar.edu Tue Aug 13 10:02:52 2024 From: brownrig at ucar.edu (Rick Brownrigg) Date: Tue, 13 Aug 2024 10:02:52 -0600 Subject: [ncl-talk] contour map not showing colors In-Reply-To: References: Message-ID: Hi Tabish, I'm not seeing the problem -- it is indeed a straightforward script. If you can send me that dataset, I'll take a closer look into it. Rick On Tue, Aug 13, 2024 at 9:49?AM Tabish Ansari via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > Hi > > I have a cropped dataset over northern China from the CAMS Reanalyses > product which contains 3-hourly PM2.5 concentrations for the year 2019. > > Here's the variable metadata: > short pm2p5(time, latitude, longitude) ; > pm2p5:scale_factor = 7.76424835780384e-11 ; > pm2p5:add_offset = 2.54403361691801e-06 ; > pm2p5:_FillValue = -32767s ; > pm2p5:missing_value = -32767s ; > pm2p5:units = "kg m**-3" ; > pm2p5:long_name = "Particulate matter d < 2.5 um" ; > pm2p5:standard_name = > "mass_concentration_of_pm2p5_ambient_aerosol_particles_in_air" ; > > > I've written a fairly straightforward NCL script just to plot the annual > average PM2.5 concentration. It shows the map with contour lines and an > appropriately ranged labelbar but with no colors within the map. > Here's my script: > > ============================================================================== > begin > > ;SOURCING FILES > DIR = "/worknb/users/tans/Capstone-Maya/" > a = addfile(DIR+"CAMSconc_3hourly_NCP2019.nc","r") > > > ;READING DATA > pm25NCP = short2flt(a->pm2p5) > pm25NCP = pm25NCP * 10^9 > pm25NCP = pm25NCP(:,::-1,:) ; flipping latitudes to correct the inverted > data > > > ;PREPARING TIME-AVERAGED DATA > pm25NCPavg = dim_avg_n_Wrap(pm25NCP,0) > printVarSummary(pm25NCPavg) > printMinMax(pm25NCPavg,True) > > > ;START THE GRAPHICS > wks = gsn_open_wks("x11","NCPavgconc") > res = True > res at gsnMaximize = True ; Maximize plot in frame > res at cnFillOn = True ; turn on color > ;res at cnFillPalette = "MPL_Reds" ; set color map > res at cnLinesOn = True ; turn contour lines on/off > res at gsnAddCyclic = False > res at mpFillOn = True > > ;SELECT NCP REGION FROM THE GLOBE > res at mpProjection = "Mercator" > res at mpLambertParallel1F = 30. > res at mpLambertParallel2F = 40. > res at mpLambertMeridianF = 115. > > res at mpLimitMode = "Corners" ; choose region of map > res at mpLeftCornerLatF = 20. > res at mpLeftCornerLonF = 100. > res at mpRightCornerLatF = 50. > res at mpRightCornerLonF = 130. > > plot = gsn_csm_contour_map(wks, pm25NCPavg, res) > > end > =================================================================== > > > The output of the script is as follows: > Copyright (C) 1995-2019 - All Rights Reserved > University Corporation for Atmospheric Research > NCAR Command Language Version 6.6.2 > The use of this software is governed by a License Agreement. > See http://www.ncl.ucar.edu/ for more details. > > Variable: pm25NCPavg > Type: float > Total Size: 6724 bytes > 1681 values > Number of Dimensions: 2 > Dimensions and sizes: [latitude | 41] x [longitude | 41] > Coordinates: > latitude: [20..50] > longitude: [100..130] > Number Of Attributes: 8 > _FillValue : -32767 > units : kg m**-3 > long_name : Particulate matter d < 2.5 um > standard_name : > mass_concentration_of_pm2p5_ambient_aerosol_particles_in_air > _FillValue_original : -32767 > missing_value_original : -32767 > missing_value : -32767 > average_op_ncl : dim_avg_n over dimension(s): time > (0) > (0) Particulate matter d < 2.5 um (kg m**-3) : min=3.35468 > max=205.552 > > > > And I have attached the resulting map as a png file. > > I'd really appreciate it if someone can point out what is needed for the > plot to show the contour colors. > > Thanks a lot. > > best regards, > > Tabish > > > -------------------------------------------------------------------------------------- > Dr Tabish Ansari > Research Associate > Air Quality Modelling Group > Research Institute for Sustainability (RIFS) - Helmholtz Centre Potsdam > Potsdam, Germany > _______________________________________________ > ncl-talk mailing list > ncl-talk at mailman.ucar.edu > List instructions, subscriber options, unsubscribe: > https://mailman.ucar.edu/mailman/listinfo/ncl-talk > -------------- next part -------------- An HTML attachment was scrubbed... URL: From brownrig at ucar.edu Tue Aug 13 11:51:38 2024 From: brownrig at ucar.edu (Rick Brownrigg) Date: Tue, 13 Aug 2024 11:51:38 -0600 Subject: [ncl-talk] contour map not showing colors In-Reply-To: References: Message-ID: Hi Tabish, I ran your script untouched on my Mac, and I got a plot with filled contours. But oddly enough, it had no labelling or contour lines!? I ran the script on my linux machine, and it came out perfect. Both plots are attached. I don't have a good explanation. I thought there might be a difference in the default resources specified in the .hluresfile, but that is not the case. We used to see an issue where plots didn't get fully flushed in laptops with Intel graphics hardware, but that's not the case here either. Both my Mac and linux machine have ncl installations via miniconda. I'm not sure what to advise here. Perhaps someone else may have some insights? I wish I had a better answer... Rick On Tue, Aug 13, 2024 at 10:02?AM Rick Brownrigg wrote: > Hi Tabish, > > I'm not seeing the problem -- it is indeed a straightforward script. If > you can send me that dataset, I'll take a closer look into it. > > Rick > > On Tue, Aug 13, 2024 at 9:49?AM Tabish Ansari via ncl-talk < > ncl-talk at mailman.ucar.edu> wrote: > >> Hi >> >> I have a cropped dataset over northern China from the CAMS Reanalyses >> product which contains 3-hourly PM2.5 concentrations for the year 2019. >> >> Here's the variable metadata: >> short pm2p5(time, latitude, longitude) ; >> pm2p5:scale_factor = 7.76424835780384e-11 ; >> pm2p5:add_offset = 2.54403361691801e-06 ; >> pm2p5:_FillValue = -32767s ; >> pm2p5:missing_value = -32767s ; >> pm2p5:units = "kg m**-3" ; >> pm2p5:long_name = "Particulate matter d < 2.5 um" ; >> pm2p5:standard_name = >> "mass_concentration_of_pm2p5_ambient_aerosol_particles_in_air" ; >> >> >> I've written a fairly straightforward NCL script just to plot the annual >> average PM2.5 concentration. It shows the map with contour lines and an >> appropriately ranged labelbar but with no colors within the map. >> Here's my script: >> >> ============================================================================== >> begin >> >> ;SOURCING FILES >> DIR = "/worknb/users/tans/Capstone-Maya/" >> a = addfile(DIR+"CAMSconc_3hourly_NCP2019.nc","r") >> >> >> ;READING DATA >> pm25NCP = short2flt(a->pm2p5) >> pm25NCP = pm25NCP * 10^9 >> pm25NCP = pm25NCP(:,::-1,:) ; flipping latitudes to correct the inverted >> data >> >> >> ;PREPARING TIME-AVERAGED DATA >> pm25NCPavg = dim_avg_n_Wrap(pm25NCP,0) >> printVarSummary(pm25NCPavg) >> printMinMax(pm25NCPavg,True) >> >> >> ;START THE GRAPHICS >> wks = gsn_open_wks("x11","NCPavgconc") >> res = True >> res at gsnMaximize = True ; Maximize plot in frame >> res at cnFillOn = True ; turn on color >> ;res at cnFillPalette = "MPL_Reds" ; set color map >> res at cnLinesOn = True ; turn contour lines on/off >> res at gsnAddCyclic = False >> res at mpFillOn = True >> >> ;SELECT NCP REGION FROM THE GLOBE >> res at mpProjection = "Mercator" >> res at mpLambertParallel1F = 30. >> res at mpLambertParallel2F = 40. >> res at mpLambertMeridianF = 115. >> >> res at mpLimitMode = "Corners" ; choose region of map >> res at mpLeftCornerLatF = 20. >> res at mpLeftCornerLonF = 100. >> res at mpRightCornerLatF = 50. >> res at mpRightCornerLonF = 130. >> >> plot = gsn_csm_contour_map(wks, pm25NCPavg, res) >> >> end >> =================================================================== >> >> >> The output of the script is as follows: >> Copyright (C) 1995-2019 - All Rights Reserved >> University Corporation for Atmospheric Research >> NCAR Command Language Version 6.6.2 >> The use of this software is governed by a License Agreement. >> See http://www.ncl.ucar.edu/ for more details. >> >> Variable: pm25NCPavg >> Type: float >> Total Size: 6724 bytes >> 1681 values >> Number of Dimensions: 2 >> Dimensions and sizes: [latitude | 41] x [longitude | 41] >> Coordinates: >> latitude: [20..50] >> longitude: [100..130] >> Number Of Attributes: 8 >> _FillValue : -32767 >> units : kg m**-3 >> long_name : Particulate matter d < 2.5 um >> standard_name : >> mass_concentration_of_pm2p5_ambient_aerosol_particles_in_air >> _FillValue_original : -32767 >> missing_value_original : -32767 >> missing_value : -32767 >> average_op_ncl : dim_avg_n over dimension(s): time >> (0) >> (0) Particulate matter d < 2.5 um (kg m**-3) : min=3.35468 >> max=205.552 >> >> >> >> And I have attached the resulting map as a png file. >> >> I'd really appreciate it if someone can point out what is needed for the >> plot to show the contour colors. >> >> Thanks a lot. >> >> best regards, >> >> Tabish >> >> >> -------------------------------------------------------------------------------------- >> Dr Tabish Ansari >> Research Associate >> Air Quality Modelling Group >> Research Institute for Sustainability (RIFS) - Helmholtz Centre Potsdam >> Potsdam, Germany >> _______________________________________________ >> ncl-talk mailing list >> ncl-talk at mailman.ucar.edu >> List instructions, subscriber options, unsubscribe: >> https://mailman.ucar.edu/mailman/listinfo/ncl-talk >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: plot_mac.png Type: image/png Size: 393381 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: plot_linux.png Type: image/png Size: 184048 bytes Desc: not available URL: From cliucv at connect.ust.hk Fri Aug 16 02:56:40 2024 From: cliucv at connect.ust.hk (LIU Chang) Date: Fri, 16 Aug 2024 08:56:40 +0000 Subject: [ncl-talk] question about windrose circles Message-ID: Dear all, I am encountering an issue when using a similar script to https://www.ncl.ucar.edu/Applications/Scripts/rose_5.ncl to plot a wind rose. The circles in the plot seem to appear randomly, with two or three circles being generated. [cid:9cc47b67-4deb-40ed-af5c-fd7467e92bfa] Could you please advise if there are any functions or settings that can ensure the number of circles, either two or three? Thank you for your assistance. Best regards, Chang -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image.png Type: image/png Size: 35136 bytes Desc: image.png URL: From barry.h.lynn at gmail.com Fri Aug 16 05:35:00 2024 From: barry.h.lynn at gmail.com (Barry Lynn) Date: Fri, 16 Aug 2024 14:35:00 +0300 Subject: [ncl-talk] Adding labels to markers Message-ID: Hello: I've been working on creating a 3 dimensional plot. It works fine (you can run it yourself), so far, but when I try to add letters to the Markers I can't get it to run. ChatGTP is stumped! Does someone have a suggestion? The line that doesn't work (or some permutation of it) is: gsn_text_ndc(wks, tostring(letters(i)), xy_proj(0), xy_proj(1), font_height) Thank you, Barry -- Barry H. Lynn, Ph.D Senior Scientist, Lecturer, The Institute of Earth Sciences, The Hebrew University of Jerusalem, Givat Ram, Jerusalem 91904, Israel Tel: 972 547 231 170 Fax: (972)-25662581 Weather It Is, LTD Weather and Climate Focus https://weather-it-is.com Jerusalem, Israel Local: 02 930 9525 Cell: 054 7 231 170 Int-IS: x972 2 930 9525 -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: experiment.ncl Type: application/octet-stream Size: 6560 bytes Desc: not available URL: From shea at ucar.edu Fri Aug 16 11:05:42 2024 From: shea at ucar.edu (Dennis Shea) Date: Fri, 16 Aug 2024 11:05:42 -0600 Subject: [ncl-talk] question about windrose circles In-Reply-To: References: Message-ID: *https://www.ncl.ucar.edu/Applications/rose.shtml * I have looked at the function code. %> less $NCARG_ROOT/lib/ncarg/nclscripts/csm/wind_rose.ncl === lines: dirFrMaxNumCircles = toint(dirFrMax/circFr +1.) dirFrMaxNum = circFr*dirFrMaxNumCircles ; number of circles === The following is untested .... Perhaps making a copy of 'wind_rose.ncl' a %> cp $NCARG_ROOT/lib/ncarg/nclscripts/csm/wind_rose.ncl wind_rose.liu_chang.ncl Then, make a modification to wind_rose.liu_chang.ncl such as dirFrMaxNumCircles = toint(dirFrMax/circFr +1.) ; dirFrMaxNum = circFr*dirFrMaxNumCircles ; number of circles < Comment dirFrMaxNum = 3 then use the new code via load "./wind_rose.liu_chang.ncl" Again ... this is untested. Good luck On Fri, Aug 16, 2024 at 2:56?AM LIU Chang via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > Dear all, > > I am encountering an issue when using a similar script to > https://www.ncl.ucar.edu/Applications/Scripts/rose_5.ncl to plot a wind > rose. The circles in the plot seem to appear randomly, with two or three > circles being generated. > > Could you please advise if there are any functions or settings that can > ensure the number of circles, either two or three? > Thank you for your assistance. > Best regards, > Chang > > > > _______________________________________________ > ncl-talk mailing list > ncl-talk at mailman.ucar.edu > List instructions, subscriber options, unsubscribe: > https://mailman.ucar.edu/mailman/listinfo/ncl-talk > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image.png Type: image/png Size: 35136 bytes Desc: not available URL: From cliucv at connect.ust.hk Fri Aug 16 11:47:48 2024 From: cliucv at connect.ust.hk (LIU Chang) Date: Fri, 16 Aug 2024 17:47:48 +0000 Subject: [ncl-talk] question about windrose circles In-Reply-To: References: Message-ID: Dear Dennis, Thanks for your assistance. I have tested the revised loading wind_rose.ncl. dirFrMaxNumCircles = 3 ;toint(dirFrMax/circFr +1.) dirFrMaxNum = circFr*dirFrMaxNumCircles ; number of circles < Comment Then, I get a confirm 3-circles windrose figure. Million thanks! Hope you have a good day! Best regards, Chang ________________________________ From: Dennis Shea Sent: Saturday, 17 August 2024 1:05 am To: LIU Chang Cc: ncl-talk at mailman.ucar.edu Subject: Re: [ncl-talk] question about windrose circles https://www.ncl.ucar.edu/Applications/rose.shtml I have looked at the function code. %> less $NCARG_ROOT/lib/ncarg/nclscripts/csm/wind_rose.ncl === lines: dirFrMaxNumCircles = toint(dirFrMax/circFr +1.) dirFrMaxNum = circFr*dirFrMaxNumCircles ; number of circles === The following is untested .... Perhaps making a copy of 'wind_rose.ncl' a %> cp $NCARG_ROOT/lib/ncarg/nclscripts/csm/wind_rose.ncl wind_rose.liu_chang.ncl Then, make a modification to wind_rose.liu_chang.ncl such as dirFrMaxNumCircles = toint(dirFrMax/circFr +1.) ; dirFrMaxNum = circFr*dirFrMaxNumCircles ; number of circles < Comment dirFrMaxNum = 3 then use the new code via load "./wind_rose.liu_chang.ncl" Again ... this is untested. Good luck On Fri, Aug 16, 2024 at 2:56?AM LIU Chang via ncl-talk > wrote: Dear all, I am encountering an issue when using a similar script to https://www.ncl.ucar.edu/Applications/Scripts/rose_5.ncl to plot a wind rose. The circles in the plot seem to appear randomly, with two or three circles being generated. [cid:ii_1915c1b06adcb971f161] Could you please advise if there are any functions or settings that can ensure the number of circles, either two or three? Thank you for your assistance. Best regards, Chang _______________________________________________ ncl-talk mailing list ncl-talk at mailman.ucar.edu List instructions, subscriber options, unsubscribe: https://mailman.ucar.edu/mailman/listinfo/ncl-talk -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image.png Type: image/png Size: 35136 bytes Desc: image.png URL: From asphilli at ucar.edu Fri Aug 16 12:35:21 2024 From: asphilli at ucar.edu (Adam Phillips) Date: Fri, 16 Aug 2024 12:35:21 -0600 Subject: [ncl-talk] Adding labels to markers In-Reply-To: References: Message-ID: Hi Barry, Thanks as always for sending an easy-to-run script. I put in a bunch of print statements, and it looks like your script fails on the 2nd call to tdprpt within the do loop. The values being passed to tdprpt are: (0) 0.5616955 (1) 0.4153071 (2) 0.06611873 and then the script core dumps. I unfortunately have zero experience using the tdprpt function and/or creating 3D graphics, so this is just an educated guess: I am guessing that those 3 values printed above are outside the range of valid coordinates. Beyond that general statement, I do not believe I can help any further. One other thing I noticed: You need to pass a resource list in as the last argument in gsn_text_ndc, as opposed to just passing a scalar. So something like this: tres = True tres at txFontHeightF = 0.02 gsn_text_ndc(wks, tostring(letters(i)), xy_proj(0), xy_proj(1), tres) Best, Adam On Fri, Aug 16, 2024 at 5:35?AM Barry Lynn via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > Hello: > > I've been working on creating a 3 dimensional plot. > > It works fine (you can run it yourself), so far, but when I try to add > letters to the Markers I can't get it to run. > > ChatGTP is stumped! > > Does someone have a suggestion? > > The line that doesn't work (or some permutation of it) > is: gsn_text_ndc(wks, tostring(letters(i)), xy_proj(0), xy_proj(1), > font_height) > > Thank you, > > Barry > > -- > > Barry H. Lynn, Ph.D > Senior Scientist, Lecturer, > The Institute of Earth Sciences, > The Hebrew University of Jerusalem, > Givat Ram, Jerusalem 91904, Israel > Tel: 972 547 231 170 > Fax: (972)-25662581 > > Weather It Is, LTD > Weather and Climate Focus > https://weather-it-is.com > Jerusalem, Israel > Local: 02 930 9525 > Cell: 054 7 231 170 > Int-IS: x972 2 930 9525 > > _______________________________________________ > ncl-talk mailing list > ncl-talk at mailman.ucar.edu > List instructions, subscriber options, unsubscribe: > https://mailman.ucar.edu/mailman/listinfo/ncl-talk > -- Adam Phillips Associate Scientist IV, Climate Analysis Section Climate and Global Dynamics Laboratory National Center for Atmospheric Research www.cgd.ucar.edu/staff/asphilli/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From rss1901 at gmail.com Tue Aug 20 01:40:49 2024 From: rss1901 at gmail.com (R Shrivastava) Date: Tue, 20 Aug 2024 13:10:49 +0530 Subject: [ncl-talk] Error in ncl script Message-ID: Respected Sir/Madam, While executing Example 1 on https://www.ncl.ucar.edu/Document/Functions/Built-in/ndtooned.shtml syntax error is encountered. Script is attached. Please help to resolve it. Thanks Warm Regards Roopashree -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ex10.ncl Type: application/octet-stream Size: 727 bytes Desc: not available URL: From jbuzan at purdue.edu Tue Aug 20 04:52:05 2024 From: jbuzan at purdue.edu (Jonathan Buzan) Date: Tue, 20 Aug 2024 10:52:05 +0000 Subject: [ncl-talk] Error in ncl script In-Reply-To: References: Message-ID: <573B38C6-EA4C-4310-A303-ADAE7269DD1C@purdue.edu> Hello Roopashree, Thanks for posting your script. It is better to post the specific line and error message that is blowing up the script. Most of the issues are resolved quickly this way. Usually, posting the whole script is only done when another person helping you requests to see the whole code block. Here are helpful guidelines: https://www.ncl.ucar.edu/Support/posting_guidelines.shtml Cheers, -Jonathan On Aug 20, 2024, at 09:40, R Shrivastava via ncl-talk > wrote: ---- External Email: Use caution with attachments, links, or sharing data ---- Respected Sir/Madam, While executing Example 1 on https://www.ncl.ucar.edu/Document/Functions/Built-in/ndtooned.shtml syntax error is encountered. Script is attached. Please help to resolve it. Thanks Warm Regards Roopashree _______________________________________________ ncl-talk mailing list ncl-talk at mailman.ucar.edu List instructions, subscriber options, unsubscribe: https://mailman.ucar.edu/mailman/listinfo/ncl-talk -------------- next part -------------- An HTML attachment was scrubbed... URL: From rss1901 at gmail.com Tue Aug 20 23:15:32 2024 From: rss1901 at gmail.com (R Shrivastava) Date: Wed, 21 Aug 2024 10:45:32 +0530 Subject: [ncl-talk] Error in ncl script In-Reply-To: <573B38C6-EA4C-4310-A303-ADAE7269DD1C@purdue.edu> References: <573B38C6-EA4C-4310-A303-ADAE7269DD1C@purdue.edu> Message-ID: Dear Sir, Thanks very much fir your reply. Following your suggestion, the exact error message is posted. Copyright (C) 1995-2019 - All Rights Reserved University Corporation for Atmospheric Research NCAR Command Language Version 6.6.2 The use of this software is governed by a License Agreement. See http://www.ncl.ucar.edu/ for more details. warning:unicode character encountered (?) fatal:syntax error: line 18 in file ex10.ncl before or near (/ a = (/ (/ ------------^ warning:unicode character encountered (?) warning:unicode character encountered (?) warning:unicode character encountered (?) warning:unicode character encountered (?) warning:unicode character encountered (?) warning:unicode character encountered (?) warning:unicode character encountered (?) fatal:Syntax Error in block, block not executed fatal:error at line 25 in file ex10.ncl Thanks again Warm Regards Roopashree On Tue, 20 Aug 2024 at 16:22, Jonathan Buzan wrote: > Hello Roopashree, > > Thanks for posting your script. > It is better to post the specific line and error message that is blowing > up the script. Most of the issues are resolved quickly this way. > Usually, posting the whole script is only done when another person helping > you requests to see the whole code block. > > Here are helpful guidelines: > https://www.ncl.ucar.edu/Support/posting_guidelines.shtml > > Cheers, > -Jonathan > > > > > > > On Aug 20, 2024, at 09:40, R Shrivastava via ncl-talk < > ncl-talk at mailman.ucar.edu> wrote: > > ---- *External Email*: Use caution with attachments, links, or sharing > data ---- > Respected Sir/Madam, > > While executing Example 1 on > https://www.ncl.ucar.edu/Document/Functions/Built-in/ndtooned.shtml > syntax error is encountered. > > Script is attached. Please help to resolve it. > > Thanks > Warm Regards > Roopashree > > > > _______________________________________________ > ncl-talk mailing list > ncl-talk at mailman.ucar.edu > List instructions, subscriber options, unsubscribe: > https://mailman.ucar.edu/mailman/listinfo/ncl-talk > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From dave.allured at noaa.gov Wed Aug 21 05:13:09 2024 From: dave.allured at noaa.gov (Dave Allured - NOAA Affiliate) Date: Wed, 21 Aug 2024 05:13:09 -0600 Subject: [ncl-talk] Error in ncl script In-Reply-To: References: <573B38C6-EA4C-4310-A303-ADAE7269DD1C@purdue.edu> Message-ID: Roopashree, thanks for posting the complete error message. That message contains an important clue. There are several invisible unicode characters that should not be there on line 18, in file *ex10.ncl*. Try deleting the unicode characters U+2060 (non-break zero space). Or else, delete line 18, and replace it with the same line, copied directly from example 1 on the *ndtooned* documentation page. When I copied the 3 lines directly from that website, that short example worked perfectly for me. The file *ex10.ncl* looks like an NCL prepared example script. Where exactly did you get that file? On Tue, Aug 20, 2024 at 11:15?PM R Shrivastava via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > Dear Sir, > Thanks very much fir your reply. Following your suggestion, the exact > error message is posted. > > Copyright (C) 1995-2019 - All Rights Reserved > University Corporation for Atmospheric Research > NCAR Command Language Version 6.6.2 > The use of this software is governed by a License Agreement. > See http://www.ncl.ucar.edu/ for more details. > warning:unicode character encountered (?) > fatal:syntax error: line 18 in file ex10.ncl before or near (/ > a = (/ (/ > ------------^ > > warning:unicode character encountered (?) > warning:unicode character encountered (?) > warning:unicode character encountered (?) > warning:unicode character encountered (?) > warning:unicode character encountered (?) > warning:unicode character encountered (?) > warning:unicode character encountered (?) > fatal:Syntax Error in block, block not executed > fatal:error at line 25 in file ex10.ncl > > Thanks again > Warm Regards > Roopashree > > > On Tue, 20 Aug 2024 at 16:22, Jonathan Buzan wrote: > >> Hello Roopashree, >> >> Thanks for posting your script. >> It is better to post the specific line and error message that is blowing >> up the script. Most of the issues are resolved quickly this way. >> Usually, posting the whole script is only done when another person >> helping you requests to see the whole code block. >> >> Here are helpful guidelines: >> https://www.ncl.ucar.edu/Support/posting_guidelines.shtml >> >> Cheers, >> -Jonathan >> >> On Aug 20, 2024, at 09:40, R Shrivastava via ncl-talk < >> ncl-talk at mailman.ucar.edu> wrote: >> >> Respected Sir/Madam, >> >> While executing Example 1 on >> https://www.ncl.ucar.edu/Document/Functions/Built-in/ndtooned.shtml >> syntax error is encountered. >> >> Script is attached. Please help to resolve it. >> >> Thanks >> Warm Regards >> Roopashree >> >> >> >> -------------- next part -------------- An HTML attachment was scrubbed... URL: From dave.allured at noaa.gov Wed Aug 21 06:05:20 2024 From: dave.allured at noaa.gov (Dave Allured - NOAA Affiliate) Date: Wed, 21 Aug 2024 06:05:20 -0600 Subject: [ncl-talk] Error in ncl script In-Reply-To: References: <573B38C6-EA4C-4310-A303-ADAE7269DD1C@purdue.edu> Message-ID: Problem solved. On Wed, Aug 21, 2024 at 5:31?AM R Shrivastava wrote: > Dear Sir, > Thanks very much for your reply. I deleted line 18 and typed it again. > Now its working perfectly. > Actually its not an NCL prepared script. I had copied and pasted from > website into a text editor. Maybe some unknown characters cropped in. > > Anyway thanks again, > Warm Regards > Roopashree > > > On Wed, 21 Aug 2024 at 16:43, Dave Allured - NOAA Affiliate < > dave.allured at noaa.gov> wrote: > >> Roopashree, thanks for posting the complete error message. That message >> contains an important clue. There are several invisible unicode characters >> that should not be there on line 18, in file *ex10.ncl*. >> >> Try deleting the unicode characters U+2060 (non-break zero space). Or >> else, delete line 18, and replace it with the same line, copied directly >> from example 1 on the *ndtooned* documentation page. When I copied the >> 3 lines directly from that website, that short example worked perfectly for >> me. >> >> The file *ex10.ncl* looks like an NCL prepared example script. Where >> exactly did you get that file? >> >> >> On Tue, Aug 20, 2024 at 11:15?PM R Shrivastava via ncl-talk < >> ncl-talk at mailman.ucar.edu> wrote: >> >>> Dear Sir, >>> Thanks very much fir your reply. Following your suggestion, the exact >>> error message is posted. >>> >>> Copyright (C) 1995-2019 - All Rights Reserved >>> University Corporation for Atmospheric Research >>> NCAR Command Language Version 6.6.2 >>> The use of this software is governed by a License Agreement. >>> See http://www.ncl.ucar.edu/ for more details. >>> warning:unicode character encountered (?) >>> fatal:syntax error: line 18 in file ex10.ncl before or near (/ >>> a = (/ (/ >>> ------------^ >>> >>> warning:unicode character encountered (?) >>> warning:unicode character encountered (?) >>> warning:unicode character encountered (?) >>> warning:unicode character encountered (?) >>> warning:unicode character encountered (?) >>> warning:unicode character encountered (?) >>> warning:unicode character encountered (?) >>> fatal:Syntax Error in block, block not executed >>> fatal:error at line 25 in file ex10.ncl >>> >>> Thanks again >>> Warm Regards >>> Roopashree >>> >>> >>> On Tue, 20 Aug 2024 at 16:22, Jonathan Buzan wrote: >>> >>>> Hello Roopashree, >>>> >>>> Thanks for posting your script. >>>> It is better to post the specific line and error message that is >>>> blowing up the script. Most of the issues are resolved quickly this way. >>>> Usually, posting the whole script is only done when another person >>>> helping you requests to see the whole code block. >>>> >>>> Here are helpful guidelines: >>>> https://www.ncl.ucar.edu/Support/posting_guidelines.shtml >>>> >>>> Cheers, >>>> -Jonathan >>>> >>>> On Aug 20, 2024, at 09:40, R Shrivastava via ncl-talk < >>>> ncl-talk at mailman.ucar.edu> wrote: >>>> >>>> Respected Sir/Madam, >>>> >>>> While executing Example 1 on >>>> https://www.ncl.ucar.edu/Document/Functions/Built-in/ndtooned.shtml >>>> syntax error is encountered. >>>> >>>> Script is attached. Please help to resolve it. >>>> >>>> Thanks >>>> Warm Regards >>>> Roopashree >>>> >>>> >>>> >>>> -------------- next part -------------- An HTML attachment was scrubbed... URL: From tabishumaransari at gmail.com Wed Aug 21 07:30:36 2024 From: tabishumaransari at gmail.com (Tabish Ansari) Date: Wed, 21 Aug 2024 15:30:36 +0200 Subject: [ncl-talk] Inconsistency in dimension averaging using dim_avg_n Message-ID: Hello, I've got a 3D variable called "monthlypm25NCP". It has 12 timesteps and 41 lat x 41 lon values. Here's the variable summary: Variable: monthlypm25NCP Type: float Total Size: 80688 bytes 20172 values Number of Dimensions: 3 Dimensions and sizes: [12] x [41] x [41] Coordinates: Number Of Attributes: 1 _FillValue : 9.96921e+36 Since this is a derived variable from another 3-hourly variable, the coordinate arrays are not retained. (I could have copied them over but I didn't in this instance.) Now, I want to average this 3D variable over the lat-lon grid to reduce it to a 1D variable containing only 12 values (one for each month). I tried using the dim_avg_n in two different ways to achieve this: *1. In 2-steps: * monthlypm25NCPsum1= dim_avg_n(monthlypm25NCP, 2) monthlypm25NCPsum = dim_avg_n(monthlypm25NCPsum1, 1) print(monthlypm25NCPsum+"") Result: (0) 167.83 (1) 150.403 (2) 124.87 (3) 102.86 (4) 90.6969 (5) 80.4786 (6) 75.9811 (7) 71.1969 (8) 93.9213 (9) 117.72 (10) 136.6 (11) 139.528 *2. In a single step:* monthlypm25NCPsum = dim_avg_n(monthlypm25NCP, (/1,2/)) print(monthlypm25NCPsum+"") Result: (0) 155.3 (1) 140.645 (2) 116.423 (3) 96.4202 (4) 84.4638 (5) 76.3392 (6) 72.5972 (7) 67.5716 (8) 88.2773 (9) 110.789 (10) 129.426 (11) 131.247 I was expecting the results to be identical but strangely they're not, as you can see above. Can you please explain what's causing the difference here? Is it possible that in the second case, the dim_avg_n function is recognizing the lat-lon grid and using a weighted averaging based on actual grid area? But how can it recognize that when I have not included the coordinate arrays? Ultimately, I do want to perform a weighted averaging over the lat-lon grid and have obtained a separate matrix that contains gridcell area (I used the cdo tool to obtain it). Should I do a sparse matrix multiplication with the gridcell area before performing the grid averaging in NCL or does the dim_avg_n function take care of the grid area itself? Thanks Tabish -------------------------------------------------------------------------------------- Dr Tabish Ansari Research Associate Air Quality Modelling Group Research Institute for Sustainability (RIFS) - Helmholtz Centre Potsdam Potsdam, Germany -------------- next part -------------- An HTML attachment was scrubbed... URL: From dave.allured at noaa.gov Wed Aug 21 09:12:39 2024 From: dave.allured at noaa.gov (Dave Allured - NOAA Affiliate) Date: Wed, 21 Aug 2024 09:12:39 -0600 Subject: [ncl-talk] Inconsistency in dimension averaging using dim_avg_n In-Reply-To: References: Message-ID: Tabish, the differing results may be caused by missing values in your array, resulting in unequal weighting of the remaining values in 2-step averaging. This is basic math, not a particular NCL behavior. Offhand I would say that the single step method is the only correct method here. No, dim_avg_n never performs a weighted average, whether or not coordinate arrays are included. As the documentation says, missing values are properly excluded from each individual averaging calculation. Perhaps someone else can comment on the best way to perform a spatial weighted average. On Wed, Aug 21, 2024 at 7:31?AM Tabish Ansari via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > Hello, > > I've got a 3D variable called "monthlypm25NCP". It has 12 timesteps and 41 > lat x 41 lon values. > > Here's the variable summary: > Variable: monthlypm25NCP > Type: float > Total Size: 80688 bytes > 20172 values > Number of Dimensions: 3 > Dimensions and sizes: [12] x [41] x [41] > Coordinates: > Number Of Attributes: 1 > _FillValue : 9.96921e+36 > > Since this is a derived variable from another 3-hourly variable, the > coordinate arrays are not retained. (I could have copied them over but I > didn't in this instance.) > > Now, I want to average this 3D variable over the lat-lon grid to reduce it > to a 1D variable containing only 12 values (one for each month). > > I tried using the dim_avg_n in two different ways to achieve this: > > *1. In 2-steps: * > monthlypm25NCPsum1= dim_avg_n(monthlypm25NCP, 2) > monthlypm25NCPsum = dim_avg_n(monthlypm25NCPsum1, 1) > print(monthlypm25NCPsum+"") > > Result: > (0) 167.83 > (1) 150.403 > (2) 124.87 > (3) 102.86 > (4) 90.6969 > (5) 80.4786 > (6) 75.9811 > (7) 71.1969 > (8) 93.9213 > (9) 117.72 > (10) 136.6 > (11) 139.528 > > *2. In a single step:* > monthlypm25NCPsum = dim_avg_n(monthlypm25NCP, (/1,2/)) > print(monthlypm25NCPsum+"") > > Result: > (0) 155.3 > (1) 140.645 > (2) 116.423 > (3) 96.4202 > (4) 84.4638 > (5) 76.3392 > (6) 72.5972 > (7) 67.5716 > (8) 88.2773 > (9) 110.789 > (10) 129.426 > (11) 131.247 > > I was expecting the results to be identical but strangely they're not, as > you can see above. > > Can you please explain what's causing the difference here? > > Is it possible that in the second case, the dim_avg_n function is > recognizing the lat-lon grid and using a weighted averaging based on actual > grid area? But how can it recognize that when I have not included the > coordinate arrays? > > Ultimately, I do want to perform a weighted averaging over the lat-lon > grid and have obtained a separate matrix that contains gridcell area (I > used the cdo tool to obtain it). Should I do a sparse matrix multiplication > with the gridcell area before performing the grid averaging in NCL or does > the dim_avg_n function take care of the grid area itself? > > Thanks > Tabish > > -------------------------------------------------------------------------------------- > Dr Tabish Ansari > Research Associate > Air Quality Modelling Group > Research Institute for Sustainability (RIFS) - Helmholtz Centre Potsdam > Potsdam, Germany > -------------- next part -------------- An HTML attachment was scrubbed... URL: From tabishumaransari at gmail.com Wed Aug 21 09:58:48 2024 From: tabishumaransari at gmail.com (Tabish Ansari) Date: Wed, 21 Aug 2024 17:58:48 +0200 Subject: [ncl-talk] Inconsistency in dimension averaging using dim_avg_n In-Reply-To: References: Message-ID: Hi Dave, Thanks a lot for the insightful explanation. Yes, there are many missing values within the dataset. As a test, I performed manual averaging by using three nested loops (over each dimension) and summed the non-missing values while also counting the non-missing instances. The final result matched with the single step dim_avg_n result (I included coordinate arrays this time). This also confirmed that there is no built-in area-weighting in the dim_avg_n function. So, I then multiplied the data with a corresponding 2D array of weighting fractions that I had generated separately (these were just normalized areas per gridcell) before performing the single step dim_avg_n operation. Thanks again, and hope that this discussion is useful for other users in the future. best regards, Tabish -------------------------------------------------------------------------------------- Dr Tabish Ansari Research Associate Air Quality Modelling Group Research Institute for Sustainability (RIFS) - Helmholtz Centre Potsdam Potsdam, Germany On Wed, 21 Aug 2024 at 17:13, Dave Allured - NOAA Affiliate < dave.allured at noaa.gov> wrote: > Tabish, the differing results may be caused by missing values in your > array, resulting in unequal weighting of the remaining values in 2-step > averaging. This is basic math, not a particular NCL behavior. Offhand I > would say that the single step method is the only correct method here. > > No, dim_avg_n never performs a weighted average, whether or not coordinate > arrays are included. As the documentation says, missing values are > properly excluded from each individual averaging calculation. > > Perhaps someone else can comment on the best way to perform a spatial > weighted average. > > > On Wed, Aug 21, 2024 at 7:31?AM Tabish Ansari via ncl-talk < > ncl-talk at mailman.ucar.edu> wrote: > >> Hello, >> >> I've got a 3D variable called "monthlypm25NCP". It has 12 timesteps and >> 41 lat x 41 lon values. >> >> Here's the variable summary: >> Variable: monthlypm25NCP >> Type: float >> Total Size: 80688 bytes >> 20172 values >> Number of Dimensions: 3 >> Dimensions and sizes: [12] x [41] x [41] >> Coordinates: >> Number Of Attributes: 1 >> _FillValue : 9.96921e+36 >> >> Since this is a derived variable from another 3-hourly variable, the >> coordinate arrays are not retained. (I could have copied them over but I >> didn't in this instance.) >> >> Now, I want to average this 3D variable over the lat-lon grid to reduce >> it to a 1D variable containing only 12 values (one for each month). >> >> I tried using the dim_avg_n in two different ways to achieve this: >> >> *1. In 2-steps: * >> monthlypm25NCPsum1= dim_avg_n(monthlypm25NCP, 2) >> monthlypm25NCPsum = dim_avg_n(monthlypm25NCPsum1, 1) >> print(monthlypm25NCPsum+"") >> >> Result: >> (0) 167.83 >> (1) 150.403 >> (2) 124.87 >> (3) 102.86 >> (4) 90.6969 >> (5) 80.4786 >> (6) 75.9811 >> (7) 71.1969 >> (8) 93.9213 >> (9) 117.72 >> (10) 136.6 >> (11) 139.528 >> >> *2. In a single step:* >> monthlypm25NCPsum = dim_avg_n(monthlypm25NCP, (/1,2/)) >> print(monthlypm25NCPsum+"") >> >> Result: >> (0) 155.3 >> (1) 140.645 >> (2) 116.423 >> (3) 96.4202 >> (4) 84.4638 >> (5) 76.3392 >> (6) 72.5972 >> (7) 67.5716 >> (8) 88.2773 >> (9) 110.789 >> (10) 129.426 >> (11) 131.247 >> >> I was expecting the results to be identical but strangely they're not, as >> you can see above. >> >> Can you please explain what's causing the difference here? >> >> Is it possible that in the second case, the dim_avg_n function is >> recognizing the lat-lon grid and using a weighted averaging based on actual >> grid area? But how can it recognize that when I have not included the >> coordinate arrays? >> >> Ultimately, I do want to perform a weighted averaging over the lat-lon >> grid and have obtained a separate matrix that contains gridcell area (I >> used the cdo tool to obtain it). Should I do a sparse matrix multiplication >> with the gridcell area before performing the grid averaging in NCL or does >> the dim_avg_n function take care of the grid area itself? >> >> Thanks >> Tabish >> >> -------------------------------------------------------------------------------------- >> Dr Tabish Ansari >> Research Associate >> Air Quality Modelling Group >> Research Institute for Sustainability (RIFS) - Helmholtz Centre Potsdam >> Potsdam, Germany >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: