From asphilli at ucar.edu Mon Apr 3 16:01:11 2023 From: asphilli at ucar.edu (Adam Phillips) Date: Mon, 3 Apr 2023 16:01:11 -0600 Subject: [ncl-talk] taylor_diagram question In-Reply-To: References: Message-ID: Hi Tao, I believe you corresponded with someone offline about this. I have some experience modifying the taylor_diagram function, but I have not done what you are looking for so I can only offer recommendations. You will likely need to make several attempts getting all the resources set the way you want; hopefully your test script runs quickly! To answer your 3 questions: 1 - Yes. 2 - I believe this is possible. Steps required: - Copy the taylor_diagram.ncl code, and saving it as (say) taylor_diagram_2.ncl. - Alter the function name at the top to taylor_diagram_2 (at line one of taylor_diagram_2.ncl). - In your new function, go to the section entitled "Part 3". You will see a resource list that is initiated 5 lines beneath "Part 3" named respl. I would try adding the following resource settings *beneath* the current respl resource settings: respl at gsLineDashSegLenF = 0.30. ; Controls spacing between line labels; this setting will require some trial and error. respl at gsLineLabelFontColor = respl at gsLineColor respl at gsLineLabelFontHeightF = 0.0125. ; this font height setting might need adjustment - Then, within the "do n-1,ncon" do loop, you will need to tell NCL how to label the lines, so try this: do n=1,ncon rr = n*dx res at gsLineLabelString = rr. ; add this line That should do it. As I stated in the comments above, you will likely need to adjust the setting for gsLineDashSegLenF and gsLineLabelFontHeightF. 3 - Yes. Search within the function for the resource "gsLineColor". You can adjust these as needed. Hope that helps! Adam On Sat, Mar 25, 2023 at 3:00?PM Tao Zhang via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > Hi, > > I can reproduce the taylor_4 figure using the sample script in > > https://www.ncl.ucar.edu/Applications/Images/taylor_4_1_lg.png > > https://www.ncl.ucar.edu/Applications/Scripts/taylor_4.ncl > > But I want Figure 1 in > > > https://en.wikipedia.org/wiki/Taylor_diagram#:~:text=Taylor%20diagrams%20are%20mathematical%20diagrams,comparative%20assessment%20of%20different%20models > > Which shows the standard deviation (0~4 mm/day), not the standardized > deviations (normalized) (0-1.5). > > 1) May I only change the taylor_4.ncl for my purpose, but keep the > loaded "taylor_diagram.ncl" unchanged? > > 2) How to add "observed value" in the Taylor diagram as shown in Figure > 1 in above link? > > 3) How to change the color in 3 lines of standard deviation, > correlation, and RMS? > > Thanks > > Tao > > > _______________________________________________ > 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 tao.zhang at colorado.edu Tue Apr 4 12:30:30 2023 From: tao.zhang at colorado.edu (Tao Zhang) Date: Tue, 4 Apr 2023 12:30:30 -0600 Subject: [ncl-talk] taylor_diagram question In-Reply-To: References: Message-ID: <65c20126-6087-b2c2-db8f-5dcbc29c7ef0@colorado.edu> Hi Adam, ?Thanks for your great recommendations. ?1) Dennis Shea mentioned that the Taylor diagram listed in NCL website is hard-coded for normalized standard deviation, not for standard deviation ?as shown in previous link I provided, right? ?2) How to remove the "0.75" "1" labels close to correlation value? I just want to keep one. Is possible to ?? add "0.25"?? see attached plot. ?Thanks ?Tao On 4/3/23 4:01 PM, Adam Phillips wrote: > Hi Tao, > I believe you corresponded with someone offline about this. I have > some experience modifying the taylor_diagram function, but I have not > done what you are looking for so I can only offer recommendations. You > will likely need to make several attempts?getting all the resources > set the way you want; hopefully your test script runs quickly! > > To answer your 3 questions: > 1 - Yes. > 2 - I believe this is possible. Steps required: > ? ?- Copy the taylor_diagram.ncl > ?code, > and saving it as (say) taylor_diagram_2.ncl. > ? ?- Alter the function name at the top to taylor_diagram_2 (at line > one of taylor_diagram_2.ncl). > ? ?- In your new function, go to the section entitled "Part 3". You > will see a resource list that is initiated 5 lines beneath "Part 3" > named respl. I would?try adding the following resource settings > *beneath* the current respl resource settings: > ? ? ?respl at gsLineDashSegLenF = 0.30.? ?; Controls spacing between line > labels; this setting will require some trial and error. > ? ? ?respl at gsLineLabelFontColor = respl at gsLineColor > ? ? ?respl at gsLineLabelFontHeightF =?0.0125.? ?; this font height > setting might need adjustment > > ? - Then, within the "do n-1,ncon" do loop, you will need to tell NCL > how to label the lines, so try this: > ? ? ? do n=1,ncon > ? ? ? ? ? ?rr ?= n*dx > ? ? ? ? ? ?res at gsLineLabelString = rr.? ?; add this line > > That should do it. As I stated in the comments above, you will likely > need to adjust the setting for gsLineDashSegLenF and > gsLineLabelFontHeightF. > > 3 - Yes. Search within the function for the resource "gsLineColor". > You can adjust these as needed. > > Hope that helps! > Adam > > On Sat, Mar 25, 2023 at 3:00?PM Tao Zhang via ncl-talk > wrote: > > Hi, > > ??I can reproduce the taylor_4 figure using the sample script in > > https://www.ncl.ucar.edu/Applications/Images/taylor_4_1_lg.png > > https://www.ncl.ucar.edu/Applications/Scripts/taylor_4.ncl > > But I want? Figure 1 in > > https://en.wikipedia.org/wiki/Taylor_diagram#:~:text=Taylor%20diagrams%20are%20mathematical%20diagrams,comparative%20assessment%20of%20different%20models > > Which shows the standard deviation (0~4 mm/day), not the standardized > deviations (normalized) (0-1.5). > > 1) May I only change the taylor_4.ncl for my purpose, but keep the > loaded "taylor_diagram.ncl" unchanged? > > 2) How to add "observed value" in the Taylor diagram as shown in > Figure > 1 in above link? > > 3) How to change the color in 3 lines of standard deviation, > correlation, and RMS? > > Thanks > > Tao > > > _______________________________________________ > 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: -------------- next part -------------- A non-text attachment was scrubbed... Name: taylor_GFSv2amip.GFSFV3amip.t2m.precip.cli.1991-2020.ann.globe.tropics.Contiguous_US.png Type: image/png Size: 49915 bytes Desc: not available URL: From zmumba at gmail.com Tue Apr 4 13:30:02 2023 From: zmumba at gmail.com (Zilore Mumba) Date: Tue, 4 Apr 2023 21:30:02 +0200 Subject: [ncl-talk] Blank graphics in ncl Message-ID: Hello NCL users, I have a peculiar problem which I have no clue where it might come from. On my ubuntu 18.04 where I have run ncl for years, the graphics are fine as shown in the attached image TTIMap2.png. On a newly installed ubuntu 20.04 the very same script which produces TTIMap2.png produces TTIMap.png which instead of shading produces contours. Other scripts produce completely blank graphics on ubuntu-20.04 platform, whileas the the graphics from the same script on ubuntu18 platform are just fine. My only guess is that perhaps tinkering with the .hluresfile may resolve my problem. However I have never worked with the .hluresfile. I wii appreciate help on this. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: TTIMap2.png Type: image/png Size: 77787 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: TTIMap.png Type: image/png Size: 84843 bytes Desc: not available URL: From jonasperosa01 at gmail.com Tue Apr 4 13:42:41 2023 From: jonasperosa01 at gmail.com (jonas perosa) Date: Tue, 4 Apr 2023 16:42:41 -0300 Subject: [ncl-talk] (no subject) Message-ID: Hq. Tv naf.p -------------- next part -------------- An HTML attachment was scrubbed... URL: From brownrig at ucar.edu Tue Apr 4 14:12:36 2023 From: brownrig at ucar.edu (Rick Brownrigg) Date: Tue, 4 Apr 2023 14:12:36 -0600 Subject: [ncl-talk] Blank graphics in ncl In-Reply-To: References: Message-ID: Hi Zilore, As an aside -- the colorbars in the two plots appear to be different. Does this script in question explicitly specify a colormap, or is it just using the default? Is the .hluresfile on your 18.04 system substantially different from the one on the 20.04 system? Is there even such a file on the new 20.04 system? Perhaps copy the one from 18.04 over to your new system? No error messages from NCL about "can't find colormaps"? A sort of default .hluresfile can be found here; there's nothing in it that would account for the plot you are seeing: https://www.ncl.ucar.edu/Document/Graphics/hlures.shtml Rick On Tue, Apr 4, 2023 at 1:30?PM Zilore Mumba via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > Hello NCL users, > I have a peculiar problem which I have no clue where it might come from. > On my ubuntu 18.04 where I have run ncl for years, the graphics are fine as > shown in the attached image TTIMap2.png. On a newly installed ubuntu 20.04 > the very same script which produces TTIMap2.png produces TTIMap.png which > instead of shading produces contours. Other scripts produce completely > blank graphics on ubuntu-20.04 platform, whileas the the graphics from the > same script on ubuntu18 platform are just fine. > My only guess is that perhaps tinkering with the .hluresfile may resolve > my problem. However I have never worked with the .hluresfile. > I wii appreciate help on this. > _______________________________________________ > 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 asphilli at ucar.edu Tue Apr 4 15:04:40 2023 From: asphilli at ucar.edu (Adam Phillips) Date: Tue, 4 Apr 2023 15:04:40 -0600 Subject: [ncl-talk] taylor_diagram question In-Reply-To: <65c20126-6087-b2c2-db8f-5dcbc29c7ef0@colorado.edu> References: <65c20126-6087-b2c2-db8f-5dcbc29c7ef0@colorado.edu> Message-ID: Hi Tao, 1 - Dennis is correct. The Y-axis is hard coded for normalized standard deviations. You can pass in whatever values you want to the taylor_diagram function, but the Y-axis will stay the same. You can alter this in the function code, but, you will also have to alter the coding for the drawing of the concentric rings, and that might be difficult. 2 - You cannot precisely positionally set the ring labels using the method I detailed. If you want to exactly specify where the labels appear, you would abandon the approach I recommended (with modifying the respl resource list) and instead add 4 new gsn_add_text calls (one for each green ring). As to why the 0.25 label does not appear: I am guessing that your value of gsLineDashSegLenF is too large. If you set that resource to a smaller value I would gather that the 0.25 label will appear, but also additional labels will appear on the other rings. You can alter the setting of this resource for each iteration of the do loop (similar to how you are altering the setting of gsLineLabelString). Adam On Tue, Apr 4, 2023 at 12:30?PM Tao Zhang wrote: > Hi Adam, > > Thanks for your great recommendations. > > 1) Dennis Shea mentioned that the Taylor diagram listed in NCL website is > hard-coded for normalized standard deviation, not for standard deviation > as shown in previous link I provided, right? > > 2) How to remove the "0.75" "1" labels close to correlation value? I just > want to keep one. Is possible to > add "0.25"? see attached plot. > > Thanks > Tao > > > On 4/3/23 4:01 PM, Adam Phillips wrote: > > Hi Tao, > I believe you corresponded with someone offline about this. I have some > experience modifying the taylor_diagram function, but I have not done what > you are looking for so I can only offer recommendations. You will likely > need to make several attempts getting all the resources set the way you > want; hopefully your test script runs quickly! > > To answer your 3 questions: > 1 - Yes. > 2 - I believe this is possible. Steps required: > - Copy the taylor_diagram.ncl > code, > and saving it as (say) taylor_diagram_2.ncl. > - Alter the function name at the top to taylor_diagram_2 (at line one > of taylor_diagram_2.ncl). > - In your new function, go to the section entitled "Part 3". You will > see a resource list that is initiated 5 lines beneath "Part 3" named respl. > I would try adding the following resource settings *beneath* the current > respl resource settings: > respl at gsLineDashSegLenF = 0.30. ; Controls spacing between line > labels; this setting will require some trial and error. > respl at gsLineLabelFontColor = respl at gsLineColor > respl at gsLineLabelFontHeightF = 0.0125. ; this font height setting > might need adjustment > > - Then, within the "do n-1,ncon" do loop, you will need to tell NCL how > to label the lines, so try this: > do n=1,ncon > rr = n*dx > res at gsLineLabelString = rr. ; add this line > > That should do it. As I stated in the comments above, you will likely need > to adjust the setting for gsLineDashSegLenF and gsLineLabelFontHeightF. > > 3 - Yes. Search within the function for the resource "gsLineColor". You > can adjust these as needed. > > Hope that helps! > Adam > > On Sat, Mar 25, 2023 at 3:00?PM Tao Zhang via ncl-talk < > ncl-talk at mailman.ucar.edu> wrote: > >> Hi, >> >> I can reproduce the taylor_4 figure using the sample script in >> >> https://www.ncl.ucar.edu/Applications/Images/taylor_4_1_lg.png >> >> https://www.ncl.ucar.edu/Applications/Scripts/taylor_4.ncl >> >> But I want Figure 1 in >> >> >> https://en.wikipedia.org/wiki/Taylor_diagram#:~:text=Taylor%20diagrams%20are%20mathematical%20diagrams,comparative%20assessment%20of%20different%20models >> >> Which shows the standard deviation (0~4 mm/day), not the standardized >> deviations (normalized) (0-1.5). >> >> 1) May I only change the taylor_4.ncl for my purpose, but keep the >> loaded "taylor_diagram.ncl" unchanged? >> >> 2) How to add "observed value" in the Taylor diagram as shown in Figure >> 1 in above link? >> >> 3) How to change the color in 3 lines of standard deviation, >> correlation, and RMS? >> >> Thanks >> >> Tao >> >> >> _______________________________________________ >> 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/ > > > -- 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 zmumba at gmail.com Tue Apr 4 15:11:03 2023 From: zmumba at gmail.com (Zilore Mumba) Date: Tue, 4 Apr 2023 23:11:03 +0200 Subject: [ncl-talk] Blank graphics in ncl In-Reply-To: References: Message-ID: Rick, The scripts are exactly the same except the data path. The same .hluresfile is used for both scripts. There is no error message, but on other scripts I get the error that the values are out of the range specified by ExplcitLevels. I attach the script and the .hluresfile which is the same as the on the link you gave On Tue, Apr 4, 2023 at 10:12?PM Rick Brownrigg wrote: > Hi Zilore, > > As an aside -- the colorbars in the two plots appear to be different. Does > this script in question explicitly specify a colormap, or is it just using > the default? > > Is the .hluresfile on your 18.04 system substantially different from the > one on the 20.04 system? Is there even such a file on the new 20.04 > system? Perhaps copy the one from 18.04 over to your new system? No error > messages from NCL about "can't find colormaps"? > > A sort of default .hluresfile can be found here; there's nothing in it > that would account for the plot you are seeing: > > https://www.ncl.ucar.edu/Document/Graphics/hlures.shtml > > Rick > > > On Tue, Apr 4, 2023 at 1:30?PM Zilore Mumba via ncl-talk < > ncl-talk at mailman.ucar.edu> wrote: > >> Hello NCL users, >> I have a peculiar problem which I have no clue where it might come from. >> On my ubuntu 18.04 where I have run ncl for years, the graphics are fine as >> shown in the attached image TTIMap2.png. On a newly installed ubuntu 20.04 >> the very same script which produces TTIMap2.png produces TTIMap.png which >> instead of shading produces contours. Other scripts produce completely >> blank graphics on ubuntu-20.04 platform, whileas the the graphics from the >> same script on ubuntu18 platform are just fine. >> My only guess is that perhaps tinkering with the .hluresfile may resolve >> my problem. However I have never worked with the .hluresfile. >> I wii appreciate help on this. >> _______________________________________________ >> 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: TotalTotals.ncl Type: application/octet-stream Size: 6401 bytes Desc: not available URL: From tao.zhang at colorado.edu Tue Apr 4 16:34:32 2023 From: tao.zhang at colorado.edu (Tao Zhang) Date: Tue, 4 Apr 2023 16:34:32 -0600 Subject: [ncl-talk] taylor_diagram question In-Reply-To: References: <65c20126-6087-b2c2-db8f-5dcbc29c7ef0@colorado.edu> Message-ID: <96947efc-c3a9-fc24-6b6b-a9b8bdd7f487@colorado.edu> Hi Adam, ?Thanks for your helpful suggestions. ?Yes. Decreasing the value of gsLineDashSegLenF can show the 0.25 label but cause much more other labels. ?Instead, Increasing the value can help to reduce so much labels. ?Attached plot is accepted result now. ?Thanks ?Tao On 4/4/23 3:04 PM, Adam Phillips wrote: > Hi Tao, > 1 - Dennis is correct. The Y-axis is hard coded for normalized > standard deviations. You can pass in whatever values you want to the > taylor_diagram function, but the Y-axis will stay the same. You can > alter this in the function code, but, you will also have to alter the > coding for the drawing of the concentric rings, and that might be > difficult. > 2 - You cannot precisely positionally set the ring labels using the > method I detailed. If you want to exactly specify where the labels > appear, you would abandon the approach I recommended (with modifying > the respl resource list) and instead add 4 new gsn_add_text calls (one > for each green ring). As to why the 0.25 label does not appear: I am > guessing that your value of gsLineDashSegLenF is too large. If you set > that resource to a smaller value I would gather that the 0.25 label > will appear, but also additional labels will appear on the other > rings. You can alter the setting of this resource for each iteration > of the do loop (similar to how you are altering the setting of > gsLineLabelString). > Adam > > On Tue, Apr 4, 2023 at 12:30?PM Tao Zhang wrote: > > Hi Adam, > > ?Thanks for your great recommendations. > > ?1) Dennis Shea mentioned that the Taylor diagram listed in NCL > website is hard-coded for normalized standard deviation, not for > standard deviation > ?as shown in previous link I provided, right? > > ?2) How to remove the "0.75" "1" labels close to correlation > value? I just want to keep one. Is possible to > ?? add "0.25"?? see attached plot. > > ?Thanks > ?Tao > > > On 4/3/23 4:01 PM, Adam Phillips wrote: >> Hi Tao, >> I believe you corresponded with someone offline about this. I >> have some experience modifying the taylor_diagram function, but I >> have not done what you are looking for so I can only offer >> recommendations. You will likely need to make several >> attempts?getting all the resources set the way you want; >> hopefully your test script runs quickly! >> >> To answer your 3 questions: >> 1 - Yes. >> 2 - I believe this is possible. Steps required: >> ? ?- Copy the taylor_diagram.ncl >> ?code, >> and saving it as (say) taylor_diagram_2.ncl. >> ? ?- Alter the function name at the top to taylor_diagram_2 (at >> line one of taylor_diagram_2.ncl). >> ? ?- In your new function, go to the section entitled "Part 3". >> You will see a resource list that is initiated 5 lines beneath >> "Part 3" named respl. I would?try adding the following resource >> settings *beneath* the current respl resource settings: >> ? ? ?respl at gsLineDashSegLenF = 0.30.? ?; Controls spacing between >> line labels; this setting will require some trial and error. >> ? ? ?respl at gsLineLabelFontColor = respl at gsLineColor >> ? ? ?respl at gsLineLabelFontHeightF =?0.0125.? ?; this font height >> setting might need adjustment >> >> ? - Then, within the "do n-1,ncon" do loop, you will need to tell >> NCL how to label the lines, so try this: >> ? ? ? do n=1,ncon >> ? ? ? ? ? ?rr ?= n*dx >> ? ? ? ? ? ?res at gsLineLabelString = rr.? ?; add this line >> >> That should do it. As I stated in the comments above, you will >> likely need to adjust the setting for gsLineDashSegLenF and >> gsLineLabelFontHeightF. >> >> 3 - Yes. Search within the function for the resource >> "gsLineColor". You can adjust these as needed. >> >> Hope that helps! >> Adam >> >> On Sat, Mar 25, 2023 at 3:00?PM Tao Zhang via ncl-talk >> wrote: >> >> Hi, >> >> ??I can reproduce the taylor_4 figure using the sample script in >> >> https://www.ncl.ucar.edu/Applications/Images/taylor_4_1_lg.png >> >> https://www.ncl.ucar.edu/Applications/Scripts/taylor_4.ncl >> >> But I want? Figure 1 in >> >> https://en.wikipedia.org/wiki/Taylor_diagram#:~:text=Taylor%20diagrams%20are%20mathematical%20diagrams,comparative%20assessment%20of%20different%20models >> >> Which shows the standard deviation (0~4 mm/day), not the >> standardized >> deviations (normalized) (0-1.5). >> >> 1) May I only change the taylor_4.ncl for my purpose, but >> keep the >> loaded "taylor_diagram.ncl" unchanged? >> >> 2) How to add "observed value" in the Taylor diagram as shown >> in Figure >> 1 in above link? >> >> 3) How to change the color in 3 lines of standard deviation, >> correlation, and RMS? >> >> Thanks >> >> Tao >> >> >> _______________________________________________ >> 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/ >> >> > > > > -- > 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: -------------- next part -------------- A non-text attachment was scrubbed... Name: taylor_GFSv2amip.GFSFV3amip.t2m.precip.cli.1991-2020.ann.globe.tropics.Contiguous_US.png Type: image/png Size: 49893 bytes Desc: not available URL: From zmumba at gmail.com Tue Apr 4 23:36:41 2023 From: zmumba at gmail.com (Zilore Mumba) Date: Wed, 5 Apr 2023 07:36:41 +0200 Subject: [ncl-talk] Blank graphics in ncl In-Reply-To: References: Message-ID: Rick, I have attached to this mail, 1) the script which produces the graphics, 2) the two png's by the same script but on different platforms and 3) the .hluresfile which is on both machines. In the attached .hluresfile I have removed the dot at the beginning of the file name, but the dot is there in the running copy. Thanks for your time. On Tue, Apr 4, 2023 at 11:43?PM Rick Brownrigg wrote: > Zilore, is that wrf file too big to send via email? > > > > On Tue, Apr 4, 2023 at 3:11?PM Zilore Mumba wrote: > >> Rick, >> The scripts are exactly the same except the data path. The same >> .hluresfile is used for both scripts. There is no error message, but on >> other scripts I get the error that the values are out of the range >> specified by ExplcitLevels. I attach the script and the .hluresfile which >> is the same as the on the link you gave >> >> On Tue, Apr 4, 2023 at 10:12?PM Rick Brownrigg wrote: >> >>> Hi Zilore, >>> >>> As an aside -- the colorbars in the two plots appear to be different. >>> Does this script in question explicitly specify a colormap, or is it just >>> using the default? >>> >>> Is the .hluresfile on your 18.04 system substantially different from the >>> one on the 20.04 system? Is there even such a file on the new 20.04 >>> system? Perhaps copy the one from 18.04 over to your new system? No error >>> messages from NCL about "can't find colormaps"? >>> >>> A sort of default .hluresfile can be found here; there's nothing in it >>> that would account for the plot you are seeing: >>> >>> https://www.ncl.ucar.edu/Document/Graphics/hlures.shtml >>> >>> Rick >>> >>> >>> On Tue, Apr 4, 2023 at 1:30?PM Zilore Mumba via ncl-talk < >>> ncl-talk at mailman.ucar.edu> wrote: >>> >>>> Hello NCL users, >>>> I have a peculiar problem which I have no clue where it might come >>>> from. On my ubuntu 18.04 where I have run ncl for years, the graphics are >>>> fine as shown in the attached image TTIMap2.png. On a newly installed >>>> ubuntu 20.04 the very same script which produces TTIMap2.png produces >>>> TTIMap.png which instead of shading produces contours. Other scripts >>>> produce completely blank graphics on ubuntu-20.04 platform, whileas the the >>>> graphics from the same script on ubuntu18 platform are just fine. >>>> My only guess is that perhaps tinkering with the .hluresfile may >>>> resolve my problem. However I have never worked with the .hluresfile. >>>> I wii appreciate help on this. >>>> _______________________________________________ >>>> 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: TotalTotals.ncl Type: application/octet-stream Size: 6401 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: TTIMap.png Type: image/png Size: 80320 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: TTIMap2.png Type: image/png Size: 70337 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: hluresfile Type: application/octet-stream Size: 1668 bytes Desc: not available URL: From zeinabsalah at gmail.com Wed Apr 5 01:50:57 2023 From: zeinabsalah at gmail.com (Zeinab Salah) Date: Wed, 5 Apr 2023 09:50:57 +0200 Subject: [ncl-talk] Blank graphics in ncl In-Reply-To: References: Message-ID: Hi Zilore, I encountered the same problem before, therefore I installed NCL under conda environment as in: https://www.ncl.ucar.edu/Download/conda.shtml conda create -n *ncl_stable* -c conda-forge ncl source activate *ncl_stable* Best regards, Zeinab ??? ????????? 5 ????? 2023 ?? 7:37 ? ??? ????? ?? ??? ?????? ?Zilore Mumba via ncl-talk?? :? > Rick, > I have attached to this mail, 1) the script which produces the graphics, > 2) the two png's by the same script but on different platforms and 3) the > .hluresfile which is on both machines. In the attached .hluresfile I have > removed the dot at the beginning of the file name, but the dot is there in > the running copy. > Thanks for your time. > > On Tue, Apr 4, 2023 at 11:43?PM Rick Brownrigg wrote: > >> Zilore, is that wrf file too big to send via email? >> >> >> >> On Tue, Apr 4, 2023 at 3:11?PM Zilore Mumba wrote: >> >>> Rick, >>> The scripts are exactly the same except the data path. The same >>> .hluresfile is used for both scripts. There is no error message, but on >>> other scripts I get the error that the values are out of the range >>> specified by ExplcitLevels. I attach the script and the .hluresfile which >>> is the same as the on the link you gave >>> >>> On Tue, Apr 4, 2023 at 10:12?PM Rick Brownrigg >>> wrote: >>> >>>> Hi Zilore, >>>> >>>> As an aside -- the colorbars in the two plots appear to be different. >>>> Does this script in question explicitly specify a colormap, or is it just >>>> using the default? >>>> >>>> Is the .hluresfile on your 18.04 system substantially different from >>>> the one on the 20.04 system? Is there even such a file on the new 20.04 >>>> system? Perhaps copy the one from 18.04 over to your new system? No error >>>> messages from NCL about "can't find colormaps"? >>>> >>>> A sort of default .hluresfile can be found here; there's nothing in it >>>> that would account for the plot you are seeing: >>>> >>>> https://www.ncl.ucar.edu/Document/Graphics/hlures.shtml >>>> >>>> Rick >>>> >>>> >>>> On Tue, Apr 4, 2023 at 1:30?PM Zilore Mumba via ncl-talk < >>>> ncl-talk at mailman.ucar.edu> wrote: >>>> >>>>> Hello NCL users, >>>>> I have a peculiar problem which I have no clue where it might come >>>>> from. On my ubuntu 18.04 where I have run ncl for years, the graphics are >>>>> fine as shown in the attached image TTIMap2.png. On a newly installed >>>>> ubuntu 20.04 the very same script which produces TTIMap2.png produces >>>>> TTIMap.png which instead of shading produces contours. Other scripts >>>>> produce completely blank graphics on ubuntu-20.04 platform, whileas the the >>>>> graphics from the same script on ubuntu18 platform are just fine. >>>>> My only guess is that perhaps tinkering with the .hluresfile may >>>>> resolve my problem. However I have never worked with the .hluresfile. >>>>> I wii appreciate help on this. >>>>> _______________________________________________ >>>>> ncl-talk mailing list >>>>> ncl-talk at mailman.ucar.edu >>>>> List instructions, subscriber options, unsubscribe: >>>>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk >>>>> >>>> _______________________________________________ > 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 zmumba at gmail.com Wed Apr 5 02:47:09 2023 From: zmumba at gmail.com (Zilore Mumba) Date: Wed, 5 Apr 2023 10:47:09 +0200 Subject: [ncl-talk] Blank graphics in ncl In-Reply-To: References: Message-ID: Thanks very much Zeinab. Running the scripts in the conda environment as you suggested works. I am really thankful. Thanks to Rick also for your time and effort, and if there is another solution it is welcome. On Wed, Apr 5, 2023 at 9:51?AM Zeinab Salah wrote: > Hi Zilore, > I encountered the same problem before, therefore I installed NCL under > conda environment as in: https://www.ncl.ucar.edu/Download/conda.shtml > > conda create -n *ncl_stable* -c conda-forge ncl > source activate *ncl_stable* > > Best regards, > > Zeinab > > ??? ????????? 5 ????? 2023 ?? 7:37 ? ??? ????? ?? ??? ?????? ?Zilore Mumba > via ncl-talk?? :? > >> Rick, >> I have attached to this mail, 1) the script which produces the graphics, >> 2) the two png's by the same script but on different platforms and 3) the >> .hluresfile which is on both machines. In the attached .hluresfile I have >> removed the dot at the beginning of the file name, but the dot is there in >> the running copy. >> Thanks for your time. >> >> On Tue, Apr 4, 2023 at 11:43?PM Rick Brownrigg wrote: >> >>> Zilore, is that wrf file too big to send via email? >>> >>> >>> >>> On Tue, Apr 4, 2023 at 3:11?PM Zilore Mumba wrote: >>> >>>> Rick, >>>> The scripts are exactly the same except the data path. The same >>>> .hluresfile is used for both scripts. There is no error message, but on >>>> other scripts I get the error that the values are out of the range >>>> specified by ExplcitLevels. I attach the script and the .hluresfile which >>>> is the same as the on the link you gave >>>> >>>> On Tue, Apr 4, 2023 at 10:12?PM Rick Brownrigg >>>> wrote: >>>> >>>>> Hi Zilore, >>>>> >>>>> As an aside -- the colorbars in the two plots appear to be different. >>>>> Does this script in question explicitly specify a colormap, or is it just >>>>> using the default? >>>>> >>>>> Is the .hluresfile on your 18.04 system substantially different from >>>>> the one on the 20.04 system? Is there even such a file on the new 20.04 >>>>> system? Perhaps copy the one from 18.04 over to your new system? No error >>>>> messages from NCL about "can't find colormaps"? >>>>> >>>>> A sort of default .hluresfile can be found here; there's nothing in it >>>>> that would account for the plot you are seeing: >>>>> >>>>> https://www.ncl.ucar.edu/Document/Graphics/hlures.shtml >>>>> >>>>> Rick >>>>> >>>>> >>>>> On Tue, Apr 4, 2023 at 1:30?PM Zilore Mumba via ncl-talk < >>>>> ncl-talk at mailman.ucar.edu> wrote: >>>>> >>>>>> Hello NCL users, >>>>>> I have a peculiar problem which I have no clue where it might come >>>>>> from. On my ubuntu 18.04 where I have run ncl for years, the graphics are >>>>>> fine as shown in the attached image TTIMap2.png. On a newly installed >>>>>> ubuntu 20.04 the very same script which produces TTIMap2.png produces >>>>>> TTIMap.png which instead of shading produces contours. Other scripts >>>>>> produce completely blank graphics on ubuntu-20.04 platform, whileas the the >>>>>> graphics from the same script on ubuntu18 platform are just fine. >>>>>> My only guess is that perhaps tinkering with the .hluresfile may >>>>>> resolve my problem. However I have never worked with the .hluresfile. >>>>>> I wii appreciate help on this. >>>>>> _______________________________________________ >>>>>> ncl-talk mailing list >>>>>> ncl-talk at mailman.ucar.edu >>>>>> List instructions, subscriber options, unsubscribe: >>>>>> https://mailman.ucar.edu/mailman/listinfo/ncl-talk >>>>>> >>>>> _______________________________________________ >> 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 cliucv at connect.ust.hk Wed Apr 5 21:34:04 2023 From: cliucv at connect.ust.hk (LIU Chang) Date: Thu, 6 Apr 2023 03:34:04 +0000 Subject: [ncl-talk] question about location via ncl Message-ID: Dear NCL friends, I have a question about locating the point in which region in a shapefile. If I have some points with lat and lon information, and a country shapefile with its province information, may I get to know these points locate in which provinces? The attachment is my shapefile and some points information. It would be really appreciated if you could give me any suggestions. Thank you so much. Best regards, Cecilia -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: gis.zip Type: application/x-zip-compressed Size: 1294273 bytes Desc: gis.zip URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: point.xlsx Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet Size: 9391 bytes Desc: point.xlsx URL: From dave.allured at noaa.gov Thu Apr 6 07:32:51 2023 From: dave.allured at noaa.gov (Dave Allured - NOAA Affiliate) Date: Thu, 6 Apr 2023 07:32:51 -0600 Subject: [ncl-talk] question about location via ncl In-Reply-To: References: Message-ID: Cecelia, please see NCL example *shapefiles_13*, and the NCL function *gc_inout*. On Wed, Apr 5, 2023 at 9:36?PM LIU Chang via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > Dear NCL friends, > > I have a question about locating the point in which region in a shapefile. > If I have some points with lat and lon information, and a country > shapefile with its province information, may I get to know these points > locate in which provinces? > The attachment is my shapefile and some points information. > It would be really appreciated if you could give me any suggestions. > > Thank you so much. > > Best regards, > Cecilia > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cliucv at connect.ust.hk Fri Apr 7 03:36:01 2023 From: cliucv at connect.ust.hk (LIU Chang) Date: Fri, 7 Apr 2023 09:36:01 +0000 Subject: [ncl-talk] question about location via ncl In-Reply-To: References: Message-ID: Dear Dave, Thank you so much! I read and test the shapefiles_13. It seems very suitable for my needs. However, the USA shapefile in the shapefiles_13 is invalid now. And I downloaded the shp from https://www.weather.gov/source/gis/Shapefiles/County/s_08mr23.zip, which doesn't match with the shapefiles_13. Thus, I am still revising the script and trying to understand the function more. Anyway, thank you so much for your help. Best, Cecilia ________________________________ From: Dave Allured - NOAA Affiliate Sent: Thursday, 6 April 2023 9:32 pm To: LIU Chang Cc: ncl-talk at ucar.edu Subject: Re: [ncl-talk] question about location via ncl Cecelia, please see NCL example shapefiles_13, and the NCL function gc_inout. On Wed, Apr 5, 2023 at 9:36?PM LIU Chang via ncl-talk > wrote: Dear NCL friends, I have a question about locating the point in which region in a shapefile. If I have some points with lat and lon information, and a country shapefile with its province information, may I get to know these points locate in which provinces? The attachment is my shapefile and some points information. It would be really appreciated if you could give me any suggestions. Thank you so much. Best regards, Cecilia -------------- next part -------------- An HTML attachment was scrubbed... URL: From zmumba at gmail.com Sun Apr 9 01:59:08 2023 From: zmumba at gmail.com (Zilore Mumba) Date: Sun, 9 Apr 2023 09:59:08 +0200 Subject: [ncl-talk] Lat/lon labels Message-ID: My script,figure attached, outputs one longitude and one latitude labels only. In the code snippet below, I have turned on gridlines and they draw ok. >From this script https://www.ncl.ucar.edu/Applications/Scripts/mapgrid_6.ncl I was guessing that I could put latitude and longitudes labels using the code reproduced below. This gives me the error (lats = ispan(-31.,-28.,1.) "fatal:ispan: arguments must be of an integral type, can't continue" How does one get customized lat/lon labels? res at mpGridAndLimbOn = True ; turn on grid lines res at mpGridSpacingF = 0.5 ;---Create lat/lon arrays for location of latitude labels. ;lats = ispan(-31.,-28.,1.) ;nlat = dimsizes(lats) ;lons = new(nlat,integer) ;lons = 0 ;---Resources for text strings ;txres = True ;txres at txFontHeightF = 0.015 ;dum = gsn_add_text(wks,plot,""+lats,lons,lats,txres) -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Rain_NODA_00.png Type: image/png Size: 99831 bytes Desc: not available URL: From brownrig at ucar.edu Sun Apr 9 08:53:33 2023 From: brownrig at ucar.edu (Rick Brownrigg) Date: Sun, 9 Apr 2023 08:53:33 -0600 Subject: [ncl-talk] Lat/lon labels In-Reply-To: References: Message-ID: Hi Zilore, The specific error with ispan is that the function takes integers, not floats: lats = ispan(-31,-28,1) There is an fspan function if that's what you really want; it behaves a bit differently: https://www.ncl.ucar.edu/Document/Functions/Built-in/fspan.shtml More to your question, I'm not expert with labelling axes, so I always have to experiment. If fixing the ispan() error doesn't get you the labels you want, you might look at the examples on tickmarks for how to custom label axes: https://www.ncl.ucar.edu/Applications/tickmarks.shtml Hope that helps... Rick On Sun, Apr 9, 2023 at 1:59?AM Zilore Mumba via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > My script,figure attached, outputs one longitude and one latitude labels > only. In the code snippet below, I have turned on gridlines and they draw > ok. > From this script > https://www.ncl.ucar.edu/Applications/Scripts/mapgrid_6.ncl I was > guessing that I could put latitude and longitudes labels using the code > reproduced below. This gives me the error (lats = ispan(-31.,-28.,1.) > "fatal:ispan: arguments must be of an integral type, can't continue" > How does one get customized lat/lon labels? > > res at mpGridAndLimbOn = True ; turn on grid > lines > res at mpGridSpacingF = 0.5 > > ;---Create lat/lon arrays for location of latitude labels. > ;lats = ispan(-31.,-28.,1.) > ;nlat = dimsizes(lats) > ;lons = new(nlat,integer) > ;lons = 0 > > ;---Resources for text strings > ;txres = True > ;txres at txFontHeightF = 0.015 > ;dum = gsn_add_text(wks,plot,""+lats,lons,lats,txres) > _______________________________________________ > 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 zmumba at gmail.com Sun Apr 9 14:11:39 2023 From: zmumba at gmail.com (Zilore Mumba) Date: Sun, 9 Apr 2023 22:11:39 +0200 Subject: [ncl-talk] Lat/lon labels In-Reply-To: References: Message-ID: Rick, thank you very much for pointing me to the right resources. I tried several things, and eventually the lat/lon labels came as I wanted them (as you can see from the attachment). I am not really sure what fixed them because I removed the resources I tried, but the labelling remains. I have copied this to the list, though I am not sure if it may be useful. On Sun, Apr 9, 2023 at 4:53?PM Rick Brownrigg wrote: > Hi Zilore, > > The specific error with ispan is that the function takes integers, not > floats: > > lats = ispan(-31,-28,1) > > There is an fspan function if that's what you really want; it behaves a > bit differently: > > https://www.ncl.ucar.edu/Document/Functions/Built-in/fspan.shtml > > More to your question, I'm not expert with labelling axes, so I always > have to experiment. If fixing the ispan() error doesn't get you the labels > you want, you might look at the examples on tickmarks for how to custom > label axes: > > https://www.ncl.ucar.edu/Applications/tickmarks.shtml > > Hope that helps... > Rick > > On Sun, Apr 9, 2023 at 1:59?AM Zilore Mumba via ncl-talk < > ncl-talk at mailman.ucar.edu> wrote: > >> My script,figure attached, outputs one longitude and one latitude labels >> only. In the code snippet below, I have turned on gridlines and they draw >> ok. >> From this script >> https://www.ncl.ucar.edu/Applications/Scripts/mapgrid_6.ncl I was >> guessing that I could put latitude and longitudes labels using the code >> reproduced below. This gives me the error (lats = ispan(-31.,-28.,1.) >> "fatal:ispan: arguments must be of an integral type, can't continue" >> How does one get customized lat/lon labels? >> >> res at mpGridAndLimbOn = True ; turn on grid >> lines >> res at mpGridSpacingF = 0.5 >> >> ;---Create lat/lon arrays for location of latitude labels. >> ;lats = ispan(-31.,-28.,1.) >> ;nlat = dimsizes(lats) >> ;lons = new(nlat,integer) >> ;lons = 0 >> >> ;---Resources for text strings >> ;txres = True >> ;txres at txFontHeightF = 0.015 >> ;dum = gsn_add_text(wks,plot,""+lats,lons,lats,txres) >> _______________________________________________ >> 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: Tmin_NODA_05.png Type: image/png Size: 103283 bytes Desc: not available URL: From micahs2005 at gmail.com Wed Apr 12 18:10:21 2023 From: micahs2005 at gmail.com (Micah Sklut) Date: Wed, 12 Apr 2023 20:10:21 -0400 Subject: [ncl-talk] regrid tri-polar grid to rectilinear Message-ID: Hi, I have a netcdf file that uses a tri-polar grid. It is the NCEP RTOFS data. You can see the grid here: https://polar.ncep.noaa.gov/global/about/? I would like to regrid this data to a rectilinear grid. I attempted to use rcm2rgrid, but either it is taking a very long time (hours) or the function is hitting some road block. I wasn't sure if rcm2rgrid would work for the tri-polar grid. Is there another approach using ncl to regrid this tri-polar grid to a rectilinear grid? Thanks. -- Micah Sklut -------------- next part -------------- An HTML attachment was scrubbed... URL: From will.hobbs at utas.edu.au Wed Apr 12 18:20:24 2023 From: will.hobbs at utas.edu.au (Will Hobbs) Date: Thu, 13 Apr 2023 00:20:24 +0000 Subject: [ncl-talk] regrid tri-polar grid to rectilinear In-Reply-To: References: Message-ID: <42D235A4-83B2-4702-8002-7EF1823977BE@utas.edu.au> Hi Micah Regridding can take a long time, depending on the resolution of the input/output grids. If you?re likely to perform the same regridding operation regularly, then you can save a lot of time by saving the regrid weight files (the generation of these is the ?slow? bit) which can then be re-used in future regrid operations. For that approach, I **strongly** recommend that you use the ESMF regrid tools (https://www.ncl.ucar.edu/Applications/ESMF.shtml) All the best, Will From: ncl-talk on behalf of Micah Sklut via ncl-talk Reply to: Micah Sklut Date: Thursday, 13 April 2023 at 10:11 am To: NCL_Talk Subject: [ncl-talk] regrid tri-polar grid to rectilinear Hi, I have a netcdf file that uses a tri-polar grid. It is the NCEP RTOFS data. You can see the grid here: https://polar.ncep.noaa.gov/global/about/? I would like to regrid this data to a rectilinear grid. I attempted to use rcm2rgrid, but either it is taking a very long time (hours) or the function is hitting some road block. I wasn't sure if rcm2rgrid would work for the tri-polar grid. Is there another approach using ncl to regrid this tri-polar grid to a rectilinear grid? Thanks. -- Micah Sklut This email is confidential, and is for the intended recipient only. Access, disclosure, copying, distribution, or reliance on any of it by anyone outside the intended recipient organisation is prohibited and may be a criminal offence. Please delete if obtained in error and email confirmation to the sender. The views expressed in this email are not necessarily the views of the University of Tasmania, unless clearly intended otherwise. -------------- next part -------------- An HTML attachment was scrubbed... URL: From g.graffino at tim.it Fri Apr 14 10:10:09 2023 From: g.graffino at tim.it (Giorgio Graffino) Date: Fri, 14 Apr 2023 18:10:09 +0200 (CEST) Subject: [ncl-talk] How to use plot tickmark labels with different colors Message-ID: <20cb5ffb.6ec4.18780880107.Webtop.48@tim.it> Hello NCLers, ? I need to draw tickmark labels with two different colors (red and blue). The script is quite complex; it uses part of https://www.ncl.ucar.edu/Applications/Scripts/table_8.ncl to draw many table plots, which become part of a panel plot (see attached HadCM3_plot_maps_cor_3.png). I can't find a resource like tmXBLabelFontColors, or something able to handle an array of colors like xyLineColors does for lines. Does anyone know if such resource exist? ? I tried to generate colored labels in another way. I found this example (https://www.ncl.ucar.edu/Applications/Scripts/tm_12.ncl), containing a procedure able to remove labels from a plot and redraw them. My version of the procedure is pasted below; it reads the value and the location of the labels from the plot function, and draws them again using gsn_text_ndc. I included the procedure in my script but the result is not the intended one (see attached HadCM3_plot_maps_cor_3colored.png). ? I found out that there is an unadvertised gsnPanelSave resource used in https://www.ncl.ucar.edu/Applications/Scripts/panel_GWLs_Rain.ncl to to keep the plots in their resized state. I think it might help. Can anyone please tell me how it works? ? Cheers, Giorgio ? ;---------------------------------------------------------------------- ; This procedure replaces a plot's X/Y tickmark labels with custom ; labels created by drawing individual text strings? ; (adapted from https://www.ncl.ucar.edu/Applications/Scripts/tm_12.ncl) ;---------------------------------------------------------------------- procedure replace_tickmark_labels(wks,plot) local txres, xlabels, ylabels, xmin, ymin, xfonth, yfonth begin ;---Turn off plot's X and Y tickmark labels ?setvalues plot ? ?"tmXBLabelsOn" ?: False ? ?"tmYLLabelsOn" ?: False ?end setvalues ? ? ;---Retrieve some values so we can reconstruct the labels ?getvalues plot ? ?"tmXBLabels" ? ? ? ? ? ? ?: xlabels ? ?"tmYLLabels" ? ? ? ? ? ? ?: ylabels ? ?"tmXBValues" ? ? ? ? ? ? ?: xvalues ? ?"tmYLValues" ? ? ? ? ? ? ?: yvalues ? ?"trXMinF" ? ? ? ? ? ? ? ? : xmin ? ?"trYMinF" ? ? ? ? ? ? ? ? : ymin ? ?"tmYLMajorOutwardLengthF" : ylength ? ?"tmXBMajorOutwardLengthF" : xlength ? ?"tmXBLabelFontHeightF" ? ?: xfont_height ? ?"tmYLLabelFontHeightF" ? ?: yfont_height ?end getvalues ;---Get the NDC locations for the new tickmark labels ?xvalues_ndc = new(dimsizes(xvalues),float) ?yvalues_ndc = new(dimsizes(yvalues),float) ?xmin_ndc ? ?= new(1,float) ?ymin_ndc ? ?= new(1,float) ?datatondc(plot,xvalues,yvalues,xvalues_ndc,yvalues_ndc) ?datatondc(plot,xmin,ymin,xmin_ndc,ymin_ndc) ;---Make sure the tickmark labels don't touch the tickmarks. ?xmin_ndc = xmin_ndc-(1.8*ylength) ? ?? ?ymin_ndc = ymin_ndc-(1.8*xlength) ? ;---Color the first four labels red ?txres = True ?txres at txFontColor = "Red" ;---Draw the first four labels ?txres at txFontHeightF ? ? ? ? = xfont_height ?gsn_text_ndc(wks,ylabels(0:3),xmin_ndc,yvalues_ndc(0:3),txres) ?txres at txFontHeightF ? ? ? ? = yfont_height ?gsn_text_ndc(wks,xlabels(0:3),xvalues_ndc(0:3),ymin_ndc,txres) ;---Color the last four labels blue ?txres at txFontColor = "Blue" ;---Draw the last four labels ?txres at txFontHeightF ? ? ? ? = xfont_height ?gsn_text_ndc(wks,ylabels(4:7),xmin_ndc,yvalues_ndc(4:7),txres) ?txres at txFontHeightF ? ? ? ? = yfont_height ?gsn_text_ndc(wks,xlabels(4:7),xvalues_ndc(4:7),ymin_ndc,txres) end ? -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: HadCM3_plot_maps_cor_3colored.png Type: image/png Size: 163403 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: HadCM3_plot_maps_cor_3.png Type: image/png Size: 197811 bytes Desc: not available URL: From xi.chang01 at gmail.com Sat Apr 15 20:42:24 2023 From: xi.chang01 at gmail.com (Xi Chang) Date: Sat, 15 Apr 2023 19:42:24 -0700 Subject: [ncl-talk] PDFXY overlaid with averaged Y values binned by X Message-ID: Dear NCL, I am currently using a function of pdfxy for join pdf analysis. I am wondering if you guys can share a simple way to overlay a join pdf plot with a black solid line indicating the averaged Y values binned by the X bins. I attached the example below. Also how to change the pdfxy values to log10%. Thanks so much, Best, Chang [image: Screen Shot 2023-04-15 at 7.40.25 PM.png] -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Screen Shot 2023-04-15 at 7.40.25 PM.png Type: image/png Size: 356493 bytes Desc: not available URL: From g.graffino at tim.it Mon Apr 17 10:27:48 2023 From: g.graffino at tim.it (Giorgio Graffino) Date: Mon, 17 Apr 2023 18:27:48 +0200 (CEST) Subject: [ncl-talk] How to use plot tickmark labels with different colors In-Reply-To: <20cb5ffb.6ec4.18780880107.Webtop.48@tim.it> References: <20cb5ffb.6ec4.18780880107.Webtop.48@tim.it> Message-ID: <16b166f.48a3.187900b3eb0.Webtop.40@tim.it> [UPDATE] I made some progress using gsnPanelSave adapting replace_tickmark_labels and calling it after gsn_panel. To make the individual plots of the size I want, I'm drawing some "invisible" labels using res at tmXBLabelFontColor = "Background", then I'm redrawing them as red or blue. As you can see, the result is not great.? ? If I set res at tmXBLabelFontColor = "Transparent" the script doesn't work. Is there a way to draw transparent labels? ?Or is there another way to do what I'm trying to do (see email below)? Cheers, Giorgio ? ;---------------------------------------------------------------------- ; This procedure draw X/Y tickmark labels with custom ; labels created by drawing individual text strings read via gsnPanelSave ; (adapted from https://www.ncl.ucar.edu/Applications/Scripts/tm_12.ncl ; and https://www.ncl.ucar.edu/Applications/Scripts/panel_GWLs_Rain.ncl) ;---------------------------------------------------------------------- procedure replace_tickmark_labels_panel(wks,plot) local txres, xlabels, ylabels, xmin, ymin, xfonth, yfonth, xangle, xjust begin ;---Retrieve some values so we can reconstruct the labels ?getvalues plot ? ?"tmXBLabels" ? ? ? ? ? ? ?: xlabels ? ?"tmYLLabels" ? ? ? ? ? ? ?: ylabels ? ?"tmXBValues" ? ? ? ? ? ? ?: xvalues ? ?"tmYLValues" ? ? ? ? ? ? ?: yvalues ? ?"trXMinF" ? ? ? ? ? ? ? ? : xmin ? ?"trYMinF" ? ? ? ? ? ? ? ? : ymin ? ?"tmYLMajorOutwardLengthF" : ylength ? ?"tmXBMajorOutwardLengthF" : xlength ? ?"tmXBLabelFontHeightF" ? ?: xfont_height ? ?"tmYLLabelFontHeightF" ? ?: yfont_height ? ?"tmXBLabelAngleF" ? ? ? ? : xangle ? ?"tmXBLabelJust" ? ? ? ? ? : xjust ?end getvalues ;---Get the NDC locations for the new tickmark labels ?xvalues_ndc = new(dimsizes(xvalues),float) ?yvalues_ndc = new(dimsizes(yvalues),float) ?xmin_ndc ? ?= new(1,float) ?ymin_ndc ? ?= new(1,float) ?datatondc(plot,xvalues,yvalues,xvalues_ndc,yvalues_ndc) ?datatondc(plot,xmin,ymin,xmin_ndc,ymin_ndc) ;---Make sure the plot doesn't overlay with the tickmark labels. ?xmin_ndc = xmin_ndc-0.0075 ?ymin_ndc = ymin_ndc-0.0075 ? ;---Color the first four labels red ?txres = True ?txres at txJust = xjust ?txres at txFontColor = "Red" ;---Draw the first four labels ?txres at txFontHeightF ? ? ? ? = xfont_height ?gsn_text_ndc(wks,ylabels(0:3),xmin_ndc,yvalues_ndc(0:3),txres) ?txres at txAngleF = xangle ?txres at txFontHeightF ? ? ? ? = yfont_height ?gsn_text_ndc(wks,xlabels(0:3),xvalues_ndc(0:3),ymin_ndc,txres) ;---Color the last four labels blue ?txres at txFontColor = "Blue" ;---Draw the last four labels ?txres at txAngleF = 0. ?txres at txFontHeightF ? ? ? ? = xfont_height ?gsn_text_ndc(wks,ylabels(4:7),xmin_ndc,yvalues_ndc(4:7),txres) ?txres at txAngleF = xangle ?txres at txFontHeightF ? ? ? ? = yfont_height ?gsn_text_ndc(wks,xlabels(4:7),xvalues_ndc(4:7),ymin_ndc,txres) end ? ? ------ Messaggio Originale ------ Da: ncl-talk at mailman.ucar.edu A: ncl-talk at ucar.edu Inviato: venerd? 14 aprile 2023 17:10 Oggetto: [ncl-talk] How to use plot tickmark labels with different colors ? Hello NCLers, ? I need to draw tickmark labels with two different colors (red and blue). The script is quite complex; it uses part of https://www.ncl.ucar.edu/Applications/Scripts/table_8.ncl to draw many table plots, which become part of a panel plot (see attached HadCM3_plot_maps_cor_3.png). I can't find a resource like tmXBLabelFontColors, or something able to handle an array of colors like xyLineColors does for lines. Does anyone know if such resource exist? ? I tried to generate colored labels in another way. I found this example (https://www.ncl.ucar.edu/Applications/Scripts/tm_12.ncl), containing a procedure able to remove labels from a plot and redraw them. My version of the procedure is pasted below; it reads the value and the location of the labels from the plot function, and draws them again using gsn_text_ndc. I included the procedure in my script but the result is not the intended one (see attached HadCM3_plot_maps_cor_3colored.png). ? I found out that there is an unadvertised gsnPanelSave resource used in https://www.ncl.ucar.edu/Applications/Scripts/panel_GWLs_Rain.ncl to to keep the plots in their resized state. I think it might help. Can anyone please tell me how it works? ? Cheers, Giorgio ? ;---------------------------------------------------------------------- ; This procedure replaces a plot's X/Y tickmark labels with custom ; labels created by drawing individual text strings? ; (adapted from https://www.ncl.ucar.edu/Applications/Scripts/tm_12.ncl) ;---------------------------------------------------------------------- procedure replace_tickmark_labels(wks,plot) local txres, xlabels, ylabels, xmin, ymin, xfonth, yfonth begin ;---Turn off plot's X and Y tickmark labels ?setvalues plot ? ?"tmXBLabelsOn" ?: False ? ?"tmYLLabelsOn" ?: False ?end setvalues ? ? ;---Retrieve some values so we can reconstruct the labels ?getvalues plot ? ?"tmXBLabels" ? ? ? ? ? ? ?: xlabels ? ?"tmYLLabels" ? ? ? ? ? ? ?: ylabels ? ?"tmXBValues" ? ? ? ? ? ? ?: xvalues ? ?"tmYLValues" ? ? ? ? ? ? ?: yvalues ? ?"trXMinF" ? ? ? ? ? ? ? ? : xmin ? ?"trYMinF" ? ? ? ? ? ? ? ? : ymin ? ?"tmYLMajorOutwardLengthF" : ylength ? ?"tmXBMajorOutwardLengthF" : xlength ? ?"tmXBLabelFontHeightF" ? ?: xfont_height ? ?"tmYLLabelFontHeightF" ? ?: yfont_height ?end getvalues ;---Get the NDC locations for the new tickmark labels ?xvalues_ndc = new(dimsizes(xvalues),float) ?yvalues_ndc = new(dimsizes(yvalues),float) ?xmin_ndc ? ?= new(1,float) ?ymin_ndc ? ?= new(1,float) ?datatondc(plot,xvalues,yvalues,xvalues_ndc,yvalues_ndc) ?datatondc(plot,xmin,ymin,xmin_ndc,ymin_ndc) ;---Make sure the tickmark labels don't touch the tickmarks. ?xmin_ndc = xmin_ndc-(1.8*ylength) ? ?? ?ymin_ndc = ymin_ndc-(1.8*xlength) ? ;---Color the first four labels red ?txres = True ?txres at txFontColor = "Red" ;---Draw the first four labels ?txres at txFontHeightF ? ? ? ? = xfont_height ?gsn_text_ndc(wks,ylabels(0:3),xmin_ndc,yvalues_ndc(0:3),txres) ?txres at txFontHeightF ? ? ? ? = yfont_height ?gsn_text_ndc(wks,xlabels(0:3),xvalues_ndc(0:3),ymin_ndc,txres) ;---Color the last four labels blue ?txres at txFontColor = "Blue" ;---Draw the last four labels ?txres at txFontHeightF ? ? ? ? = xfont_height ?gsn_text_ndc(wks,ylabels(4:7),xmin_ndc,yvalues_ndc(4:7),txres) ?txres at txFontHeightF ? ? ? ? = yfont_height ?gsn_text_ndc(wks,xlabels(4:7),xvalues_ndc(4:7),ymin_ndc,txres) end ? _______________________________________________ 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: HadCM3_plot_maps_cor_8.pdf Type: application/pdf Size: 309149 bytes Desc: not available URL: From asphilli at ucar.edu Tue Apr 18 17:12:38 2023 From: asphilli at ucar.edu (Adam Phillips) Date: Tue, 18 Apr 2023 17:12:38 -0600 Subject: [ncl-talk] How to use plot tickmark labels with different colors In-Reply-To: <16b166f.48a3.187900b3eb0.Webtop.40@tim.it> References: <20cb5ffb.6ec4.18780880107.Webtop.48@tim.it> <16b166f.48a3.187900b3eb0.Webtop.40@tim.it> Message-ID: Hi Giorgio, You could try setting tmXBLabelFontColor to a RGBA value, setting the A value to 0. Using xy example #1 as a template: begin f = addfile ("$NCARG_ROOT/lib/ncarg/data/cdf/uv300.nc","r") u = f->U ; get u data wks = gsn_open_wks ("png","xy") ; send graphics to PNG file res = True ; plot mods desired res at gsnFrame = False res at tiMainString = "Basic XY plot" ; add title res at tmXBLabelFontColor = (/0,0,1,0./). ; <------ Set to blue, but make the color completely transparent. plot = gsn_csm_xy (wks,u&lat,u(0,:,{82}),res) ; create plot res at tmXBLabelFontColor = (/0,1,.05,1./). ; <---- Set to green, but make the color opaque. plot2 = gsn_csm_xy (wks,u&lat,u(0,:,{82}),res) ; create plot frame(wks) end If you run the above script you will see clean green X-axis labels (without any weird blue outlines to the green labels). Hope that helps! Adam On Mon, Apr 17, 2023 at 10:27?AM Giorgio Graffino via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > [UPDATE] > > I made some progress using gsnPanelSave adapting replace_tickmark_labels > and calling it after gsn_panel. To make the individual plots of the size I > want, I'm drawing some "invisible" labels using res at tmXBLabelFontColor = > "Background", then I'm redrawing them as red or blue. As you can see, the > result is not great. > > > > If I set res at tmXBLabelFontColor = "Transparent" the script doesn't work. > Is there a way to draw transparent labels? Or is there another way to do > what I'm trying to do (see email below)? > > Cheers, > > Giorgio > > > > ;---------------------------------------------------------------------- > ; This procedure draw X/Y tickmark labels with custom > ; labels created by drawing individual text strings read via gsnPanelSave > ; (adapted from https://www.ncl.ucar.edu/Applications/Scripts/tm_12.ncl > ; and https://www.ncl.ucar.edu/Applications/Scripts/panel_GWLs_Rain.ncl) > ;---------------------------------------------------------------------- > procedure replace_tickmark_labels_panel(wks,plot) > local txres, xlabels, ylabels, xmin, ymin, xfonth, yfonth, xangle, xjust > begin > ;---Retrieve some values so we can reconstruct the labels > getvalues plot > "tmXBLabels" : xlabels > "tmYLLabels" : ylabels > "tmXBValues" : xvalues > "tmYLValues" : yvalues > "trXMinF" : xmin > "trYMinF" : ymin > "tmYLMajorOutwardLengthF" : ylength > "tmXBMajorOutwardLengthF" : xlength > "tmXBLabelFontHeightF" : xfont_height > "tmYLLabelFontHeightF" : yfont_height > "tmXBLabelAngleF" : xangle > "tmXBLabelJust" : xjust > end getvalues > > ;---Get the NDC locations for the new tickmark labels > xvalues_ndc = new(dimsizes(xvalues),float) > yvalues_ndc = new(dimsizes(yvalues),float) > xmin_ndc = new(1,float) > ymin_ndc = new(1,float) > datatondc(plot,xvalues,yvalues,xvalues_ndc,yvalues_ndc) > datatondc(plot,xmin,ymin,xmin_ndc,ymin_ndc) > > ;---Make sure the plot doesn't overlay with the tickmark labels. > xmin_ndc = xmin_ndc-0.0075 > ymin_ndc = ymin_ndc-0.0075 > > ;---Color the first four labels red > txres = True > txres at txJust = xjust > txres at txFontColor = "Red" > > ;---Draw the first four labels > txres at txFontHeightF = xfont_height > gsn_text_ndc(wks,ylabels(0:3),xmin_ndc,yvalues_ndc(0:3),txres) > txres at txAngleF = xangle > txres at txFontHeightF = yfont_height > gsn_text_ndc(wks,xlabels(0:3),xvalues_ndc(0:3),ymin_ndc,txres) > > ;---Color the last four labels blue > txres at txFontColor = "Blue" > > ;---Draw the last four labels > txres at txAngleF = 0. > txres at txFontHeightF = xfont_height > gsn_text_ndc(wks,ylabels(4:7),xmin_ndc,yvalues_ndc(4:7),txres) > txres at txAngleF = xangle > txres at txFontHeightF = yfont_height > gsn_text_ndc(wks,xlabels(4:7),xvalues_ndc(4:7),ymin_ndc,txres) > end > > > > > ------ Messaggio Originale ------ > Da: ncl-talk at mailman.ucar.edu > A: ncl-talk at ucar.edu > Inviato: venerd? 14 aprile 2023 17:10 > Oggetto: [ncl-talk] How to use plot tickmark labels with different colors > > > Hello NCLers, > > > > I need to draw tickmark labels with two different colors (red and blue). > The script is quite complex; it uses part of > https://www.ncl.ucar.edu/Applications/Scripts/table_8.ncl to draw many > table plots, which become part of a panel plot (see attached > HadCM3_plot_maps_cor_3.png). I can't find a resource like > tmXBLabelFontColors, or something able to handle an array of colors like > xyLineColors does for lines. Does anyone know if such resource exist? > > > > I tried to generate colored labels in another way. I found this example ( > https://www.ncl.ucar.edu/Applications/Scripts/tm_12.ncl), containing a > procedure able to remove labels from a plot and redraw them. My version of > the procedure is pasted below; it reads the value and the location of the > labels from the plot function, and draws them again using gsn_text_ndc. I > included the procedure in my script but the result is not the intended one > (see attached HadCM3_plot_maps_cor_3colored.png). > > > > I found out that there is an unadvertised gsnPanelSave resource used in > https://www.ncl.ucar.edu/Applications/Scripts/panel_GWLs_Rain.ncl to to > keep the plots in their resized state. I think it might help. Can anyone > please tell me how it works? > > > > Cheers, > > Giorgio > > > > ;---------------------------------------------------------------------- > ; This procedure replaces a plot's X/Y tickmark labels with custom > ; labels created by drawing individual text strings > ; (adapted from https://www.ncl.ucar.edu/Applications/Scripts/tm_12.ncl) > ;---------------------------------------------------------------------- > procedure replace_tickmark_labels(wks,plot) > local txres, xlabels, ylabels, xmin, ymin, xfonth, yfonth > begin > ;---Turn off plot's X and Y tickmark labels > setvalues plot > "tmXBLabelsOn" : False > "tmYLLabelsOn" : False > end setvalues > > ;---Retrieve some values so we can reconstruct the labels > getvalues plot > "tmXBLabels" : xlabels > "tmYLLabels" : ylabels > "tmXBValues" : xvalues > "tmYLValues" : yvalues > "trXMinF" : xmin > "trYMinF" : ymin > "tmYLMajorOutwardLengthF" : ylength > "tmXBMajorOutwardLengthF" : xlength > "tmXBLabelFontHeightF" : xfont_height > "tmYLLabelFontHeightF" : yfont_height > end getvalues > > ;---Get the NDC locations for the new tickmark labels > xvalues_ndc = new(dimsizes(xvalues),float) > yvalues_ndc = new(dimsizes(yvalues),float) > xmin_ndc = new(1,float) > ymin_ndc = new(1,float) > datatondc(plot,xvalues,yvalues,xvalues_ndc,yvalues_ndc) > datatondc(plot,xmin,ymin,xmin_ndc,ymin_ndc) > > ;---Make sure the tickmark labels don't touch the tickmarks. > xmin_ndc = xmin_ndc-(1.8*ylength) > ymin_ndc = ymin_ndc-(1.8*xlength) > > ;---Color the first four labels red > txres = True > txres at txFontColor = "Red" > > ;---Draw the first four labels > txres at txFontHeightF = xfont_height > gsn_text_ndc(wks,ylabels(0:3),xmin_ndc,yvalues_ndc(0:3),txres) > txres at txFontHeightF = yfont_height > gsn_text_ndc(wks,xlabels(0:3),xvalues_ndc(0:3),ymin_ndc,txres) > > ;---Color the last four labels blue > txres at txFontColor = "Blue" > > ;---Draw the last four labels > txres at txFontHeightF = xfont_height > gsn_text_ndc(wks,ylabels(4:7),xmin_ndc,yvalues_ndc(4:7),txres) > txres at txFontHeightF = yfont_height > gsn_text_ndc(wks,xlabels(4:7),xvalues_ndc(4:7),ymin_ndc,txres) > > end > > ------------------------------ > > _______________________________________________ > ncl-talk mailing list > ncl-talk at mailman.ucar.edu > List instructions, subscriber options, unsubscribe: > https://mailman.ucar.edu/mailman/listinfo/ncl-talk > > > _______________________________________________ > 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 g.graffino at tim.it Wed Apr 19 02:34:31 2023 From: g.graffino at tim.it (Giorgio Graffino) Date: Wed, 19 Apr 2023 10:34:31 +0200 (CEST) Subject: [ncl-talk] How to use plot tickmark labels with different colors In-Reply-To: <16b166f.48a3.187900b3eb0.Webtop.40@tim.it> References: <16b166f.48a3.187900b3eb0.Webtop.40@tim.it> Message-ID: Thanks Adam,? I don't understand why, but it worked! I managed to add colored labels on a panel table plot. ? Cheers, Giorgio ? ------ Messaggio Originale ------ Da: asphilli at ucar.edu A: g.graffino at tim.it Cc: ncl-talk at ucar.edu Inviato: mercoled? 19 aprile 2023 00:12 Oggetto: Re: [ncl-talk] How to use plot tickmark labels with different colors ? Hi Giorgio, You could try setting tmXBLabelFontColor to a RGBA value, setting the A value to 0. Using xy example #1 as a template: ? begin ?f ? ? = addfile ("$NCARG_ROOT/lib/ncarg/data/cdf/uv300.nc ","r") ?u ? ? = f->U ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?; get u data ?wks ? = gsn_open_wks ("png","xy") ? ? ? ? ? ? ? ; send graphics to PNG file ?res ? ? ? ? ? ? ? ? ?= True ? ? ? ? ? ? ? ? ? ? ; plot mods desired ?res at gsnFrame = False ?res at tiMainString ? ? = "Basic XY plot" ? ? ? ? ?; add title ?res at tmXBLabelFontColor = (/0,0,1,0./).? ?; <------ Set to blue, but make the color completely transparent. ?plot ?= gsn_csm_xy (wks,u&lat,u(0,:,{82}),res) ; create plot ?res at tmXBLabelFontColor = (/0,1,.05,1./).? ?; <---- Set to green, but make the color opaque.? ?plot2 ?= gsn_csm_xy (wks,u&lat,u(0,:,{82}),res) ; create plot ?frame(wks) end ? ? If you run the above script you will see clean green X-axis labels (without any weird blue outlines to the green labels). ? Hope that helps! Adam ? ? On Mon, Apr 17, 2023 at 10:27?AM Giorgio Graffino via ncl-talk > wrote: ? [UPDATE] I made some progress using gsnPanelSave adapting replace_tickmark_labels and calling it after gsn_panel. To make the individual plots of the size I want, I'm drawing some "invisible" labels using res at tmXBLabelFontColor = "Background", then I'm redrawing them as red or blue. As you can see, the result is not great.? ? If I set res at tmXBLabelFontColor = "Transparent" the script doesn't work. Is there a way to draw transparent labels?? Or is there another way to do what I'm trying to do (see email below)? Cheers, Giorgio ? ;---------------------------------------------------------------------- ; This procedure draw X/Y tickmark labels with custom ; labels created by drawing individual text strings read via gsnPanelSave ; (adapted from https://www.ncl.ucar.edu/Applications/Scripts/tm_12.ncl ; and https://www.ncl.ucar.edu/Applications/Scripts/panel_GWLs_Rain.ncl ) ;---------------------------------------------------------------------- procedure replace_tickmark_labels_panel(wks,plot) local txres, xlabels, ylabels, xmin, ymin, xfonth, yfonth, xangle, xjust begin ;---Retrieve some values so we can reconstruct the labels ?getvalues plot ? ?"tmXBLabels" ? ? ? ? ? ? ?: xlabels ? ?"tmYLLabels" ? ? ? ? ? ? ?: ylabels ? ?"tmXBValues" ? ? ? ? ? ? ?: xvalues ? ?"tmYLValues" ? ? ? ? ? ? ?: yvalues ? ?"trXMinF" ? ? ? ? ? ? ? ? : xmin ? ?"trYMinF" ? ? ? ? ? ? ? ? : ymin ? ?"tmYLMajorOutwardLengthF" : ylength ? ?"tmXBMajorOutwardLengthF" : xlength ? ?"tmXBLabelFontHeightF" ? ?: xfont_height ? ?"tmYLLabelFontHeightF" ? ?: yfont_height ? ?"tmXBLabelAngleF" ? ? ? ? : xangle ? ?"tmXBLabelJust" ? ? ? ? ? : xjust ?end getvalues ;---Get the NDC locations for the new tickmark labels ?xvalues_ndc = new(dimsizes(xvalues),float) ?yvalues_ndc = new(dimsizes(yvalues),float) ?xmin_ndc ? ?= new(1,float) ?ymin_ndc ? ?= new(1,float) ?datatondc(plot,xvalues,yvalues,xvalues_ndc,yvalues_ndc) ?datatondc(plot,xmin,ymin,xmin_ndc,ymin_ndc) ;---Make sure the plot doesn't overlay with the tickmark labels. ?xmin_ndc = xmin_ndc-0.0075 ?ymin_ndc = ymin_ndc-0.0075 ? ;---Color the first four labels red ?txres = True ?txres at txJust = xjust ?txres at txFontColor = "Red" ;---Draw the first four labels ?txres at txFontHeightF ? ? ? ? = xfont_height ?gsn_text_ndc(wks,ylabels(0:3),xmin_ndc,yvalues_ndc(0:3),txres) ?txres at txAngleF = xangle ?txres at txFontHeightF ? ? ? ? = yfont_height ?gsn_text_ndc(wks,xlabels(0:3),xvalues_ndc(0:3),ymin_ndc,txres) ;---Color the last four labels blue ?txres at txFontColor = "Blue" ;---Draw the last four labels ?txres at txAngleF = 0. ?txres at txFontHeightF ? ? ? ? = xfont_height ?gsn_text_ndc(wks,ylabels(4:7),xmin_ndc,yvalues_ndc(4:7),txres) ?txres at txAngleF = xangle ?txres at txFontHeightF ? ? ? ? = yfont_height ?gsn_text_ndc(wks,xlabels(4:7),xvalues_ndc(4:7),ymin_ndc,txres) end ? ? ------ Messaggio Originale ------ Da: ncl-talk at mailman.ucar.edu A: ncl-talk at ucar.edu Inviato: venerd? 14 aprile 2023 17:10 Oggetto: [ncl-talk] How to use plot tickmark labels with different colors ? Hello NCLers, ? I need to draw tickmark labels with two different colors (red and blue). The script is quite complex; it uses part of https://www.ncl.ucar.edu/Applications/Scripts/table_8.ncl to draw many table plots, which become part of a panel plot (see attached HadCM3_plot_maps_cor_3.png). I can't find a resource like tmXBLabelFontColors, or something able to handle an array of colors like xyLineColors does for lines. Does anyone know if such resource exist? ? I tried to generate colored labels in another way. I found this example (https://www.ncl.ucar.edu/Applications/Scripts/tm_12.ncl ), containing a procedure able to remove labels from a plot and redraw them. My version of the procedure is pasted below; it reads the value and the location of the labels from the plot function, and draws them again using gsn_text_ndc. I included the procedure in my script but the result is not the intended one (see attached HadCM3_plot_maps_cor_3colored.png). ? I found out that there is an unadvertised gsnPanelSave resource used in https://www.ncl.ucar.edu/Applications/Scripts/panel_GWLs_Rain.ncl to to keep the plots in their resized state. I think it might help. Can anyone please tell me how it works? ? Cheers, Giorgio ? ;---------------------------------------------------------------------- ; This procedure replaces a plot's X/Y tickmark labels with custom ; labels created by drawing individual text strings? ; (adapted from https://www.ncl.ucar.edu/Applications/Scripts/tm_12.ncl ) ;---------------------------------------------------------------------- procedure replace_tickmark_labels(wks,plot) local txres, xlabels, ylabels, xmin, ymin, xfonth, yfonth begin ;---Turn off plot's X and Y tickmark labels ?setvalues plot ? ?"tmXBLabelsOn" ?: False ? ?"tmYLLabelsOn" ?: False ?end setvalues ? ? ;---Retrieve some values so we can reconstruct the labels ?getvalues plot ? ?"tmXBLabels" ? ? ? ? ? ? ?: xlabels ? ?"tmYLLabels" ? ? ? ? ? ? ?: ylabels ? ?"tmXBValues" ? ? ? ? ? ? ?: xvalues ? ?"tmYLValues" ? ? ? ? ? ? ?: yvalues ? ?"trXMinF" ? ? ? ? ? ? ? ? : xmin ? ?"trYMinF" ? ? ? ? ? ? ? ? : ymin ? ?"tmYLMajorOutwardLengthF" : ylength ? ?"tmXBMajorOutwardLengthF" : xlength ? ?"tmXBLabelFontHeightF" ? ?: xfont_height ? ?"tmYLLabelFontHeightF" ? ?: yfont_height ?end getvalues ;---Get the NDC locations for the new tickmark labels ?xvalues_ndc = new(dimsizes(xvalues),float) ?yvalues_ndc = new(dimsizes(yvalues),float) ?xmin_ndc ? ?= new(1,float) ?ymin_ndc ? ?= new(1,float) ?datatondc(plot,xvalues,yvalues,xvalues_ndc,yvalues_ndc) ?datatondc(plot,xmin,ymin,xmin_ndc,ymin_ndc) ;---Make sure the tickmark labels don't touch the tickmarks. ?xmin_ndc = xmin_ndc-(1.8*ylength) ? ?? ?ymin_ndc = ymin_ndc-(1.8*xlength) ? ;---Color the first four labels red ?txres = True ?txres at txFontColor = "Red" ;---Draw the first four labels ?txres at txFontHeightF ? ? ? ? = xfont_height ?gsn_text_ndc(wks,ylabels(0:3),xmin_ndc,yvalues_ndc(0:3),txres) ?txres at txFontHeightF ? ? ? ? = yfont_height ?gsn_text_ndc(wks,xlabels(0:3),xvalues_ndc(0:3),ymin_ndc,txres) ;---Color the last four labels blue ?txres at txFontColor = "Blue" ;---Draw the last four labels ?txres at txFontHeightF ? ? ? ? = xfont_height ?gsn_text_ndc(wks,ylabels(4:7),xmin_ndc,yvalues_ndc(4:7),txres) ?txres at txFontHeightF ? ? ? ? = yfont_height ?gsn_text_ndc(wks,xlabels(4:7),xvalues_ndc(4:7),ymin_ndc,txres) end ? _______________________________________________ ncl-talk mailing list ncl-talk at mailman.ucar.edu List instructions, subscriber options, unsubscribe: https://mailman.ucar.edu/mailman/listinfo/ncl-talk ? _______________________________________________ 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: -------------- next part -------------- A non-text attachment was scrubbed... Name: HadCM3_plot_maps_cor_8.pdf Type: application/pdf Size: 177187 bytes Desc: not available URL: From g.graffino at tim.it Fri Apr 21 06:20:53 2023 From: g.graffino at tim.it (Giorgio Graffino) Date: Fri, 21 Apr 2023 14:20:53 +0200 (CEST) Subject: [ncl-talk] Conform a multi-dimensional array to another multi-dimensional array Message-ID: <19d445c1.115a5.187a3c29f4b.Webtop.67@tim.it> Dear NCL folks, ? I have two multi-dimensional arrays: array a is 12x100 and array b is 11x100. I want to conform them to make their dimensions the same. I'm sure there is an easy way to do it, but so far I failed all attempts. ? For now, I mainly tried to add a row of missing values to array b to get an array c with dimensions 12x100 (the same of array a). Here is a list of the things I tried with their error message. ? c = conform(a,b,1) ? ? ? ? ? ? ? ?; fatal:conform: The array to be conformed must have the same number of dimensions as indicated by the length of the last argument ? c = (/b,new(dimsizes(b(0,:)),typeof(b),b at _FillValue)/) ? ? ? ? ?; fatal:_NclBuildArray: each element of a literal array must have the same number of dimensions ? c = array_append_record(b,new(dimsizes(b(0,:)),typeof(b),b at _FillValue),0) ? ? ? ? ? ? ? ? ?; array_append_record: ranks not equal: rank_x1=2 ?rank_x2=1 ? c = table_attach_rows(b,new(dimsizes(b(0,:)),typeof(b),b at _FillValue),0) ? ? ? ? ? ? ; fatal:Number of dimensions in parameter (1) of (table_attach_rows) is (1), (2) dimensions were expected ? Please let me know what else I can try or what I've done wrong. ? Thanks, Giorgio -------------- next part -------------- An HTML attachment was scrubbed... URL: From shea at ucar.edu Fri Apr 21 12:35:23 2023 From: shea at ucar.edu (Dennis Shea) Date: Fri, 21 Apr 2023 12:35:23 -0600 Subject: [ncl-talk] Conform a multi-dimensional array to another multi-dimensional array In-Reply-To: <19d445c1.115a5.187a3c29f4b.Webtop.67@tim.it> References: <19d445c1.115a5.187a3c29f4b.Webtop.67@tim.it> Message-ID: Maybe this is a start: ================= a(12,100), b(11,100) ? meta data ================= dima = dimsizes(a) dimb = dimsizes(b) na0 = dima(0) nb0 = dimb(0) c = new(dima, typeof(a)) c(0:nb0-1) = (/ b /) ; (/ ... /) means no meta data ; meta data copy_VatAtts(a,c) ; If necessary, coordinate info (named dimensions and coordinate values) will hav e to be added On Fri, Apr 21, 2023 at 6:21?AM Giorgio Graffino via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > Dear NCL folks, > > > > I have two multi-dimensional arrays: array a is 12x100 and array b is > 11x100. I want to conform them to make their dimensions the same. I'm sure > there is an easy way to do it, but so far I failed all attempts. > > > > For now, I mainly tried to add a row of missing values to array b to get > an array c with dimensions 12x100 (the same of array a). Here is a list of > the things I tried with their error message. > > > > c = conform(a,b,1) ; fatal:conform: The array to be > conformed must have the same number of dimensions as indicated by the > length of the last argument > > > > c = (/b,new(dimsizes(b(0,:)),typeof(b),b at _FillValue)/) ; > fatal:_NclBuildArray: each element of a literal array must have the same > number of dimensions > > > > c = array_append_record(b,new(dimsizes(b(0,:)),typeof(b),b at _FillValue),0) > ; array_append_record: ranks not equal: rank_x1=2 > rank_x2=1 > > > > c = table_attach_rows(b,new(dimsizes(b(0,:)),typeof(b),b at _FillValue),0) > ; fatal:Number of dimensions in parameter (1) of > (table_attach_rows) is (1), (2) dimensions were expected > > > > Please let me know what else I can try or what I've done wrong. > > > > Thanks, > > Giorgio > _______________________________________________ > 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 g.graffino at tim.it Mon Apr 24 06:09:22 2023 From: g.graffino at tim.it (Giorgio Graffino) Date: Mon, 24 Apr 2023 14:09:22 +0200 (CEST) Subject: [ncl-talk] Conform a multi-dimensional array to another multi-dimensional array In-Reply-To: <19d445c1.115a5.187a3c29f4b.Webtop.67@tim.it> References: <19d445c1.115a5.187a3c29f4b.Webtop.67@tim.it> Message-ID: <5427b09c.13cc8.187b32b282a.Webtop.67@tim.it> Hi Dennis, ? Thanks for the tip, but I prefer to not create the variable beforehand. I used the brute-force approch on the table_attach_rows function to read a one-dimensional array and append it to a two-dimensional array in a specific index. Probably it won't work with patterns becasue I removed the metadata part. ? undef("table_attach_singlerow") function table_attach_singlerow (t1[*][*], t2[*], nind:integer) local dim_t1, dim_t2, ncol1, ncol2, nrow1, ? ?\ ? ? ?dimNames_t1, dimNames_t2, dimNames, n ; ****************************************************************** ; Attaches/appends additional 1-D row. ; Adapted from the function table_attach_rows ; (https://github.com/NCAR/ncl/blob/develop/ni/src/examples/gsun/contributed.ncl). ; ****************************************************************** begin ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ; get array shape/sizes ?dim_t1 ?= dimsizes(t1) ?dim_t2 ?= dimsizes(t2) ?ncol1 ? = dim_t1(1) ?ncol2 ? = dim_t2(0) ; ?if (ncol1.ne.ncol2) then ; ? ? ?print ("table_attach_rows: tables must have same number of columns") ; ? ? ?print (" ? ? ? ? ? ? ? ? ? ?ncol1="+ncol1) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?? ; ? ? ?print (" ? ? ? ? ? ? ? ? ? ?ncol2="+ncol2) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?? ; ? ? ?exit ; ?end if ?if (typeof(t1).ne.typeof(t2)) then ? ? ?print ("table_attach_rows: arrays must be of the same type") ? ? ?print (" ? ? ? ? ? ? ? ? ? ?typeof(t1)="+typeof(t1))? ? ? ?print (" ? ? ? ? ? ? ? ? ? ?typeof(t2)="+typeof(t2))? ? ? ?exit ?end if ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ; allocate space for new array ?nrow1 ? ? ? = dim_t1(0) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ; chk _FillValue stuff ?if (isatt(t1,"_FillValue") ) then ? ? ?tNew = new ( (/nrow1+1, ncol1/), typeof(t1), t1 at _FillValue) ?else if (isatt(t2,"_FillValue") ) then ? ? ? ? ? tNew = new ( (/nrow1+1, ncol1/), typeof(t2), t2 at _FillValue) ? ? ? else? ? ? ? ? ? tNew = new ( (/nrow1+1, ncol1/), typeof(t2), "No_FillValue") ? ? ? end if ?end if ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ; insert values ?tNew(0:nind-1,:) ?= (/ t1(0:nind-1,:) /) ?tNew(nind ? ?,:) ? ?= (/ t2 /) ?tNew(nind+1:,:) ? = (/ t1(nind:,:) /) ?return (tNew) end ? Cheers, Giorgio ? ------ Messaggio Originale ------ Da: shea at ucar.edu A: g.graffino at tim.it Cc: ncl-talk at ucar.edu Inviato: venerd? 21 aprile 2023 19:35 Oggetto: Re: [ncl-talk] Conform a multi-dimensional array to another multi-dimensional array ? Maybe this is a start: ? ================= ? a(12,100),? b(11,100)???? ? meta data ? ================= ? dima = dimsizes(a) ? dimb = dimsizes(b) ? ? na0?? = dima(0) ? nb0?? = dimb(0) ? ? c ????? = new(dima, typeof(a)) ? c(0:nb0-1) = (/? b /)??? ;?? (/ ... /) means no meta data ? ; meta data ? ? copy_VatAtts(a,c)???? ? ? ; If necessary, coordinate info (named dimensions and coordinate values) will hav e to be added? ? ?? ? ? ? ? On Fri, Apr 21, 2023 at 6:21?AM Giorgio Graffino via ncl-talk > wrote: ? Dear NCL folks, ? I have two multi-dimensional arrays: array a is 12x100 and array b is 11x100. I want to conform them to make their dimensions the same. I'm sure there is an easy way to do it, but so far I failed all attempts. ? For now, I mainly tried to add a row of missing values to array b to get an array c with dimensions 12x100 (the same of array a). Here is a list of the things I tried with their error message. ? c = conform(a,b,1) ? ? ? ? ? ? ? ?; fatal:conform: The array to be conformed must have the same number of dimensions as indicated by the length of the last argument ? c = (/b,new(dimsizes(b(0,:)),typeof(b),b at _FillValue)/) ? ? ? ? ?; fatal:_NclBuildArray: each element of a literal array must have the same number of dimensions ? c = array_append_record(b,new(dimsizes(b(0,:)),typeof(b),b at _FillValue),0) ? ? ? ? ? ? ? ? ?; array_append_record: ranks not equal: rank_x1=2 ?rank_x2=1 ? c = table_attach_rows(b,new(dimsizes(b(0,:)),typeof(b),b at _FillValue),0) ? ? ? ? ? ? ; fatal:Number of dimensions in parameter (1) of (table_attach_rows) is (1), (2) dimensions were expected ? Please let me know what else I can try or what I've done wrong. ? Thanks, Giorgio _______________________________________________ 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 Mon Apr 24 07:54:08 2023 From: dave.allured at noaa.gov (Dave Allured - NOAA Affiliate) Date: Mon, 24 Apr 2023 07:54:08 -0600 Subject: [ncl-talk] Conform a multi-dimensional array to another multi-dimensional array In-Reply-To: <5427b09c.13cc8.187b32b282a.Webtop.67@tim.it> References: <19d445c1.115a5.187a3c29f4b.Webtop.67@tim.it> <5427b09c.13cc8.187b32b282a.Webtop.67@tim.it> Message-ID: Giorgio, here is a compact version of Dennis's method. This preserves attributes, coordinates, and the fill value. Assumptions are that dim 1 increases by 1, dim 2 is the same, and the new row is added in the last position. Originally you said "easy", so here you go. Untested: nrows = dimsizes (a, 0) c = new (dimsizes (a), typeof (b), getFillValue (b)) c(0:nrows-2,:) = b(:,:) On Mon, Apr 24, 2023 at 6:09?AM Giorgio Graffino via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > Hi Dennis, > > Thanks for the tip, but I prefer to not create the variable beforehand. I > used the brute-force approch on the table_attach_rows function to read a > one-dimensional array and append it to a two-dimensional array in a > specific index. Probably it won't work with patterns becasue I removed the > metadata part. > > undef("table_attach_singlerow") > function table_attach_singlerow (t1[*][*], t2[*], nind:integer) > local dim_t1, dim_t2, ncol1, ncol2, nrow1, \ > dimNames_t1, dimNames_t2, dimNames, n > > ; ****************************************************************** > ; Attaches/appends additional 1-D row. > ; Adapted from the function table_attach_rows > ; ( > https://github.com/NCAR/ncl/blob/develop/ni/src/examples/gsun/contributed.ncl > ). > ; ****************************************************************** > > begin > ; get array shape/sizes > dim_t1 = dimsizes(t1) > dim_t2 = dimsizes(t2) > > ncol1 = dim_t1(1) > ncol2 = dim_t2(0) > > ; if (ncol1.ne.ncol2) then > ; print ("table_attach_rows: tables must have same number of columns") > ; print (" ncol1="+ncol1) > > ; print (" ncol2="+ncol2) > > ; exit > ; end if > > if (typeof(t1).ne.typeof(t2)) then > print ("table_attach_rows: arrays must be of the same type") > print (" typeof(t1)="+typeof(t1)) > print (" typeof(t2)="+typeof(t2)) > exit > end if > ; allocate space for new array > nrow1 = dim_t1(0) > > ; chk _FillValue stuff > if (isatt(t1,"_FillValue") ) then > tNew = new ( (/nrow1+1, ncol1/), typeof(t1), t1 at _FillValue) > else if (isatt(t2,"_FillValue") ) then > tNew = new ( (/nrow1+1, ncol1/), typeof(t2), t2 at _FillValue) > else > tNew = new ( (/nrow1+1, ncol1/), typeof(t2), "No_FillValue") > end if > end if > > ; insert values > tNew(0:nind-1,:) = (/ t1(0:nind-1,:) /) > tNew(nind ,:) = (/ t2 /) > tNew(nind+1:,:) = (/ t1(nind:,:) /) > return (tNew) > end > > Cheers, > > Giorgio > > > ------ Messaggio Originale ------ > Da: shea at ucar.edu > A: g.graffino at tim.it Cc: ncl-talk at ucar.edu > Inviato: venerd? 21 aprile 2023 19:35 > Oggetto: Re: [ncl-talk] Conform a multi-dimensional array to another > multi-dimensional array > Maybe this is a start: > > ================= > > a(12,100), b(11,100) ? meta data > > ================= > dima = dimsizes(a) > dimb = dimsizes(b) > > na0 = dima(0) > nb0 = dimb(0) > > c = new(dima, typeof(a)) > c(0:nb0-1) = (/ b /) ; (/ ... /) means no meta data > > ; meta data > > copy_VatAtts(a,c) > > ; If necessary, coordinate info (named dimensions and coordinate values) > will hav e to be added > > > On Fri, Apr 21, 2023 at 6:21?AM Giorgio Graffino via ncl-talk < > ncl-talk at mailman.ucar.edu> wrote: > >> Dear NCL folks, >> >> I have two multi-dimensional arrays: array a is 12x100 and array b is >> 11x100. I want to conform them to make their dimensions the same. I'm sure >> there is an easy way to do it, but so far I failed all attempts. >> >> For now, I mainly tried to add a row of missing values to array b to get >> an array c with dimensions 12x100 (the same of array a). Here is a list of >> the things I tried with their error message. >> >> c = conform(a,b,1) ; fatal:conform: The array to be >> conformed must have the same number of dimensions as indicated by the >> length of the last argument >> >> c = (/b,new(dimsizes(b(0,:)),typeof(b),b at _FillValue)/) ; >> fatal:_NclBuildArray: each element of a literal array must have the same >> number of dimensions >> >> c = array_append_record(b,new(dimsizes(b(0,:)),typeof(b),b at _FillValue),0) >> ; array_append_record: ranks not equal: rank_x1=2 >> rank_x2=1 >> >> c = table_attach_rows(b,new(dimsizes(b(0,:)),typeof(b),b at _FillValue),0) >> ; fatal:Number of dimensions in parameter (1) of >> (table_attach_rows) is (1), (2) dimensions were expected >> >> Please let me know what else I can try or what I've done wrong. >> >> Thanks, >> >> Giorgio >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: From g.graffino at tim.it Tue Apr 25 01:25:53 2023 From: g.graffino at tim.it (Giorgio Graffino) Date: Tue, 25 Apr 2023 09:25:53 +0200 (CEST) Subject: [ncl-talk] Conform a multi-dimensional array to another multi-dimensional array In-Reply-To: <5427b09c.13cc8.187b32b282a.Webtop.67@tim.it> References: <5427b09c.13cc8.187b32b282a.Webtop.67@tim.it> Message-ID: <71a63fd1.146d4.187b74df980.Webtop.67@tim.it> Hi Dave, ? Thanks for your suggestion. I'll stick with my table_attach_singlerow function for now. ? Cheers, Giorgio ? ------ Messaggio Originale ------ Da: dave.allured at noaa.gov A: g.graffino at tim.it Cc: ncl-talk at ucar.edu Inviato: luned? 24 aprile 2023 14:54 Oggetto: Re: [ncl-talk] Conform a multi-dimensional array to another multi-dimensional array ? Giorgio, here is a compact version of Dennis's method.? This preserves attributes, coordinates, and the fill value.? Assumptions are that dim 1 increases by 1, dim 2 is the same, and the new row is added in the last position.? Originally you said "easy", so here you go.? Untested: ? nrows = dimsizes (a, 0) c = new (dimsizes (a), typeof (b), getFillValue (b)) c(0:nrows-2,:) = b(:,:) ? ? On Mon, Apr 24, 2023 at 6:09?AM Giorgio Graffino via ncl-talk > wrote: ? Hi Dennis, Thanks for the tip, but I prefer to not create the variable beforehand. I used the brute-force approch on the table_attach_rows function to read a one-dimensional array and append it to a two-dimensional array in a specific index. Probably it won't work with patterns becasue I removed the metadata part. undef("table_attach_singlerow") function table_attach_singlerow (t1[*][*], t2[*], nind:integer) local dim_t1, dim_t2, ncol1, ncol2, nrow1, ? ?\ ? ? ?dimNames_t1, dimNames_t2, dimNames, n ; ****************************************************************** ; Attaches/appends additional 1-D row. ; Adapted from the function table_attach_rows ; (https://github.com/NCAR/ncl/blob/develop/ni/src/examples/gsun/contributed.ncl ). ; ****************************************************************** begin ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ; get array shape/sizes ?dim_t1 ?= dimsizes(t1) ?dim_t2 ?= dimsizes(t2) ?ncol1 ? = dim_t1(1) ?ncol2 ? = dim_t2(0) ; ?if (ncol1.ne.ncol2) then ; ? ? ?print ("table_attach_rows: tables must have same number of columns") ; ? ? ?print (" ? ? ? ? ? ? ? ? ? ?ncol1="+ncol1) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?? ; ? ? ?print (" ? ? ? ? ? ? ? ? ? ?ncol2="+ncol2) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?? ; ? ? ?exit ; ?end if ?if (typeof(t1).ne.typeof(t2)) then ? ? ?print ("table_attach_rows: arrays must be of the same type") ? ? ?print (" ? ? ? ? ? ? ? ? ? ?typeof(t1)="+typeof(t1))? ? ? ?print (" ? ? ? ? ? ? ? ? ? ?typeof(t2)="+typeof(t2))? ? ? ?exit ?end if ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ; allocate space for new array ?nrow1 ? ? ? = dim_t1(0) ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ; chk _FillValue stuff ?if (isatt(t1,"_FillValue") ) then ? ? ?tNew = new ( (/nrow1+1, ncol1/), typeof(t1), t1 at _FillValue) ?else if (isatt(t2,"_FillValue") ) then ? ? ? ? ? tNew = new ( (/nrow1+1, ncol1/), typeof(t2), t2 at _FillValue) ? ? ? else? ? ? ? ? ? tNew = new ( (/nrow1+1, ncol1/), typeof(t2), "No_FillValue") ? ? ? end if ?end if ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ; insert values ?tNew(0:nind-1,:) ?= (/ t1(0:nind-1,:) /) ?tNew(nind ? ?,:) ? ?= (/ t2 /) ?tNew(nind+1:,:) ? = (/ t1(nind:,:) /) ?return (tNew) end ? Cheers, Giorgio ? ------ Messaggio Originale ------ Da: shea at ucar.edu A: g.graffino at tim.it Cc: ncl-talk at ucar.edu Inviato: venerd? 21 aprile 2023 19:35 Oggetto: Re: [ncl-talk] Conform a multi-dimensional array to another multi-dimensional array ? Maybe this is a start: ? ================= ? a(12,100),? b(11,100)???? ? meta data ? ================= ? dima = dimsizes(a) ? dimb = dimsizes(b) ? ? na0?? = dima(0) ? nb0?? = dimb(0) ? ? c ????? = new(dima, typeof(a)) ? c(0:nb0-1) = (/? b /)??? ;?? (/ ... /) means no meta data ? ; meta data ? ? copy_VatAtts(a,c)???? ? ? ; If necessary, coordinate info (named dimensions and coordinate values) will hav e to be added? ? ? On Fri, Apr 21, 2023 at 6:21?AM Giorgio Graffino via ncl-talk > wrote: ? Dear NCL folks, I have two multi-dimensional arrays: array a is 12x100 and array b is 11x100. I want to conform them to make their dimensions the same. I'm sure there is an easy way to do it, but so far I failed all attempts. For now, I mainly tried to add a row of missing values to array b to get an array c with dimensions 12x100 (the same of array a). Here is a list of the things I tried with their error message. c = conform(a,b,1) ? ? ? ? ? ? ? ?; fatal:conform: The array to be conformed must have the same number of dimensions as indicated by the length of the last argument c = (/b,new(dimsizes(b(0,:)),typeof(b),b at _FillValue)/) ? ? ? ? ?; fatal:_NclBuildArray: each element of a literal array must have the same number of dimensions? c = array_append_record(b,new(dimsizes(b(0,:)),typeof(b),b at _FillValue),0) ? ? ? ? ? ? ? ? ?; array_append_record: ranks not equal: rank_x1=2 ?rank_x2=1 c = table_attach_rows(b,new(dimsizes(b(0,:)),typeof(b),b at _FillValue),0) ? ? ? ? ? ? ; fatal:Number of dimensions in parameter (1) of (table_attach_rows) is (1), (2) dimensions were expected Please let me know what else I can try or what I've done wrong. Thanks, Giorgio -------------- next part -------------- An HTML attachment was scrubbed... URL: From yueyunxiaoming at gmail.com Thu Apr 27 15:37:42 2023 From: yueyunxiaoming at gmail.com (Xiaoming Sun) Date: Thu, 27 Apr 2023 15:37:42 -0600 Subject: [ncl-talk] About the Source Code for Two NCL Internal Functions Message-ID: Dear NCL-Help, If possible, can you please send me the source codes (probably in Fortran) for the following two NCL-functions, including filwgts_lanczos wgt_runave ? We are trying to rewrite these two functions in another language, but cannot get a bit-to-bit matching to the NCL functions. The source codes of them will be very helpful to us. Many thanks, Best, Xiaoming -- Xiaoming Sun -------------- next part -------------- An HTML attachment was scrubbed... URL: From dave.allured at noaa.gov Thu Apr 27 15:44:46 2023 From: dave.allured at noaa.gov (Dave Allured - NOAA Affiliate) Date: Thu, 27 Apr 2023 15:44:46 -0600 Subject: [ncl-talk] About the Source Code for Two NCL Internal Functions In-Reply-To: References: Message-ID: Xiaoming, the source code for those functions is located within the *NCARG/NCL main source code distribution*. This is open source and free for public downloading. Please download from the NCL website, and search for those functions. They probably exist under slightly different file names within the source code. On Thu, Apr 27, 2023 at 3:38?PM Xiaoming Sun via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > Dear NCL-Help, > > If possible, can you please send me the source codes (probably in Fortran) > for the following two NCL-functions, including > filwgts_lanczos > wgt_runave > ? > > We are trying to rewrite these two functions in another language, but > cannot get a bit-to-bit matching to the NCL functions. The source codes of > them will be very helpful to us. > > Many thanks, > Best, > Xiaoming > -------------- next part -------------- An HTML attachment was scrubbed... URL: From shea at ucar.edu Thu Apr 27 22:05:57 2023 From: shea at ucar.edu (Dennis Shea) Date: Thu, 27 Apr 2023 22:05:57 -0600 Subject: [ncl-talk] About the Source Code for Two NCL Internal Functions In-Reply-To: References: Message-ID: Dave is correct. The 'official' fortran codes are where he suggested. ========= I have some fortran subroutines which, I think, are sufficient. See Attached ========= Regards On Thu, Apr 27, 2023 at 3:45?PM Dave Allured - NOAA Affiliate via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > Xiaoming, the source code for those functions is located within the *NCARG/NCL > main source code distribution*. This is open source and free for public > downloading. Please download from the NCL website, and search for those > functions. They probably exist under slightly different file names within > the source code. > > > On Thu, Apr 27, 2023 at 3:38?PM Xiaoming Sun via ncl-talk < > ncl-talk at mailman.ucar.edu> wrote: > >> Dear NCL-Help, >> >> If possible, can you please send me the source codes (probably in >> Fortran) for the following two NCL-functions, including >> filwgts_lanczos >> wgt_runave >> ? >> >> We are trying to rewrite these two functions in another language, but >> cannot get a bit-to-bit matching to the NCL functions. The source codes of >> them will be very helpful to us. >> >> Many thanks, >> Best, >> Xiaoming >> > _______________________________________________ > 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: wrunave_dp.f Type: application/octet-stream Size: 5283 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: filtrx.f Type: application/octet-stream Size: 5785 bytes Desc: not available URL: From zmumba at gmail.com Sat Apr 29 02:13:17 2023 From: zmumba at gmail.com (Zilore Mumba) Date: Sat, 29 Apr 2023 10:13:17 +0200 Subject: [ncl-talk] Main title position Message-ID: I am trying to move my main title position downwards. I have tried the following, which all have no effect: opts at tiUseMainAttributes = True opts at FieldTitle = "mcape" opts at MainTitle = "MCAPE: NODA" opts at tiMainJust = "BottomCenter" opts at tiMainOffsetYF = -2.5 I have tried several values of opts at tiMainOffsetYF = -2.5, no effect see image attached. Assistance will be appreciated. -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: mcape_d01_noda_36H.png Type: image/png Size: 85111 bytes Desc: not available URL: From brownrig at ucar.edu Sat Apr 29 07:39:23 2023 From: brownrig at ucar.edu (Rick Brownrigg) Date: Sat, 29 Apr 2023 07:39:23 -0600 Subject: [ncl-talk] Main title position In-Reply-To: References: Message-ID: Hi Zilore, I don't really know why things are not working for you. I would note however, that the units for tiMainOffsetYF are normalized device coordinates (NDC), which range from 0..1 along the longest dimension (not axis!) of the plot. A value of "-2.5" would be well outside the plot region; perhaps NCL is ignoring such a large value? Rick On Sat, Apr 29, 2023 at 2:13?AM Zilore Mumba via ncl-talk < ncl-talk at mailman.ucar.edu> wrote: > I am trying to move my main title position downwards. I have tried the > following, which all have no effect: > opts at tiUseMainAttributes = True > opts at FieldTitle = "mcape" > opts at MainTitle = "MCAPE: NODA" > opts at tiMainJust = "BottomCenter" > opts at tiMainOffsetYF = -2.5 > I have tried several values of opts at tiMainOffsetYF = -2.5, no effect see > image attached. > Assistance will be appreciated. > _______________________________________________ > 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 tao.zhang at colorado.edu Sat Apr 29 16:26:08 2023 From: tao.zhang at colorado.edu (Tao Zhang) Date: Sat, 29 Apr 2023 16:26:08 -0600 Subject: [ncl-talk] NCL lib. error Message-ID: <0fb968d7-ed2f-315b-cee3-d6a47edc2e78@colorado.edu> Hi, ?I am not sure if installing some Macport packages or Anaconda python causes the NCL to fail. It works well before. ?My Mac OS is 10.14.6. ? Do you know how to fix it? ?? Thanks ? Tao /Users/tzhang/Disk> ncl dyld: Library not loaded: @rpath/libgcc_s.1.1.dylib ? Referenced from: /opt/local/lib/libgcc/libgcc_s.1.dylib ? Reason: image not found Abort From yueyunxiaoming at gmail.com Sun Apr 30 15:37:44 2023 From: yueyunxiaoming at gmail.com (Xiaoming Sun) Date: Sun, 30 Apr 2023 15:37:44 -0600 Subject: [ncl-talk] About the Source Code for Two NCL Internal Functions In-Reply-To: References: Message-ID: Thank you Dave and Dennis, and all are helpful! Best, Xiaoming On Thu, Apr 27, 2023 at 10:06?PM Dennis Shea wrote: > Dave is correct. The 'official' fortran codes are where he suggested. > ========= > I have some fortran subroutines which, I think, are sufficient. > > See Attached > ========= > > Regards > > > On Thu, Apr 27, 2023 at 3:45?PM Dave Allured - NOAA Affiliate via ncl-talk > wrote: > >> Xiaoming, the source code for those functions is located within the *NCARG/NCL >> main source code distribution*. This is open source and free for public >> downloading. Please download from the NCL website, and search for those >> functions. They probably exist under slightly different file names within >> the source code. >> >> >> On Thu, Apr 27, 2023 at 3:38?PM Xiaoming Sun via ncl-talk < >> ncl-talk at mailman.ucar.edu> wrote: >> >>> Dear NCL-Help, >>> >>> If possible, can you please send me the source codes (probably in >>> Fortran) for the following two NCL-functions, including >>> filwgts_lanczos >>> wgt_runave >>> ? >>> >>> We are trying to rewrite these two functions in another language, but >>> cannot get a bit-to-bit matching to the NCL functions. The source codes of >>> them will be very helpful to us. >>> >>> Many thanks, >>> Best, >>> Xiaoming >>> >> _______________________________________________ >> ncl-talk mailing list >> ncl-talk at mailman.ucar.edu >> List instructions, subscriber options, unsubscribe: >> https://mailman.ucar.edu/mailman/listinfo/ncl-talk >> > -- Xiaoming Sun -------------- next part -------------- An HTML attachment was scrubbed... URL: