[gradsusr] Combining two shaded variables.

Chorley Weather weatherstu at chorleyweather.com
Fri Aug 7 11:58:18 EDT 2015


On 07-08-2015 16:40, Stephen McMillan wrote:
> Stuart,
> Thanks for sending your script.
> 
> The reason the output keeps replacing the previous image is because
> the output filename is static, i.e., it is replacing the previous one
> with each loop.  Following is a suggested fix to the affected line,
> where i changed pcpn-cldcvr.png to pcpn-cldcvr'i'.png:
> 
> 'printim pcpn-cldcvr'i'.png x1100 y675 -b gfs_ukcloudcover1'i'.png  -t
> 0';#overlay/save 2nd variable on previous image, black as transparent
> 
> Note:  if you don't need to keep each background image, you could make
> its name static since it would be replaced with each loop.
> 
> Let me know if you have an additional question.  Otherwise, good luck!
> Stephen Mc
> 
> On Fri, Aug 7, 2015 at 9:58 AM, Chorley Weather
> <weatherstu at chorleyweather.com> wrote:
> 
>> On 07-08-2015 14:36, Stephen McMillan wrote:
>> 
>> Stuart,
>> Thanks for providing the script, that certainly helps. With the
>> first
>> image, I have no problem getting the tcdcclm overlaid with apcpsfc.
>> However, as it is, your code will generate only one such map since
>> it
>> should exit after the first timestep (=3). What is the value of
>> "map"?
>> Stephen
>> 
>> On Fri, Aug 7, 2015 at 8:29 AM, Chorley Weather
>> <weatherstu at chorleyweather.com> wrote:
>> 
>> On 07-08-2015 13:19, Stephen McMillan wrote:
>> Hi,
>> I don't quite follow what you're trying to do, since your last
>> two
>> sample lines appear precisely the same. Bottom line, for it to
>> work:
>> 
>> - Display first variable, save it
>> - Clear, then display second variable, then save it with previous
>> saved map as the background and a specified transparent color
>> -To add a third variable, clear, then display the third variable,
>> then
>> save it with the second saved map as background and specified
>> transparent color
>> -And so on
>> 
>> If above is not addressing your problem then, to properly
>> diagnose it,
>> it would help for you to send the appropriate lines of your code
>> that
>> you are using. Also, which version of GrADS are you using?
>> Stephen Mc
>> 
>> On Fri, Aug 7, 2015 at 5:33 AM, Chorley Weather
>> <weatherstu at chorleyweather.com> wrote:
>> 
>> On 05-08-2015 19:31, Stephen McMillan wrote:
>> 
>> Jose, Stuart,
>> 
>> Jeff's recommendation for 2.1+ and the alpha channel is probably
>> the
>> best way to go since you can control the
>  transparency/opaqueness,
> 
>>> but
>>> here's a sample script if you don't have or don't want to
>  upgrade.
> 
>>> Cloud clover with precip overlay sample attached, along with
>  script
> 
>>> that created it.
>>> 
>>> Good luck!
>>> Stephen Mc
>>> 
>>> On Wed, Aug 5, 2015 at 1:36 PM, Jeff Duda
>  <jeffduda319 at gmail.com>
> 
>>> wrote:
>>> 
>>> Upgrade to version 2.1+ and use the alpha channel when creating
>>> colors.
>>> 
>>> Jeff
>>> 
>>> On Wed, Aug 5, 2015 at 12:15 PM, Chorley Weather
>>> <weatherstu at chorleyweather.com> wrote:
>>> 
>>> On 05-08-2015 16:09, Stephen McMillan wrote:
>>> Stuart,
>>> 1. Display first variable then save to an image file
>>> 2. Clear screen, then display second variable
>>> 3. Save to another file using first file as background (-b
>>> option)
>>> and specify an appropriate transparent color (-t option)
>>> 
>>> Resulting saved map should be without the rough, pixelated
>>> edges
>>> 
>>> Stephen Mc
>>> 
>>> On Wed, Aug 5, 2015 at 10:04 AM, Chorley Weather
>>> <weatherstu at chorleyweather.com> wrote:
>>> 
>>> Hi guys,
>>> 
>>> I have been trying to combine two shaded variables in one
>> image,
>> 
>> for
>> example precip & cloud cover. I have tried the maskout
>  function but
> 
>>> the
>>> output looks to rough and pixelated. Can anybody suggest a
>  better
> 
>>> way to
>>> get a smoother result.
>>> 
>>> Many thanks in advance
>>> Stuart.
>>> 
>>> --
>>> Chief Forecaster & Owner
>>> _______________________________________________
>>> gradsusr mailing list
>>> gradsusr at gradsusr.org
>>> http://gradsusr.org/mailman/listinfo/gradsusr [1] [1] [1] [1] [1]
>> 
>> Links:
>> ------
>> [1] http://gradsusr.org/mailman/listinfo/gradsusr [1] [1] [1] [1]
>> 
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr [1] [1] [1] [1]
>  Thanks Stephen, I will have a go at that cheers.
>  --
>  Chief Forecaster & Owner
>  _______________________________________________
>  gradsusr mailing list
>  gradsusr at gradsusr.org
>  http://gradsusr.org/mailman/listinfo/gradsusr [1] [1] [1] [1]
> 
>  --
> 
>  Jeff Duda
>  Graduate research assistant
>  University of Oklahoma School of Meteorology
>  Center for Analysis and Prediction of Storms
> 
>  _______________________________________________
>  gradsusr mailing list
>  gradsusr at gradsusr.org
>  http://gradsusr.org/mailman/listinfo/gradsusr [1] [1] [1] [1]
> 
>  Links:
>  ------
>  [1] http://gradsusr.org/mailman/listinfo/gradsusr [1] [1] [1]
> 
>  _______________________________________________
>  gradsusr mailing list
>  gradsusr at gradsusr.org
>  http://gradsusr.org/mailman/listinfo/gradsusr [1] [1] [1]
> 
>  Hi Stephen,
> 
>  The sample script you sent has worked well with my own variables
> 
>  as
> 
>> shown in the attached image. The problem I have is the output
>  image
> 
>> keeps replacing the previous image, ie. my printim is
>> 
>> 'printim pcpn-cldcvr.png x1100 y675 -b gfs_ukcloudcover1'i'.png
>  -t
> 
>> 0';#overlay/save 2nd variable on previous image, black as
>  transparent.
> 
>> How do i script it were i get printim pcpn-cldcvr1.png x1100
>  y675
> 
>> printim pcpn-cldcvr2.png x1100
>  y675
> 
>> printim pcpn-cldcvr2.png x1100
>  y675
> 
>> And so on.
>> 
>> --
>> Chief Forecaster & Owner
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr [1] [1] [1]
>> 
>> Links:
>> ------
>> [1] http://gradsusr.org/mailman/listinfo/gradsusr [1] [1]
>> 
>> _______________________________________________
>> gradsusr mailing list
>> gradsusr at gradsusr.org
>> http://gradsusr.org/mailman/listinfo/gradsusr [1] [1]
>  Hi Stephen,
> 
>  The last sample line was supposed to be 3.png (typo). I'm using
>  opengrads and the code is thus:
> 
>  i = 3
>  while ( i<maps )
> 
>  * Set up a few preliminary characteristics
>  setmap(1)
>  setSMcols(1)
>  'set t 'i
> 
>  *'define dew = const((dewpt(tmp2m,rh2m)-273.16),0,-u)'
>  'set gxout shaded'
>  'set csmooth on'
>  'set clevs 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95
>  100'
>  'set ccols 0 63 62 61 60 59 58 57 56 55 54 53 52 51 50 47 46 45 44
>  43 42
>  41 17 39 38 37 36 35 34 33'
> 
>  'd tcdcclm'
> 
>  'cbar'
>  'printim gfs_ukcloudcover1'i'.png x1100 y675';#1st (backgrd) image
> 
>  'c'
> 
>  setstucols(1)
>  'set t 'i
>  'set gxout shaded'
>  'set csmooth on'
>  'set clevs 0.2 0.5 1.5 2 3 4 5 6 7 8 9 10 13 16 19 22 25 30 35 40
>  45 50
>  60 70 80 90 100'
>  'set ccols 0 43 44 45 46 47 48 49 39 38 37 36 35 33 22 23 24 25 26
>  27 28
>  29 67 66 65 64 63 62 61'
> 
>  'd apcpsfc'
> 
>  'printim pcpn-cldcvr.png x1100 y675 -b gfs_ukcloudcover1'i'.png -t
>  0';#overlay/save 2nd variable on previous image, black as
>  transparent
> 
>  i = i+1
>  endwhile
> 
>  Like I said the output image just re writes over the last, so I
>  only
>  ever have 1 image. I should be getting 80+ images. Thanks for your
>  advice.
> 
>  regards,
>  Stuart
> 
>  --
>  Chief Forecaster & Owner
>  _______________________________________________
>  gradsusr mailing list
>  gradsusr at gradsusr.org
>  http://gradsusr.org/mailman/listinfo/gradsusr [1] [1]
> 
>  Links:
>  ------
>  [1] http://gradsusr.org/mailman/listinfo/gradsusr [1]
> 
>  _______________________________________________
>  gradsusr mailing list
>  gradsusr at gradsusr.org
>  http://gradsusr.org/mailman/listinfo/gradsusr [1]
>  Hi Stephen,
> 
>  I have attached the full script so you can have a look through. Once
> again thank you very much.
> 
>  Stuart
>  --
>  Chief Forecaster & Owner
> _______________________________________________
>  gradsusr mailing list
>  gradsusr at gradsusr.org
>  http://gradsusr.org/mailman/listinfo/gradsusr [1]
> 
> 
> 
> Links:
> ------
> [1] http://gradsusr.org/mailman/listinfo/gradsusr
> 
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
Thanks very much Stephen, works a treat. I have been looking at the 
printim code for the last hour because i knew it was that and it turns 
out to be the 'i'. Had to laugh (called myself a few names). Once again 
thanks.

regards,
Stuart
-- 
Chief Forecaster & Owner


More information about the gradsusr mailing list