[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[AWIPS #DQC-418543]: python-awips question



Hi there,

> I’ve been slowly reworking some of my real-time data plotting now that 
> I’m somewhat competent in python, and I’m using python-awips to pull 
> watch and warning data following this example: 
> http://unidata.github.io/python-awips/examples/generated/Watch_and_Warning_Polygons.html

That's great to hear you're trying to use python-awips for your rework!

> However, what I’d like to do and I’m not sure how to, is to get just the 
> currently active watches and warnings. The example there grabs the most 
> recent N times, but I found that when there are lots of warnings that doesn’t
> work very consistently. So what I did instead was:

> ####response = DataAccessLayer.getGeometryData(request, times[-50:-1])
> response = 
> DataAccessLayer.getGeometryData(request,constructTimeRange(warn_start,warn_end))

> where warn_start is 6 hours before the current time and warn_end is 6 hours 
> after.
> Then I plot only those where the current time is before period.end on each 
> watch/warning.

That seems like a useful modification.  If you wouldn't mind, I'd like to see 
the function
you wrote (constructTimeRange), and might update our notebook to do that 
instead.
 
> This works ok, but it doesn’t seem to account for situations like when NWS 
> updates a
> warning polygon, or cancels a warning early – both the initial and updated 
> polygon will 
> get plotted, or it’ll still show up until its original valid time is over.

I think what you want to do is modify the script to filter off of some of the 
information
from a different parameter: the vtec string.  

In the second cell, around line 4, you'll see where the parameters are set:
   request.setParameters('phensig')

I think what you want is to add 'vtecstr' as well.
   request.setParemters('phensig', 'vtecstr')

**Note: To get a list of all available parameters simply add these lines 
before setting the parameters:
   params = DataAccessLayer.getAvailableParameters(request);
   list(params)

Once you add the vtecstr as a parameter, then in the final cell block, in the 
loop that cycles
through the 'ob's in the response, you should be able to get the vtecstr for 
each ob:
   ob.getString('vtecstr')
and then be able to parse that message.  I think there are 3 sections based on 
this infographic
that are important: https://www.weather.gov/media/vtec/VTEC_explanation4-20.pdf

The messages seem to be P-VTEC strings.  And I think you want to focus on the 
"action" section.
This is how you can tell if it's a new warning or if it's some kind of update.  
Then you might
need to use a combination of the "action", "office", and "event tracking 
number" to limit which obs
you want to draw.

Please let me know if this is useful or if you have other questions.
Thanks!
--Shay Carter
She/Her/Hers
AWIPS Software Engineer
UCAR - Unidata

If you're interested, please feel free to fill out a survey about the support 
you receive: 
https://docs.google.com/forms/d/e/1FAIpQLSeDIkdk8qUMgq8ZdM4jhP-ubJPUOr-mJMQgxInwoAWoV5QcOw/viewform