[ncl-talk] Combining Plots

Dave Allured - NOAA Affiliate dave.allured at noaa.gov
Sat Aug 10 11:23:58 MDT 2019


Here is an alternate approach that would split up the time-consuming data
preparation into manageable chunks.  It seems like you need something like
this.  Split up your existing program into two separate programs.  One
program would do data preparation only, and the other program would only do
plot generation.  In between would be a set of Netcdf intermediate files,
one for each of your individual scatter plots.

Each Netcdf file would contain the necessary X/Y information to make one
complete scatter plot.  For example, you now have:

    plot1 = gsn_csm_xy(wks,prec_wk,wrf_prec_wks,res)

So you could calculate the two arrays prec_wk and wrf_prec_wks and save
them to a Netcdf file.  I recommend a separate Netcdf file with a unique
file name, for each of your data scenarios (weeks, years, site locations,
whatever).  You can also include supplemental information such as labels,
as attributes or extra file variables.  This way, you can independently
develop and update each data scenario.

Once all of the incoming information is digested into several X/Y sets, NCL
is fast and efficient when generating multiple scatter plots as overlays.
NCL does not have the ability to read back finished graphics products like
PDF and PNG, but it can easily work with the raw numeric data that is the
final stage before making a set of plot overlay layers.


On Fri, Aug 9, 2019 at 2:56 PM Adam Phillips via ncl-talk <ncl-talk at ucar.edu>
wrote:

> Hi Zack,
> If I understand your questions correctly, you'd like to be able to look at
> the intermediate overlays before the final overlay is done, correct? If so
> I don't think you can do this totally within NCL. You can however use Image
> Magick and the composite command to combine images outside of NCL, which
> you can write into your script. You would want to write out each
> scatterplot as it's own image, and overlay them using the composite
> command. That would allow you to look at the scatterplots as they get
> created. You can even leave the existing coding intact for the plots, and
> create a 2nd set of plotting calls for each plot that will be used by Image
> Magick.
> https://imagemagick.org/script/composite.php
> Perhaps others will have a better idea, but this is the only option that I
> see.
> Adam
>
>
> On Fri, Aug 9, 2019 at 12:15 PM Zach Rieck via ncl-talk <ncl-talk at ucar.edu>
> wrote:
>
>> To whom it May Concern-
>>
>> I have several scatter plots that I want to combine into 1. My codes for
>> each source file are comprehensive and take a while to compile (~10 min). I
>> could create a master code and overlay everything, but I don't want to be
>> waiting an hour for the plot to generate.
>>
>> What I'd like to do is modify my code to open the scatter plot and
>> overlay the plots on top of each other into one. This seems like something
>> that should be relatively straightforward to do, but I can't find any
>> examples that guide me through the syntax.
>>
>> If code is helpful, I have it attached, but generally trying to frame
>> this as a conceptual question. If you can show how to merge any PDF plots
>> (or png if necessary) I can figure the rest out.
>>
>> Thanks for the help!
>>
>> Respectfully,
>> -Zach Rieck
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20190810/6c452d47/attachment.html>


More information about the ncl-talk mailing list