[ncl-talk] Problem with overlay plot

Mary Haley haley at ucar.edu
Tue Aug 19 12:57:00 MDT 2014


Ipsita,

Thanks for providing your code and data.

I'm a bit confused by the code, because the "LH4" variable purposely has
all the metadata stripped off by this command:

  LH4=(/L3*24/)

You want to preserve metadata, especially coordinate arrays, if you are
going to be plotting and/or overlaying variables.

   LH4=L3
   LH4=L3*24    ; preserve metadata

You also want to do this for "wscale":

   wscale=W         ; Trick for copying metadata

   wscale=W*scale

The above two lines could also be done like this:

   wscale=W*scale
   copy_VarMeta(W,wscale)      ; Copy all metadata from W to wscale

Another issue is you are plotting LH4 using "gsn_contour" instead of
"gsn_csm_contour". You want to use "gsn_csm_xxxx" scripts where possible,
because they examine your variable to check for metadata, and will use that
metadata, including coordinate arrays, to correctly plot it.

Even with these corrections, the overlay is not going to work properly
because your "lev" coordinate array is different in for your LH4 variable
than it is for your wscale/U variables.  In order for "overlay" to work,
your X/Y coordinate arrays must be in the same data space.

For LH4, note that the "lev" values go from 0 to 14:

Variable: LH4
Type: float
Total Size: 164160 bytes
            41040 values
Number of Dimensions: 2
Dimensions and sizes: [lev | 57] x [lon | 720]
Coordinates:
            lev: [   0..  14]
            lon: [-179.75..179.75]

For wscale "levels" looks like this:

Variable: wscale
Type: float
Total Size: 72000 bytes
            18000 values
Number of Dimensions: 2
Dimensions and sizes: [levels | 25] x [lon | 720]
Coordinates:
            levels: [1000.. 100]
            lon: [-180..179.5]

Finally, you are calling "draw()", but you need to also call "frame(wks)"
after the "draw" command so that the graphic is ended properly.

Please fix these issues and post to ncl-talk if you continue to have
problems.

--Mary




On Mon, Aug 18, 2014 at 11:12 PM, Ipsita Putatunda <
ipsita.putatunda at gmail.com> wrote:

> Hi Mary,
>      I have tried as per your suggestion to first overlay the plots and
> then to attach, but it is not doing as per my requirements. As my data is
> from -179 to 179 longitude wise and I want to plot from -30 to -30 that is
> why am attaching two plots from -30 to 179  and 179 to -30 longitude. I
> finally want to over lay one vector plot and one contour plot. My script
> with data files are attached herewith.
> Any help will be appreciated.
>
> Thanks,
> Ipsita​
>  GLOBAL_SON.nc
> <https://docs.google.com/file/d/0B438RTfd8A-Nc1NXeHNzMHZHekE/edit?usp=drive_web>
> ​​
>  MERRA_regrid.nc
> <https://docs.google.com/file/d/0B438RTfd8A-NSGR3XzJGbHo3OHc/edit?usp=drive_web>
>>
>
> On Thu, Aug 14, 2014 at 9:03 PM, Mary Haley <haley at ucar.edu> wrote:
>
>> Ipsita,
>>
>> I'm not exactly sure how you want your final plot to look, but the
>> "overlay" procedure really is meant to be used to do simply overlays of
>> say, contours on a map, or vectors on contours on a map, etc.
>>
>> It looks like you are trying to attach some plots via X and/or Y axes,
>> and then try to use these as overlays, which won't work. The
>> gsn_attach_plots (which is perhaps poorly named) is simply meant to join
>> several plots together along a given axis.
>>
>> My suggestion is to overlay the plots *before* you call gsn_attach_plots.
>>
>> If you continue to have problems, please describe your desired result in
>> more detail, and what you are currently getting of your script that isn't
>> correct.
>>
>> As always, it helps if you can provide a full script and your data so we
>> can run the script here.
>>
>> Thanks,
>>
>> --Mary
>>
>>
>>
>> On Wed, Aug 13, 2014 at 1:18 PM, Ipsita Putatunda <
>> ipsita.putatunda at gmail.com> wrote:
>>
>>> Hi,
>>>   I want to get an overlay plot of two plots which are created by
>>> attached plot. I have tried with overlay function which is not giving my
>>> desired plot. I tried with setting vpXF, vpYF for each plot also, but still
>>> am not getting overlaid plot. Is attaching plots before overlaying is
>>> causing the problem? Plotting part of my script is attached herewith.
>>> Please help me to solve this issue.
>>>
>>> Thanks,
>>> Ipsita
>>>
>>> _______________________________________________
>>> ncl-talk mailing list
>>> 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/20140819/f6a967da/attachment.html 


More information about the ncl-talk mailing list