[ncl-talk] Temperature difference

Mary Haley haley at ucar.edu
Tue Nov 28 09:31:33 MST 2017


Muhammad,

Dennis asked for a graphics person to look into your question.

You said that the last two lines of your code were not working, which are
the lines where you are trying to add shapefile outlines.

I assume this is the line that adds the shapefile outlines:

    plot = add_coastline_sgmyid(shape_files,wks,plot,"black")

This looks like a function you created, but it is not part of your script.
Can you include it?

Also, do you get any errors when you run this script?

As a test, you can try commenting out the call to this function and instead
try this (UNTESTED):

nshp_files = dimsizes(shape_files)
shp_id     = new(nshp_files,graphic)
do n=0,nshp_files-1
  shp_id(n) = gsn_add_shapefile_polylines(wks,plot,shape_files(n),lnres)
end do

draw(plot)
frame(wks)

--Mary



On Sun, Nov 19, 2017 at 3:03 AM, Muhammad Omer Mughal <
m.mughal1 at postgrad.curtin.edu.au> wrote:

> Hi
>
>
> Thanks for the reply. Yes I have been using NCL for a while but since CDO
> has changed the dimensions of the variables therefore it was difficult for
> me to plot. Any how I have used the map resources from a file named "c" in
> the attached code and it worked. Now the last two lines of the code are
> supposed to add the outline using a shape file but it is not appearing in
> the output without showing any error. Can you kindly suggest why its not
> being added to the output ?
>
>
>
>
>
> Muhammad Omer Mughal
> MSc BSc Mechanical Engineering
> PhD  Research Scholar
> Remote Sensing and Satellite Research Group
> Department of Imaging and Applied Physics
> Curtin University
>
> Curtin University
> Tel | +61 8 9266 7962
> Fax | +61 8 9266 2377
> Mobile | 0470 237 525
>
> Email | m.mughal1 at postgrad.curtin.edu.au <m.lynch at curtin.edu.au>
> Web | http://curtin.edu.au
>
> Curtin University is a trademark of Curtin University of Technology.
> CRICOS Provider Code 00301J (WA), 02637B (NSW)
>
>
> ------------------------------
> *From:* Dennis Shea <shea at ucar.edu>
> *Sent:* Sunday, 19 November 2017 2:35:53 AM
>
> *To:* Muhammad Omer Mughal
> *Cc:* ncl-talk at ucar.edu
> *Subject:* Re: Temperature difference
>
> You have been using NCL for some time. You should know:
>
> [1]* 'diff' is a variable*.
>       Attributes [ *@ *] include long_name, units and, if appropriate for
> some map graphics, the special lat2d and lon2d attributes.
>       Coordinate variables [ *&* ] eg: time, lev,lat,lon could also be
> assigned ... if appropriate.
>       You can manually set these or use
>       See:
>              https://www.ncl.ucar.edu/Document/Functions/
> Contributed/copy_VarCoords.shtml
>              https://www.ncl.ucar.edu/Document/Functions/
> Contributed/copy_VarAtts.shtml
>              https://www.ncl.ucar.edu/Document/Functions/
> Contributed/copy_VarMeta.shtml
>
> [2] There are many NCL examples on the Applications page variables plotted
> on 'maps'. Please look.
>       *'res' is a variable* to which *all* 'map', in fact, all graphical
> resources are associated.
>
> ===
> To review NCL, please carefully read the User Guide at:
>                 http://www.ncl.ucar.edu/Document/Manuals/
> It has many examples.
>
> Good Luck
>
> On Sat, Nov 18, 2017 at 9:28 AM, Muhammad Omer Mughal <
> m.mughal1 at postgrad.curtin.edu.au> wrote:
>
> Hi
>
>
> Can I assign map resources to diff ?
>
>
>
>
> Muhammad Omer Mughal
> MSc BSc Mechanical Engineering
> PhD  Research Scholar
> Remote Sensing and Satellite Research Group
> Department of Imaging and Applied Physics
> Curtin University
>
> Curtin University
> Tel | +61 8 9266 7962
> Fax | +61 8 9266 2377
> Mobile | 0470 237 525
>
> Email | m.mughal1 at postgrad.curtin.edu.au <m.lynch at curtin.edu.au>
> Web | http://curtin.edu.au
>
> Curtin University is a trademark of Curtin University of Technology.
> CRICOS Provider Code 00301J (WA), 02637B (NSW)
>
>
> ------------------------------
> *From:* Dennis Shea <shea at ucar.edu>
> *Sent:* Saturday, 18 November 2017 11:04:59 PM
> *To:* Muhammad Omer Mughal
> *Cc:* ncl-talk at ucar.edu
> *Subject:* Re: Temperature difference
>
> I speculate you are overwriting the generated png file with each iteration.
>
> ---
> [1] Move the following before the 'do' loop
>
> wks = gsn_open_wks("png","diff")
>
> or
>
> [2] Keep it where it is but make the line
>
> wks = gsn_open_wks("png","diff_"+sprinti("%0.2i", it) )
>
> On Sat, Nov 18, 2017 at 2:51 AM, Muhammad Omer Mughal <
> m.mughal1 at postgrad.curtin.edu.au> wrote:
>
> Hi
>
>
> I am trying to use the following script to generate a temperature
> difference between two files. This script should generate 24 plots instead
> of just one. When I add "it" in tc2= wrf_user_getvar(a,"T2",it) then I
> get this error "Subscript out of range, error in subscript #0". This
> could be because I used NCO to generate these files which stripped out the
> time dimension since I have averaged them over time. I would appreciate if
> some one can help me out here. Kindly note that I donot intend to waste
> someone personal time.
>
>
> do it=0,23
>  wrf_file1 = "UTC_" + it + ".nc"
>  a = addfile(wrf_file1, "r")
>  wrf_file2 = "../OmerForest/UTC_" + it + ".nc"
>  b=addfile(wrf_file2,"r")
>
> tc2= wrf_user_getvar(a,"T2",0)
> tcf= wrf_user_getvar(b,"T2",0)
> diff=tc2-tcf
> wks = gsn_open_wks("png","diff")
> res=True
> plot = gsn_csm_contour(wks,diff,res)
>  end do
>
>
>
> Muhammad Omer Mughal
> MSc BSc Mechanical Engineering
> PhD  Research Scholar
> Remote Sensing and Satellite Research Group
> Department of Imaging and Applied Physics
> Curtin University
>
> Curtin University
> Tel | +61 8 9266 7962
> Fax | +61 8 9266 2377
> Mobile | 0470 237 525
>
> Email | m.mughal1 at postgrad.curtin.edu.au <m.lynch at curtin.edu.au>
> Web | http://curtin.edu.au
>
> Curtin University is a trademark of Curtin University of Technology.
> CRICOS Provider Code 00301J (WA), 02637B (NSW)
>
>
>
>
>
> _______________________________________________
> 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/20171128/945ba40b/attachment.html>


More information about the ncl-talk mailing list