[gradsusr] [EXTERNAL] Re: Plotting xcbar.gs Even When There is No Valid Data

Perry, Aaron axp09171 at alumni.northernvermont.edu
Tue Apr 19 14:41:39 EDT 2022


Thank you very much for sharing this link, Jennifer!

After more research and trial-and-erroring, I've been able to get the desired result by calling xcbar as an option within color.gs and setting all the display colors/xcbar before displaying the grib variable - voila!

I will keep your cmorph_nicam.gs option as a backup though!

Best,

Aaron Perry
Meteorologist
Class of '16
Northern Vermont University-Lyndon
(formerly Lyndon State College)
Boston, Mass.
Twitter: @AaronPerryWx<https://twitter.com/AaronPerryWx><https://twitter.com/arnpry><https://twitter.com/AaronPerryWx>
Email: axp09171 at vsc.edu<mailto:axp09171 at vsc.edu>
________________________________
From: gradsusr <gradsusr-bounces at gradsusr.org> on behalf of Adams, Jennifer M. (GSFC-610.2)[ADNET SYSTEMS INC] <jennifer.m.adams at nasa.gov>
Sent: Tuesday, April 19, 2022 12:32 PM
To: GrADS Users Forum <gradsusr at gradsusr.org>
Subject: Re: [gradsusr] [EXTERNAL] Re: Plotting xcbar.gs Even When There is No Valid Data

This message is from an external sender. Please be careful when clicking on links and attachments.



I put an old script I wrote (back in 2009!) here for you to see an example: ftp://cola.gmu.edu/pub/jma/cmorph_nicam.gs<https://nam04.safelinks.protection.outlook.com/?url=ftp%3A%2F%2Fcola.gmu.edu%2Fpub%2Fjma%2Fcmorph_nicam.gs&data=05%7C01%7Caxp09171%40alumni.northernvermont.edu%7C0e14aae8ff844d0a496b08da22224d3b%7Cb17e9703dbdd49fa909c03dfd13086af%7C0%7C0%7C637859828460373340%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000%7C%7C%7C&sdata=VUcc9ZWEfjOEpkxQ5MpxAvb5bo9eF9X6aoHJQ39wHhY%3D&reserved=0>

You have to copy/paste the code from xcbar.gs into your script as a function, and then _shdinfo will be shared by main script and the function.




--
Jennifer Miletta Adams
Senior Scientific Software Developer
Goddard Earth Sciences Data and Information Services Center (GES DISC)

NASA/GSFC, Code 610.2

Building 32, Room S159





From: gradsusr <gradsusr-bounces at gradsusr.org> on behalf of "Perry, Aaron" <axp09171 at alumni.northernvermont.edu>
Reply-To: GrADS Users Forum <gradsusr at gradsusr.org>
Date: Tuesday, April 12, 2022 at 5:33 PM
To: GrADS Users Forum <gradsusr at gradsusr.org>
Subject: Re: [gradsusr] [EXTERNAL] Re: Plotting xcbar.gs Even When There is No Valid Data



I've modified (highlighted text) Lines 157 through 189 in xcbar.gs to save the result (a text file called ref_shade_info) of 'q shades' for future use. I'm having trouble figuring out how to use the _shdinfo variable you had suggested for use outside of xcbar.gs.



I've also attached ref_shade_info to this email for reference.



My colorbar is



My Attempt:



*** get shade information ***

  if( cnum = -1 )

*    'q shades'

     istat = 0

     while (istat != 2)



     data = read('ref_shade_info')

     shdinfo = sublin(data,2)

     say shdinfo

*    dummy=write('ref_shade_info',shdinfo)

    if ( subwrd( shdinfo, 1 ) = 'None' )

      say 'Error in xcbar.gs: No shading information'

      return

    endif



* number of colors

    cnum = subwrd( shdinfo, 5 )

    if( cnum <= 0 )

      say 'Error in xcbar.gs: Number of color is zero'

      return

    endif



* color and (higher) levels

    i = 1

    while( i <= cnum )

      rec = sublin( shdinfo, i+1 )

      col.i = subwrd( rec, 1 )

      hi.i = subwrd( rec, 3 )

      i = i + 1

    endwhile

    endwhile



  endif



Am I on the right track?



Aaron Perry

Meteorologist
Class of '16
Northern Vermont University-Lyndon

(formerly Lyndon State College)
Boston, Mass.

Twitter: @AaronPerryWx<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftwitter.com%2FAaronPerryWx&data=05%7C01%7Caxp09171%40alumni.northernvermont.edu%7C0e14aae8ff844d0a496b08da22224d3b%7Cb17e9703dbdd49fa909c03dfd13086af%7C0%7C0%7C637859828460373340%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000%7C%7C%7C&sdata=3ejMYuEFyTHAL2w5JGOxGVhSCfA85a%2FXhLywQGCTWQE%3D&reserved=0>

Email: axp09171 at vsc.edu<mailto:axp09171 at vsc.edu>

________________________________

From: gradsusr <gradsusr-bounces at gradsusr.org> on behalf of Perry, Aaron <axp09171 at alumni.northernvermont.edu>
Sent: Tuesday, April 12, 2022 9:08 AM
To: GrADS Users Forum <gradsusr at gradsusr.org>
Subject: Re: [gradsusr] [EXTERNAL] Re: Plotting xcbar.gs Even When There is No Valid Data



This message is from an external sender. Please be careful when clicking on links and attachments.



Ok, thank you for that clarification!



I will give the process a try and update back later today.



Aaron Perry

Meteorologist
Class of '16
Northern Vermont University-Lyndon

(formerly Lyndon State College)
Boston, Mass.

Twitter: @AaronPerryWx<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftwitter.com%2FAaronPerryWx&data=05%7C01%7Caxp09171%40alumni.northernvermont.edu%7C0e14aae8ff844d0a496b08da22224d3b%7Cb17e9703dbdd49fa909c03dfd13086af%7C0%7C0%7C637859828460373340%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000%7C%7C%7C&sdata=3ejMYuEFyTHAL2w5JGOxGVhSCfA85a%2FXhLywQGCTWQE%3D&reserved=0>

Email: axp09171 at vsc.edu<mailto:axp09171 at vsc.edu>

________________________________

From: gradsusr <gradsusr-bounces at gradsusr.org> on behalf of Adams, Jennifer M. (GSFC-610.2)[ADNET SYSTEMS INC] <jennifer.m.adams at nasa.gov>
Sent: Tuesday, April 12, 2022 8:49 AM
To: GrADS Users Forum <gradsusr at gradsusr.org>
Subject: Re: [gradsusr] [EXTERNAL] Re: Plotting xcbar.gs Even When There is No Valid Data



This message is from an external sender. Please be careful when clicking on links and attachments.



Yes, but you also need to use a modified version of xcbar.gs that uses your saved shade information instead of calling ‘q shades’ again.



--
Jennifer Miletta Adams
Senior Scientific Software Developer
Goddard Earth Sciences Data and Information Services Center (GES DISC)

NASA/GSFC, Code 610.2

Building 32, Room S159





From: gradsusr <gradsusr-bounces at gradsusr.org> on behalf of "Perry, Aaron" <axp09171 at alumni.northernvermont.edu>
Reply-To: GrADS Users Forum <gradsusr at gradsusr.org>
Date: Tuesday, April 12, 2022 at 8:45 AM
To: GrADS Users Forum <gradsusr at gradsusr.org>
Subject: [EXTERNAL] Re: [gradsusr] Plotting xcbar.gs Even When There is No Valid Data



Thank you very much for the quick reply, Jennifer!



So to reiterate, I need to save the 'q shades' output from a forecast hour with valid data and then use that same output for a forecast hour that has no data, (instead of running 'q shades' again on the forecast hour with no data) therefore preserving the desired colorbar on the plot.





Aaron Perry

Meteorologist
Class of '16
Northern Vermont University-Lyndon

(formerly Lyndon State College)
Boston, Mass.

Twitter: @AaronPerryWx<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Ftwitter.com%2FAaronPerryWx&data=05%7C01%7Caxp09171%40alumni.northernvermont.edu%7C0e14aae8ff844d0a496b08da22224d3b%7Cb17e9703dbdd49fa909c03dfd13086af%7C0%7C0%7C637859828460373340%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000%7C%7C%7C&sdata=3ejMYuEFyTHAL2w5JGOxGVhSCfA85a%2FXhLywQGCTWQE%3D&reserved=0>

Email: axp09171 at vsc.edu<mailto:axp09171 at vsc.edu>

________________________________

From: gradsusr <gradsusr-bounces at gradsusr.org> on behalf of Jennifer M Adams <jadams21 at gmu.edu>
Sent: Tuesday, April 12, 2022 7:31 AM
To: (gradsusr at gradsusr.org) <gradsusr at gradsusr.org>
Subject: Re: [gradsusr] Plotting xcbar.gs Even When There is No Valid Data



This message is from an external sender. Please be careful when clicking on links and attachments.



The colorbar scripts generally run 'q shades' and then parse the output in the 'result' variable. I have worked around this by setting up a plot with the contour levels and colors I want, then saving the output from 'q shades' in a script variable for later use:
'q shades'
_shdinfo = result

Then I append a modified copy of the colorbar script as a function in my main drawing script that uses _shdinfo instead of running 'q shades' again.

--Jennifer



________________________________

From: gradsusr <gradsusr-bounces at gradsusr.org> on behalf of Perry, Aaron <axp09171 at alumni.northernvermont.edu>
Sent: Tuesday, April 12, 2022 4:29 AM
To: (gradsusr at gradsusr.org) <gradsusr at gradsusr.org>
Subject: [gradsusr] Plotting xcbar.gs Even When There is No Valid Data



Good Morning All,



I am trying to figure out a way to plot xcbar.gs even when there is no valid data in the grid to plot.



For instance, there is no GFS precipitation values in a certain domain, say the Northeastern US, for Forecast Hour 12. xcbar.gs says that there is no shading information and therefore, does not plot a colorbar for that one frame. I want to have that precipitation colorbar plot for every frame regardless of if there is data in the grid or not.



I've tried going into xcbar.gs to see if there is an override to plot regardless of valid data or not but, there doesn't appear to be.



Any and all suggestions would be greatly appreciated.



Aaron Perry

Meteorologist
Class of '16
Northern Vermont University-Lyndon

(formerly Lyndon State College)
Boston, Mass.

Twitter: @AaronPerryWx<https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsecure-web.cisco.com%2F1egToesz6FY1dQvl09040rrssQtgZSpZ37u0JC_BhMIqqGXDaOKm_GcDP8OZxfw5NJlqqFuoRKoKn2aXLLHz9lGrlKhdHibrlncd2fl0OlueWSALz8zjKx2Izbrd-LyQCFWj0MqKzgH_mksX34UIKC1VbG1_FBggf_vjEgGoxBL4zBoj1MVHm6S4jxv_uKfwbNLx3eKyftRZwBp2AWbzJ1CmTLAzSyX6MIl2g5HJ1zXFiGCIsLCK13RYrT53_lKb3Td_kTlxK4Q5KlGLw1UjBqktTn1Tp-yowSGIvKMO9CTBSsEyShaWNwIN6GLt1aw4CJj1NXJPDTnS4ANRpo3RphXFkpbfklh77_t-H9dgk-5yCcr3D8gt8zas1IivafPUV0EgxvOIzWrcY5zClfmgVUq2nOZUWKttKxLA2XKWtwLgt9CSk1kLr63d5eQykYA2fPEs3gXwIs5wJ7We-gs1AzQ%2Fhttps%253A%252F%252Ftwitter.com%252FAaronPerryWx&data=05%7C01%7Caxp09171%40alumni.northernvermont.edu%7C0e14aae8ff844d0a496b08da22224d3b%7Cb17e9703dbdd49fa909c03dfd13086af%7C0%7C0%7C637859828460373340%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000%7C%7C%7C&sdata=b591zZ%2FkvE3BhdwVAq%2FKB8RIrAofbC4Fth8Defs915M%3D&reserved=0>

Email: axp09171 at vsc.edu<mailto:axp09171 at vsc.edu>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://gradsusr.org/pipermail/gradsusr/attachments/20220419/df35c4ec/attachment-0001.html>


More information about the gradsusr mailing list