DEV Community

Brody
Brody

Posted on

Using GPT-4 to simplify NWS forecast discussions

National Weather Service (NWS) forecast discussions are written by meteorologists for specific areas of the country. They add valuable nuance to forecasts but they're rarely consumed by the public. There's a ton of good information in them, but they could use a little editing to be more easily consumed. This prompt was created for this purpose.

I'm including the prompt, response, etc. in this post, but it's probably easier to view the chatlog and then review the challenges and improvements section below.

The prompt

You are going to be given a forecast written by a meteorologist. You need to reorganize and edit the forecast. The structure of the response should look like this:

Here's the short version

Current conditions

Short term forecast

Long term forecast

The first section should be no longer than 4 sentences. It should briefly summarize the current conditions, the short term forecast, and the long term forecast.

Here are some general rules to use to rewrite the forecast:

  • When these acronyms are used, make sure you keep them in your rewritten version: CWA, ERC
  • Spell out acronyms the first time they're used
  • Include the timestamps from the original forecast at the beginning of each section
  • If there's a section about fire weather, create a section at the end of the response that covers this
  • Do not include marine or aviation forecast information
  • Also include these terms in your version when they're used: stratus, front, flow, rainfall, cold front, warm front, trough, ensemble

Acknowledge this and standby for the forecast.

The raw forecast discussion

.SYNOPSIS...
Issued at 301 AM PDT Thu Oct 12 2023

The steady warming trend continues through Friday as high
pressure build. Rain chances return Friday evening into early
Saturday for the North Bay. Confidence is increasing for
additional rain early in the next work week, but again focused on
the North Bay.

&&

.UPDATE...
Issued at 908 AM PDT Thu Oct 12 2023

No major changes to the forecast - afternoon temperatures are on
track to be fairly mild ranging from the low 60s along the coast to
the low 80
s inland. Overnight temperatures were chillier than the
previous night with most stations recording temperatures in the
40s/50s and some inland stations in the high 30`s. Conditions are
expected to be less windy today as high pressure continues to move
into our CWA. Current observations showing prevailing winds between
3-5 mph throughout the Bay Area with winds expected to be
between 5-10 mph throughout the afternoon.

&&

.SHORT TERM...
(Today and tonight)
Issued at 301 AM PDT Thu Oct 12 2023

Thursday is setting up to be an average fall day for the CWA. The
lingering breezy conditions that were widespread yesterday will
finally ease in the late morning. Expect a sunny and mild
afternoon with highs randing from the 60s along the coast to the
low 80s for the warmest interior areas. Expect a mostly clear
night to follow with widespread lows in the 50s, aside from a few
of the North Bay interior areas, which will fall into the 40s.

&&

.LONG TERM...
(Friday through Wednesday)
Issued at 301 AM PDT Thu Oct 12 2023

Friday afternoon will offer more of the same with slightly warmer
conditions, but things change up later that evening. A cold front
will approach the region bringing in plenty of cloud cover and
some breezier wind. Rain chances look to only focus on the North
Bay with only some minor hints of drizzle for areas farther to the
south. Rain totals in the Bay will range from 0.01" to 0.15" for
much of the area and up to 0.25" for higher elevations along the
Sonoma Coast.

Rain chances will keep the North Bay cooler for Saturday, but the
cooler airmass behind the front will still offer some cooling for
areas that fail to see precip.

Temperatures rebound Sunday and warm even further for Monday
before the next front enters the region.

The overnight forecast update did some tooling with the early week
frontal passage, with models hinting at a slight slowdown in
momentum as it pushes inland along the Oregon coast. For this
portion of the region, the results look very similar to what is
expected from the Friday night front: precip staying in the North
Bay.

&&

.AVIATION...
(18Z TAFS)
Issued at 1009 AM PDT Thu Oct 12 2023

VFR through the day. Breezy northwesterly flow develops this
afternoon with winds up to 10-15 knots at the terminals. Model
output shows a chance for stratus development early Friday morning
at the immediate coast, perhaps as far inland as the Sonoma Valley
and the East Bayshore. Confidence in stratus development is low at
this time, and the TAFs do not reflect any ceilings as a result.

Vicinity of SFO... Currently expecting VFR through the TAF period,
with a low confidence (10-20% probability) for temporary stratus
development early Friday morning. Greater chances for stratus
development in the East Bay, but still a low confidence forecast.
West-northwest winds will develop this afternoon, with gusts up to
20 knots. Winds diminish this evening, before breezy west-southwest
winds develop on Friday.

SFO Bridge Approach... Similar to SFO.

Monterey Bay Terminals... VFR through the day with breezy northwest
winds around 10 knots developing this afternoon, diminishing this
evening. Low confidence (20-30% probability) that stratus
develops at the immediate coast, including MRY, early Friday
morning. Chances are slightly lower around SNS.

&&

.MARINE...
(Today through Tuesday)
Issued at 1009 AM PDT Thu Oct 12 2023

Strong north winds diminishing through the day, then remaining
light to moderate through the weekend. Very rough seas will slowly
abate through Friday. Looking ahead, moderate swell will arrive
this weekend before higher, longer period swell from the remnants
of Typhoon Bolaven arrives by late next week.

&&

.FIRE WEATHER...
Issued at 301 AM PDT Thu Oct 12 2023

Surface high pressure building near the CA/OR border and surface low
pressure off the SoCal coast will lead to a brief period of elevated
fire weather concerns this morning. The orientation of the high
and low pressure will result in increasing northerly flow this
evening through early tomorrow. Northerly winds 10-20 mph with
gusts 30-40 mph will be possible over the higher terrain of the
North Bay and East Bay. Winds will be locally breezy to gusty over
the Santa Cruz and Santa Lucia Mt ranges too, but not as strong.
Fortunately, humidity values for the North Bay, East Bay, and
Santa Cruz Mts do not reach critical levels. However, higher
portions of the Santa Lucia range reach near critical humidity
values(30-40 percent) with breezy conditions. Not strong to
warrant a Red Flag warning, but near critical to warrant elevated
fire weather concerns. Additionally, recent rains/drizzle have
helped to bring fuel moistures up with lower ERC values. These
increased winds look to diminish into the afternoon, easing fire
concerns.

&&

The rewritten forecast

Here's the short version

Issued at 301 AM PDT Thu Oct 12 2023

A warming trend continues until Friday, followed by rain chances in the North Bay by Friday evening extending into Saturday. The upcoming week brings further rain opportunities, particularly for the North Bay. Daytime temperatures are mild, with today's range between the low 60s along the coast and low 80s inland. Nights remain cooler with temperatures primarily in the 40s and 50s.

Current conditions

Issued at 908 AM PDT Thu Oct 12 2023

Afternoon temperatures are set to be mild, with the coast seeing lows of 60s and inland areas reaching low 80s. Last night was cooler than its predecessor with most areas experiencing temperatures in the 40s and 50s, while some inland stations recorded high 30s. High pressure moving into our County Warning Area (CWA) will lead to calmer conditions today. Current wind observations indicate a range of 3-5 mph throughout the Bay Area, with predictions of 5-10 mph winds in the afternoon.

Short term forecast

Issued at 301 AM PDT Thu Oct 12 2023

For today and tonight, the Bay Area will have a typical fall ambiance. The breezy conditions from yesterday are predicted to subside by late morning. The day promises to be sunny and mild, with coastal temperatures in the 60s and the warmest interior areas reaching the low 80s. The night should remain mostly clear with lows predominantly in the 50s. However, some North Bay interior spots might experience temperatures dropping to the 40s.

Long term forecast

Issued at 301 AM PDT Thu Oct 12 2023

Friday's afternoon will be slightly warmer, but a shift occurs later that evening. A cold front is anticipated, introducing increased cloudiness and stronger winds. Rain is primarily expected in the North Bay with drizzle hints for more southern regions. Rainfall estimates in the Bay range from 0.01" to 0.15" generally, but higher terrains along the Sonoma Coast might receive up to 0.25". The aftermath of the front will keep the North Bay cooler on Saturday, and even areas without precipitation will experience some cooling. By Sunday, temperatures will rise again, only to be affected by another front approaching early in the following week. This new front, akin to the one on Friday, looks to bring precipitation mostly to the North Bay.

Fire Weather

Issued at 301 AM PDT Thu Oct 12 2023

The combination of surface high pressure building near the California/Oregon border and low pressure off the Southern California coast is leading to heightened fire weather concerns. There will be an increase in northerly flow this evening, lasting till early tomorrow. This results in possible northerly winds of 10-20 mph, with gusts reaching 30-40 mph over the elevated terrains of the North Bay and East Bay. The Santa Cruz and Santa Lucia Mountain ranges will also experience breeziness, albeit less intense. Humidity levels in the North Bay, East Bay, and Santa Cruz Mountains do not hit critical levels, but parts of the Santa Lucia range might get close to critical humidity levels (30-40 percent). No Red Flag warnings are in effect, but the situation is close enough to cause elevated fire weather concerns. Recent rain and drizzle events have elevated fuel moistures, resulting in lower Energy Release Component (ERC) values. Winds are expected to diminish by the afternoon, reducing fire concerns.

Challenges and improvements

With content like this, I'd generally remove as much of the jargon as possible. However, in this case, I want these rewritten forecasts to be educational as well, which is why I kept the acronyms and terms. The lists I provided are incomplete, but the NWS has a dictionary that could be used to provide all the terms and their definitions. This would allow users to ask questions about these terms and get NWS-provided definitions.

Forecast discussions differ in small ways, so there are edge cases to be considered like whether there's a fire weather section, or exceptional weather like hurricanes in areas that rarely see them. Some of these edge cases could be preempted by looking through previous forecast discussions and adding guidance in the prompt for handling them.

From what I can tell, GPT-4 won't pull current weather conditions or forecasts from websites or APIs. In this example, I just copy and pasted the current forecast discussion. You could (fairly) easily write some code to pull the forecast discussion from the NWS API, feed it to GPT-4 to rewrite, and then reuse that content in an app or a website.

The ordering of the sentences in some of the paragraphs could use some tweaks. In the "Here's the short version" section, we'd ideally have the last sentence come first. The timestamps could use some fine tuning as well.

Top comments (0)