<div dir="ltr">sublin() is a means of parsing text. The input should be output from a previous read() or the grads script keyworld <i>result</i> which is a default keyword into which any text output from any command is stored. For example, if you run the command<div>'q w2xy 0.1 4400'</div><div>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.</div><div><br></div><div>A quick example from my own work: I opened a GRIB2 file processed by UPP (originally from WRF output) and displayed composite reflectivity:</div><div>
<span></span>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">ga-> d refcclm</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">Notice:<span class="gmail-Apple-converted-space"> </span>Automatic Grid Interpolation Taking Place</span></p>
<p class="gmail-p1" style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">Contouring: -10 to 60 interval 10<span class="gmail-Apple-converted-space"> </span></span></p>
<br></div><div>The keyword variable <i>result</i> will have the following string stored in it:</div><div>"<span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Menlo;font-size:11px">Notice:</span><span class="gmail-Apple-converted-space" style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Menlo;font-size:11px"> </span><span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Menlo;font-size:11px">Automatic Grid Interpolation Taking Place</span><p class="gmail-p1" style="font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;text-decoration-style:initial;text-decoration-color:initial;margin:0px;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">Contouring: -10 to 60 interval 10</span><span style="font-family:sans-serif;font-size:13px;color:rgb(34,34,34)">"</span></p><p class="gmail-p1" style="font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;text-decoration-style:initial;text-decoration-color:initial;margin:0px;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span style="font-family:sans-serif;font-size:13px;color:rgb(34,34,34)"><br></span></p><p class="gmail-p1" style="font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;text-decoration-style:initial;text-decoration-color:initial;margin:0px;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span style="font-family:sans-serif;font-size:13px;color:rgb(34,34,34)">So I could say</span></p><p class="gmail-p1" style="font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;text-decoration-style:initial;text-decoration-color:initial;margin:0px;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span style="font-family:sans-serif;font-size:13px;color:rgb(34,34,34)">line = sublin(result,2)</span></p><p class="gmail-p1" style="font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;text-decoration-style:initial;text-decoration-color:initial;margin:0px;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span style="font-family:sans-serif;font-size:13px;color:rgb(34,34,34)">to extract just </span></p><p class="gmail-p1" style="font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;text-decoration-style:initial;text-decoration-color:initial;margin:0px;color:rgb(0,0,0);background-color:rgb(255,255,255)"><span style="font-family:sans-serif;font-size:13px;color:rgb(34,34,34)"><br></span></p><p class="gmail-p1" style="font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;line-height:normal;text-decoration-style:initial;text-decoration-color:initial;margin:0px;background-color:rgb(255,255,255)"></p><p class="gmail-p1" style="color:rgb(0,0,0);font-family:Menlo;font-size:11px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;line-height:normal;text-decoration-style:initial;text-decoration-color:initial;margin:0px;background-color:rgb(255,255,255)"><span class="gmail-s1" style="font-variant-ligatures:no-common-ligatures">"Contouring: -10 to 60 interval 10</span><span style="font-family:sans-serif;font-size:13px;color:rgb(34,34,34)">"</span></p><p class="gmail-p1" style="color:rgb(0,0,0);font-family:Menlo;font-size:11px;font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;line-height:normal;text-decoration-style:initial;text-decoration-color:initial;margin:0px;background-color:rgb(255,255,255)"><span style="font-family:sans-serif;font-size:13px;color:rgb(34,34,34)"><br></span></p><p class="gmail-p1" style="font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;line-height:normal;text-decoration-style:initial;text-decoration-color:initial;margin:0px;background-color:rgb(255,255,255)">and store that as "line"</p><p class="gmail-p1" style="font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;line-height:normal;text-decoration-style:initial;text-decoration-color:initial;margin:0px;background-color:rgb(255,255,255)"><br></p><p class="gmail-p1" style="font-variant-numeric:normal;font-variant-east-asian:normal;font-weight:normal;font-stretch:normal;line-height:normal;text-decoration-style:initial;text-decoration-color:initial;margin:0px;background-color:rgb(255,255,255)">Jeff Duda</p><p></p></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Jun 20, 2018 at 1:46 AM Gevorgyan Artur <<a href="mailto:agm86@yandex.ru">agm86@yandex.ru</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Dear Jeff,</div><div> </div><div>Thank you so much for your help! It was enough to use the <span style="display:inline!important;float:none;background-color:transparent;color:rgb(0,0,0);font-family:Arial,sans-serif;font-size:14px;font-size-adjust:none;font-stretch:normal;font-style:normal;font-variant:normal;font-weight:400;line-height:normal;text-align:left;text-decoration:none;text-transform:none;white-space:pre-wrap">'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. </span></div><div> </div><div><span style="display:inline!important;float:none;background-color:transparent;color:rgb(0,0,0);font-family:Arial,sans-serif;font-size:14px;font-size-adjust:none;font-stretch:normal;font-style:normal;font-variant:normal;font-weight:400;line-height:normal;text-align:left;text-decoration:none;text-transform:none;white-space:pre-wrap">Best regards,</span></div><div><span style="display:inline!important;float:none;background-color:transparent;color:rgb(0,0,0);font-family:Arial,sans-serif;font-size:14px;font-size-adjust:none;font-stretch:normal;font-style:normal;font-variant:normal;font-weight:400;line-height:normal;text-align:left;text-decoration:none;text-transform:none;white-space:pre-wrap">Artur</span></div><div> </div><div> </div><div>18.06.2018, 20:17, "Jeff Duda" <<a href="mailto:jeffduda319@gmail.com" target="_blank">jeffduda319@gmail.com</a>>:</div><blockquote type="cite"><div>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.<div> </div><div>Jeff Duda</div></div> <div><div>On Mon, Jun 18, 2018 at 12:51 AM Gevorgyan Artur <<a href="mailto:agm86@yandex.ru" target="_blank">agm86@yandex.ru</a>> wrote:</div><blockquote style="margin:0 0 0 0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Dear Jeff,</div><div> </div><div>Thanks a lot, the <strong>set ccolor </strong>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?</div><div> </div><div>Best regards,</div><div>Artur</div><div> </div><div> </div><div>18.06.2018, 02:52, "Jeff Duda" <<a href="mailto:jeffduda319@gmail.com" target="_blank">jeffduda319@gmail.com</a>>:</div><blockquote type="cite"><div>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).</div><div> </div><div>Jeff</div></blockquote></blockquote></div> <div>On Sun, Jun 17, 2018 at 12:27 PM Gevorgyan Artur <<a href="mailto:agm86@yandex.ru" target="_blank">agm86@yandex.ru</a>> wrote:</div><blockquote style="margin:0 0 0 0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div>Dear Sir/Madam,</div><div> </div><div>I am trying to plot vertical profiles for simulated cloud microphysical paramaters using specified line colors and styles through the <strong>set line</strong> command. Please find attached my <strong>QCLOUD.gs</strong> script file. However, GrADS ignores the <strong>set line</strong> 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.</div><div> </div><div>Best regards,</div><div>Artur</div><div> </div>_______________________________________________<br>gradsusr mailing list<br><a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br><a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a></blockquote><br><br>--<div><font size="2"><span>Jeff Duda, Research Scientist</span></font><p style="margin-bottom:0.0001pt"><font size="2"><span><span>University of Colorado Boulder</span></span></font></p><font size="2"><span> </span></font><p style="margin-bottom:0.0001pt"><font size="2"><span><span>Cooperative Institute for Research in Environmental Sciences</span></span></font></p><font size="2"><span> </span></font><p style="margin-bottom:0.0001pt"><font size="2"><span><span>NOAA/OAR/ESRL/Global Systems Division</span></span></font></p><font size="2"><span> <span>Boulder, CO</span></span></font></div> ,<p>_______________________________________________<br>gradsusr mailing list<br><a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br><a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a></p>_______________________________________________<br>gradsusr mailing list<br><a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br><a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br> <div> </div>--<div><font size="2"><span>Jeff Duda, Research Scientist</span></font><p style="margin-bottom:0.0001pt"><font size="2"><span><span>University of Colorado Boulder</span></span></font></p><font size="2"><span> </span></font><p style="margin-bottom:0.0001pt"><font size="2"><span><span>Cooperative Institute for Research in Environmental Sciences</span></span></font></p><font size="2"><span> </span></font><p style="margin-bottom:0.0001pt"><font size="2"><span><span>NOAA/OAR/ESRL/Global Systems Division</span></span></font></p><font size="2"><span> <span>Boulder, CO</span></span></font></div> ,<p>_______________________________________________<br>gradsusr mailing list<br><a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br><a href="http://gradsusr.org/mailman/listinfo/gradsusr" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a></p></blockquote>_______________________________________________<br>
gradsusr mailing list<br>
<a href="mailto:gradsusr@gradsusr.org" target="_blank">gradsusr@gradsusr.org</a><br>
<a href="http://gradsusr.org/mailman/listinfo/gradsusr" rel="noreferrer" target="_blank">http://gradsusr.org/mailman/listinfo/gradsusr</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><font size="2"><span>Jeff Duda, Research Scientist<br>
</span></font><p style="margin-bottom:0.0001pt"><font size="2"><span><span>University of Colorado Boulder</span></span></font></p><font size="2"><span>
</span></font><p style="margin-bottom:0.0001pt"><font size="2"><span><span>Cooperative Institute for Research in Environmental Sciences</span></span></font></p><font size="2"><span>
</span></font><p style="margin-bottom:0.0001pt"><font size="2"><span><span>NOAA/OAR/ESRL/Global Systems Division</span></span></font></p><font size="2"><span>
<span>Boulder, CO</span></span></font>
</div></div></div></div></div></div></div></div></div></div></div>