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

[python #CVJ-580594]: DIFAX chart replication



Greetings!

Thanks for the additional information. There was a really subtle bug in how I 
did the Pandas work in the code I sent you that led to the possibility that the 
iteration order over the height_change field would be different than the 
original DataFrame. I've corrected this in the StackOverflow post, but the 
critical line is to make sure the height change is added to the data frame so 
that everything is ensured to be indexed/aligned properly, as is done now in 
this snippet:

    # Create subset of all data for a given level
    df = data[data.pressure == level].copy()
    prev_df = prev_data[prev_data.pressure == level]

    # Calculate the change on the aligned data frames
    df['height_change'] = df.height - prev_df.height

Then the df['height_change'] column needs to be used in the later station plot:

    stationplot.plot_parameter('SE', df['height_change'], 
formatter=height_fall_formatter,
                               fontstyle='italic')

Thanks for checking on those values! I would have never noticed that bug.

Cheers!

Ryan

> Hi Ryan,
> 
> The code that I am working with is attached below as a .py file. I have also 
> attached a sample DIFAX chart that I generated for 1200 UTC on July 7, 2023. 
> To cross-check this DIFAX chart, I used the University of Wyoming’s sounding 
> plotter: https://weather.uwyo.edu/upperair/sounding.html 
> <https://weather.uwyo.edu/upperair/sounding.html>. You can generate a text 
> list of the radiosonde data for a given upper-air station to cross-check with 
> the data plotted on the DIFAX chart.
> 
> I hope this helps, but please let me know if you have any questions. Thanks 
> again for your help!
> 
> Jordan
> 
> *******************************************
> Jordan T. McLeod
> Meteorology Instructor
> Department of Earth Sciences
> University of South Alabama
> address@hidden <mailto:address@hidden>
> 
> 
> 
> 
> 
> 
> > On Jul 20, 2023, at 5:55 PM, Unidata Python Support <address@hidden> wrote:
> >
> > Greetings!
> >
> > Can you share the code you're running and point me to where you're checking 
> > the DIFAX charts?
> >
> > Thanks!
> >
> > Ryan
> >
> >> Hi Ryan,
> >>
> >> Thanks for your detailed response to my question on Stack Overflow! The 
> >> good news is that I was able to get the height rises/falls to plot. 
> >> However, I can't seem to get the correct height rises/falls to display on 
> >> the DIFAX chart. I cross-checked a sample DIFAX chart with the 
> >> corresponding radiosonde data, and they didn't match up. Any ideas about 
> >> what I am doing wrong? I have attached my code below.
> >>
> >> Thanks again for all of your time and assistance!
> >>
> >
> >
> > Ticket Details
> > ===================
> > Ticket ID: CVJ-580594
> > Department: Support Python
> > Priority: Low
> > Status: Closed
> > ===================
> > NOTE: All email exchanges with Unidata User Support are recorded in the 
> > Unidata inquiry tracking system and then made publicly available through 
> > the web.  If you do not want to have your interactions made available in 
> > this way, you must let us know in each email you send to us.
> >
> >
> 
> 
> 


Ticket Details
===================
Ticket ID: CVJ-580594
Department: Support Python
Priority: Low
Status: Closed
===================
NOTE: All email exchanges with Unidata User Support are recorded in the Unidata 
inquiry tracking system and then made publicly available through the web.  If 
you do not want to have your interactions made available in this way, you must 
let us know in each email you send to us.