[gradsusr] Why the "set line" command does not work

Jeff Duda jeffduda319 at gmail.com
Wed Jun 20 13:29:07 EDT 2018


sublin() is a means of parsing text. The input should be output from a
previous read() or the grads script keyworld *result* which is a default
keyword into which any text output from any command is stored. For example,
if you run the command
'q w2xy 0.1 4400'
as you might have in your script, the output text, which has multiple
lines, is entirely stored in the script variable "result". You could then
use sublin(result,n) to extract the nth line from "result". subwrd() is
used to extract individual words (assumed parsed by spaces) from a line of
text. Substr() is used to extract sub-strings from larger strings. So
basically you can use these internal functions in order to rip whatever
text you need to out of output from Grads. These can also be used to read
external ascii files provided they are formatted properly. Unfortunately
these internal functions do not handle CSV output correctly, so you have to
write your own code to handle that, but once you do that it can be widely
applicable.

A quick example from my own work: I opened a GRIB2 file processed by UPP
(originally from WRF output) and displayed composite reflectivity:

ga-> d refcclm

Notice:  Automatic Grid Interpolation Taking Place

Contouring: -10 to 60 interval 10

The keyword variable *result* will have the following string stored in it:
"Notice:  Automatic Grid Interpolation Taking Place

Contouring: -10 to 60 interval 10"


So I could say

line = sublin(result,2)

to extract just


"Contouring: -10 to 60 interval 10"


and store that as "line"


Jeff Duda


On Wed, Jun 20, 2018 at 1:46 AM Gevorgyan Artur <agm86 at yandex.ru> wrote:

> Dear Jeff,
>
> Thank you so much for your help! It was enough to use the 'q w2xy' and
> 'draw line' commands. I tried to understand how to use the the sublin()
> internal function in my task, but I couldn't. Anyway, I solved the problem
> with your help.
>
> Best regards,
> Artur
>
>
> 18.06.2018, 20:17, "Jeff Duda" <jeffduda319 at gmail.com>:
>
> You can use the query commands (just type q <enter> at the command line
> and it will give you a list of the available commands and what they do).
> But you'll probably want to use 'q w2xy' which converts "world" coordinates
> (in this case, your two "world" dimensions are height and mixing ratio)
> into x/y page coordinates, which is what you need in a 'draw string' or
> 'draw line' command. So the syntax is 'q w2xy (horizontal axis value)
> (vertical axis value)' and you'll see that it will spit out real-page X and
> Y coordinate. You'll need to use the sublin() and subwrd() internal
> functions to capture those values and then insert them into your 'draw
> line' command.
>
> Jeff Duda
>
> On Mon, Jun 18, 2018 at 12:51 AM Gevorgyan Artur <agm86 at yandex.ru> wrote:
>
> Dear Jeff,
>
> Thanks a lot, the *set ccolor *command works now! I have one more
> question, I want to add a horizontal line at 4400 m in my plot,
> corresponding to the freezing level in clouds. How can I do that?
>
> Best regards,
> Artur
>
>
> 18.06.2018, 02:52, "Jeff Duda" <jeffduda319 at gmail.com>:
>
> For the 'set line' stuff, try using ccolor and cthick instead. I'm not
> sure why the cmark command didn't work, but you can try altering the order
> of the commands. Some commands reset certain plotting behaviors (although I
> don't think anything should specifically reset a cmark command).
>
> Jeff
>
>
> On Sun, Jun 17, 2018 at 12:27 PM Gevorgyan Artur <agm86 at yandex.ru> wrote:
>
> Dear Sir/Madam,
>
> I am trying to plot vertical profiles for simulated cloud microphysical
> paramaters using specified line colors and styles through the *set line*
> command. Please find attached my *QCLOUD.gs* script file. However, GrADS
> ignores the *set line* commands applying some default colors and only
> solid lines for vertical profiles shown in the Figure (n.jpg, attached). I
> am using Open GrADS version 2.0.2.oga.2.
>
> Best regards,
> Artur
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>
>
> --
> Jeff Duda, Research Scientist
>
> University of Colorado Boulder
>
> Cooperative Institute for Research in Environmental Sciences
>
> NOAA/OAR/ESRL/Global Systems Division
> Boulder, CO
> ,
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
>
> --
> Jeff Duda, Research Scientist
>
> University of Colorado Boulder
>
> Cooperative Institute for Research in Environmental Sciences
>
> NOAA/OAR/ESRL/Global Systems Division
> Boulder, CO
> ,
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>
> _______________________________________________
> gradsusr mailing list
> gradsusr at gradsusr.org
> http://gradsusr.org/mailman/listinfo/gradsusr
>


-- 
Jeff Duda, Research Scientist

University of Colorado Boulder

Cooperative Institute for Research in Environmental Sciences

NOAA/OAR/ESRL/Global Systems Division
Boulder, CO
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gradsusr.org/pipermail/gradsusr/attachments/20180620/d8101700/attachment.html>


More information about the gradsusr mailing list