[ncl-talk] wind and emission flux on the same plot

Dennis Shea shea at ucar.edu
Sun Sep 15 07:49:53 MDT 2019


The easiest way:

xx = x(nt,:,:)
xx = where(xx.le.0 , xx at _FillValue, xx)
plot=gsn_csm_vector_scalar_map_ce(wks,u(ut,:,:),v(ut,:,:), xx,res)

===

On Sat, Sep 14, 2019 at 11:08 AM Setareh Rahimi via ncl-talk <
ncl-talk at ucar.edu> wrote:

> Dear NCL users,
>
> I have a question regarding the color bar, which is:
> once I set res at cnLevels   to start from zero ( as bellow), NCL indicates
> zero values as very light blue color on the map. However, I would like that
> zero values will be shown as white color on the map. So how can I do so,
> please?
> Look forward to your helpful suggestions.
> Best wishes,
>
>
>
> res at cnLevels             = (/  0, 100,  250,  500,  750, 1000, 2000\
>                               ,  3000, 4000, 5000, 6000, 7000, 8000\
>                               ,  9000,10000,11000,12000,13000,14000\
>                               , 15000,17250,20000,25000,30000,40000\
>                               , 50000,60000,75000,100000 /)
>
> On Sat, Aug 31, 2019 at 12:38 AM Adam Phillips <asphilli at ucar.edu> wrote:
>
>> Hi Setareh,
>> You need to set the vfXArray/vfYArray resources in your resv resource
>> list. gsn_vector is not throwing an error message in this case, and I
>> believe it should, as the u/v arrays have no coordinate variables attached
>> to them. Once you set those resources you get the vectors to show up.
>> Script and plot are attached.
>> Adam
>>
>> On Fri, Aug 30, 2019 at 1:09 PM Setareh Rahimi <setareh.rahimi at gmail.com>
>> wrote:
>>
>>>  Yazd-2-2019_DUST04.2018120100.nc
>>> <https://drive.google.com/file/d/1ozyderWAFvQO4admiktJsALa2BQvhRpZ/view?usp=drive_web>
>>>  Yazd-2-2019_SRF.2018120100.nc
>>> <https://drive.google.com/file/d/1Xr_Omj6LYkwiDRLRuiOnYQStHpNzKE8N/view?usp=drive_web>
>>> Dear Adam,
>>> I attached the files that I am using to plot.  As long as there is no
>>> shapefile added to the script, wind vectors appear. However, the problem
>>> starts from where I add shapefile to the script.
>>> I need to fix this problem.
>>> Thank you,
>>>
>>> On Fri, Aug 30, 2019 at 10:40 PM Adam Phillips <asphilli at ucar.edu>
>>> wrote:
>>>
>>>> Hi Setareh,
>>>> Please include ncl-talk on all replies. We cannot run the
>>>> wind-dust2.ncl script as you never included the files you use at the top
>>>> (which are different than the ones used in wind.ncl). I substituted the
>>>> files used in your wind.ncl script into wind-dust2.ncl, and I get vectors
>>>> on the resulting image. I've attached the script and output plot. As one
>>>> set of files works and another doesn't I would look closely at the
>>>> differences between the files.
>>>> Adam
>>>>
>>>> On Fri, Aug 30, 2019 at 11:58 AM Setareh Rahimi <
>>>> setareh.rahimi at gmail.com> wrote:
>>>>
>>>>> Dear Adam,
>>>>> I already changed the script name as "wind-dust2.ncl", you can find it
>>>>> through previous emails. I also attached the result I got. As you can see,
>>>>> there are emission flux plus boundary of the study area, but no wind
>>>>> vectors.
>>>>> Thank you.
>>>>>
>>>>> On Fri, Aug 30, 2019 at 10:16 PM Adam Phillips <asphilli at ucar.edu>
>>>>> wrote:
>>>>>
>>>>>> Hi Setareh,
>>>>>> If your script does not return any error messages, then either:
>>>>>> 1 - You are using a different script than I did. If my suggestions
>>>>>> did not work please attach the latest version of your script (and you might
>>>>>> want to rename it to say wind-2.ncl) and attach the resulting plot.
>>>>>> 2 - You have turned off or redirected all NCL error messages.
>>>>>> Regardless of which it is, the suggestions I included in my two
>>>>>> previous emails will fix the issue with the vectors not showing up.
>>>>>> Adam
>>>>>>
>>>>>> On Fri, Aug 30, 2019 at 11:08 AM Setareh Rahimi <
>>>>>> setareh.rahimi at gmail.com> wrote:
>>>>>>
>>>>>>> Dear Adam,
>>>>>>> I did not get any of those errors you have mentioned. The script
>>>>>>> returns an image, showing dust emission and boundary of the study area, but
>>>>>>> not showing wind vectors, which means the issue is something else!
>>>>>>> Thank you,
>>>>>>>
>>>>>>> On Fri, Aug 30, 2019 at 9:28 PM Adam Phillips <asphilli at ucar.edu>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Hi Setareh,
>>>>>>>> I'm not sure what script you are referring to anymore, but I just
>>>>>>>> ran your wind.ncl script (I do not have the data files to run the
>>>>>>>> wind-dust2.ncl script), and got the following error messages:
>>>>>>>>  (0) check_for_y_lat_coord: Warning: Data either does not contain
>>>>>>>> (0) a valid latitude coordinate array or doesn't contain one at all.
>>>>>>>> (0) A valid latitude coordinate array should have a 'units'
>>>>>>>> (0) attribute equal to one of the following values:
>>>>>>>> (0)    'degrees_north' 'degrees-north' 'degree_north' 'degrees
>>>>>>>> north' 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg
>>>>>>>> north'
>>>>>>>> (0) check_for_lon_coord: Warning: Data either does not contain
>>>>>>>> (0) a valid longitude coordinate array or doesn't contain one at
>>>>>>>> all.
>>>>>>>> (0) A valid longitude coordinate array should have a 'units'
>>>>>>>> (0) attribute equal to one of the following values:
>>>>>>>> (0)    'degrees_east' 'degrees-east' 'degree_east' 'degrees east'
>>>>>>>> 'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE' 'deg east'
>>>>>>>> warning:cnLevels is not a valid resource in rcm_vector at this time
>>>>>>>> warning:cnFillOn is not a valid resource in rcm_vector at this time
>>>>>>>> warning:cnFillMode is not a valid resource in rcm_vector at this
>>>>>>>> time
>>>>>>>> warning:cnLineLabelsOn is not a valid resource in rcm_vector at
>>>>>>>> this time
>>>>>>>> warning:cnLevelSelectionMode is not a valid resource in rcm_vector
>>>>>>>> at this time
>>>>>>>> warning:cnLinesOn is not a valid resource in rcm_vector at this time
>>>>>>>> warning:cnFillPalette is not a valid resource in rcm_vector at this
>>>>>>>> time
>>>>>>>> (0) gsn_csm_map_ce: Warning: you are calling one of the CE map
>>>>>>>> functions,
>>>>>>>> (0) but setting the map projection to something other than
>>>>>>>> (0) 'CylindricalEquidistant'. You may get errors or unexpected
>>>>>>>> results.
>>>>>>>> warning:ContourPlotDraw: out of range coordinates encountered;
>>>>>>>> standard line rendering method may be unreliable;
>>>>>>>>  consider setting the resource trGridType to "TriangularMesh" if
>>>>>>>> coordinates contain missing values
>>>>>>>>
>>>>>>>> Whenever you write to ncl-talk you should always include the error
>>>>>>>> messages you are getting. You should also try to fix the errors before
>>>>>>>> contacting ncl-talk. The "check_for_y_lat_coord message is a common one
>>>>>>>> whose solution is easily found by searching for the error message:
>>>>>>>> https://www.ncl.ucar.edu/Document/Graphics/error_msg.shtml
>>>>>>>>
>>>>>>>> The units are correctly set in your xlat and xlon arrays, so that
>>>>>>>> is not the issue. However, while you are setting the sfXArray/sfYArray
>>>>>>>> resources, you are not setting the vfXArray/vfYArray resources to set the
>>>>>>>> coordinates for the vector array that you are passing to
>>>>>>>> gsn_csm_vector_scalar_map. So, set this to fix the check_for_* errors:
>>>>>>>>   res at vfXArray = xlon
>>>>>>>>   res at vfYArray = xlat
>>>>>>>>
>>>>>>>> The set of warning:cn* messages can be ignored as you are calling
>>>>>>>> gsn_csm_vector_scalar_map with a common set of resources for both contour
>>>>>>>> and vectors.
>>>>>>>>
>>>>>>>> The gsn_csm_map_ce error message was referenced by Dennis in a
>>>>>>>> previous email, change gsn_csm_vector_scalar_map_ce
>>>>>>>> to gsn_csm_vector_scalar_map.
>>>>>>>>
>>>>>>>> Finally, I noted in a previous email to remove the gsn_panel call.
>>>>>>>> When overlaying one plot on the other, the generic format of a script looks
>>>>>>>> like this:
>>>>>>>>
>>>>>>>> res = True
>>>>>>>> res at gsnDraw = False
>>>>>>>> res at gsnFrame = False
>>>>>>>> ....
>>>>>>>> plot = gsn_csm_contour_map(...
>>>>>>>>
>>>>>>>> res2 = True
>>>>>>>> res2 at gsnDraw = False
>>>>>>>> res2 at gsnFrame = False
>>>>>>>> ....
>>>>>>>> oplot = gsn_csm_contour(...
>>>>>>>> overlay(plot,oplot)
>>>>>>>> draw(plot)
>>>>>>>> frame(plot)
>>>>>>>>
>>>>>>>> If you throw a gsn_panel call in between the plot = and the oplot =
>>>>>>>> lines, you will not be able to overlay the oplot on the plot.
>>>>>>>>
>>>>>>>> Please apply the suggestions above before responding to ncl-talk,
>>>>>>>> and as always, only respond to the ncl-talk email list.
>>>>>>>> Adam
>>>>>>>>
>>>>>>>> On Fri, Aug 30, 2019 at 7:47 AM Setareh Rahimi via ncl-talk <
>>>>>>>> ncl-talk at ucar.edu> wrote:
>>>>>>>>
>>>>>>>>> Dear Dennis,
>>>>>>>>> Thanks for your help. I added shapefile to the script, but it does
>>>>>>>>> not show wind vectors again. just showing emission flux and border of
>>>>>>>>> desire. I attached the script. What should I do please? I have tried:
>>>>>>>>> overlay(plotc,shape1), but faced an error.
>>>>>>>>> Thanks in advance,
>>>>>>>>> Best wishes,
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On Wed, Aug 28, 2019 at 8:17 PM Dennis Shea <shea at ucar.edu> wrote:
>>>>>>>>>
>>>>>>>>>>  You used:
>>>>>>>>>>   plot=*gsn_csm_vector_scalar_map_ce*(wks,u(ut,:,:),v(ut,:,:),
>>>>>>>>>> x(nt,:,:),res)
>>>>>>>>>>
>>>>>>>>>> The *_ce *means 'cylindrical equidistant' ....
>>>>>>>>>> You *must* have seen a Warning message! Did you try to address
>>>>>>>>>> the issue?
>>>>>>>>>> ---
>>>>>>>>>> The attached draws a contour over a map; then overlays a vector
>>>>>>>>>> plot.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> *https://www.ncl.ucar.edu/Applications/overlay.shtml*
>>>>>>>>>> <https://www.ncl.ucar.edu/Applications/overlay.shtml>
>>>>>>>>>>
>>>>>>>>>> You used
>>>>>>>>>>
>>>>>>>>>> On Wed, Aug 28, 2019 at 12:28 AM Setareh Rahimi via ncl-talk <
>>>>>>>>>> ncl-talk at ucar.edu> wrote:
>>>>>>>>>>
>>>>>>>>>>> Dear Adam,
>>>>>>>>>>> You and Rick are right, but the problem was not fixed with
>>>>>>>>>>> removing gsn_panel. On the other hand, I tried to add res at gsnDraw
>>>>>>>>>>> = False and res at gsnFrame =  False to my first res resource
>>>>>>>>>>> list, but I saw no change. I need to plot wind vectors over surface dust
>>>>>>>>>>> emission flux.
>>>>>>>>>>> Thank you for your email.
>>>>>>>>>>> Best wishes
>>>>>>>>>>>
>>>>>>>>>>> On Mon, Aug 26, 2019 at 9:54 PM Adam Phillips <asphilli at ucar.edu>
>>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hi Setareh,
>>>>>>>>>>>> Rick is correct that you should remove the gsn_panel call, as
>>>>>>>>>>>> gsn_panel is not needed if you are creating a single plot. You will also
>>>>>>>>>>>> need to add res at gsnDraw = False and res at gsnFrame =  False to
>>>>>>>>>>>> your first res resource list, as you do not want to draw the plot nor
>>>>>>>>>>>> advance the frame until you have added the wind vector overlay to the
>>>>>>>>>>>> original plot. Those changes should fix the issue you are having.
>>>>>>>>>>>> Adam
>>>>>>>>>>>>
>>>>>>>>>>>> On Fri, Aug 23, 2019 at 11:17 AM Setareh Rahimi via ncl-talk <
>>>>>>>>>>>> ncl-talk at ucar.edu> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>> Dear Rick,
>>>>>>>>>>>>> I did your suggestion, but nothing changed.
>>>>>>>>>>>>> Thank you
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Fri, Aug 23, 2019 at 8:14 PM Rick Brownrigg <
>>>>>>>>>>>>> brownrig at ucar.edu> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>> Hi,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> I'm a little confused about the call the gsn_panel() to draw
>>>>>>>>>>>>>> a "panel" plot of the emflx variable in a 1x1 panel, and then the
>>>>>>>>>>>>>> subsequent call to overlay() overlaying the wind speed on top of emflx.
>>>>>>>>>>>>>> You might try removing the call the gsn_panel().
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Rick
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On Fri, Aug 23, 2019 at 9:21 AM Setareh Rahimi via ncl-talk <
>>>>>>>>>>>>>> ncl-talk at ucar.edu> wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Dear all,
>>>>>>>>>>>>>>> I need to plot my desirable varible called "emflx", and wind
>>>>>>>>>>>>>>> direction ( wind at 10m)  on one plot. Once I run the script, it just plot
>>>>>>>>>>>>>>> the wind direction, not 'emflx' . Would you please kindy advise me in this
>>>>>>>>>>>>>>> regards.
>>>>>>>>>>>>>>> data and  the script, attached.
>>>>>>>>>>>>>>> Many thanks in advanc,
>>>>>>>>>>>>>>> Best wishes,
>>>>>>>>>>>>>>>  Haboob-May-28-first_ATM.2018052400.nc
>>>>>>>>>>>>>>> <https://drive.google.com/file/d/11LHXIs8w-nI--3cLwgGs9ulREVuBwX7h/view?usp=drive_web>
>>>>>>>>>>>>>>>  Haboob-May-28-first_DUST04.2018052400.nc
>>>>>>>>>>>>>>> <https://drive.google.com/file/d/1ICE51X0dN-tM4ffBwk6vo-uBUDR_ASLd/view?usp=drive_web>
>>>>>>>>>>>>>>>  wind.ncl
>>>>>>>>>>>>>>> <https://drive.google.com/file/d/1grYpZhKNcr1Flt0wF2xNJVbUK9b1dK2b/view?usp=drive_web>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>> S.Rahimi
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>>>>> ncl-talk mailing list
>>>>>>>>>>>>>>> ncl-talk at ucar.edu
>>>>>>>>>>>>>>> List instructions, subscriber options, unsubscribe:
>>>>>>>>>>>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> --
>>>>>>>>>>>>> S.Rahimi
>>>>>>>>>>>>>
>>>>>>>>>>>>> _______________________________________________
>>>>>>>>>>>>> ncl-talk mailing list
>>>>>>>>>>>>> ncl-talk at ucar.edu
>>>>>>>>>>>>> List instructions, subscriber options, unsubscribe:
>>>>>>>>>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>> Adam Phillips
>>>>>>>>>>>> Associate Scientist,  Climate and Global Dynamics Laboratory,
>>>>>>>>>>>> NCAR
>>>>>>>>>>>> www.cgd.ucar.edu/staff/asphilli/   303-497-1726
>>>>>>>>>>>>
>>>>>>>>>>>> <http://www.cgd.ucar.edu/staff/asphilli>
>>>>>>>>>>>>
>>>>>>>>>>> _______________________________________________
>>>>>>>>>>> ncl-talk mailing list
>>>>>>>>>>> ncl-talk at ucar.edu
>>>>>>>>>>> List instructions, subscriber options, unsubscribe:
>>>>>>>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> S.Rahimi
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> ncl-talk mailing list
>>>>>>>>> ncl-talk at ucar.edu
>>>>>>>>> List instructions, subscriber options, unsubscribe:
>>>>>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Adam Phillips
>>>>>>>> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
>>>>>>>> www.cgd.ucar.edu/staff/asphilli/   303-497-1726
>>>>>>>>
>>>>>>>> <http://www.cgd.ucar.edu/staff/asphilli>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> S.Rahimi
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> Adam Phillips
>>>>>> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
>>>>>> www.cgd.ucar.edu/staff/asphilli/   303-497-1726
>>>>>>
>>>>>> <http://www.cgd.ucar.edu/staff/asphilli>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> S.Rahimi
>>>>>
>>>>>
>>>>
>>>> --
>>>> Adam Phillips
>>>> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
>>>> www.cgd.ucar.edu/staff/asphilli/   303-497-1726
>>>>
>>>> <http://www.cgd.ucar.edu/staff/asphilli>
>>>>
>>>
>>>
>>> --
>>> S.Rahimi
>>>
>>>
>>
>> --
>> Adam Phillips
>> Associate Scientist,  Climate and Global Dynamics Laboratory, NCAR
>> www.cgd.ucar.edu/staff/asphilli/   303-497-1726
>>
>> <http://www.cgd.ucar.edu/staff/asphilli>
>>
>
>
> --
> S.Rahimi
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190915/d592ab11/attachment.html>


More information about the ncl-talk mailing list