Post about the NHC XML namespace

This commit is contained in:
~lucidiot 2023-11-12 19:34:37 +01:00
parent 2a95558f28
commit 741ed6eaa7
1 changed files with 114 additions and 0 deletions

114
feed.xml
View File

@ -13,6 +13,7 @@
xmlns:georss="http://www.georss.org/georss"
xmlns:gml="http://www.opengis.net/gml"
xmlns:icbm="http://postneo.com/icbm"
xmlns:nhc="https://www.nhc.noaa.gov"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:webfeeds="http://webfeeds.org/rss/1.0"
@ -20,6 +21,7 @@
xsi:noNamespaceSchemaLocation="xsd/rss.xsd"
xsi:schemaLocation="
http://postneo.com/icbm xsd/icbm.xsd
https://www.nhc.noaa.gov xsd/nhc.xsd
http://www.georss.org/georss https://schemas.opengis.net/georss/1.0/schema-1.1/georss.xsd
http://www.opengis.net/gml https://schemas.opengis.net/georss/1.0/schema-1.1/gmlgeorss.xsd
"
@ -1891,6 +1893,118 @@ because astronomers need coffee to go through the night -->
]]></description>
</item>
<item>
<title>Spice up your feeds with cyclones</title>
<pubDate>Sun, 12 Nov 2023 19:29:48 +0100</pubDate>
<guid isPermaLink="false">nhc-xsd</guid>
<category domain="https://envs.net/~lucidiot/rsrsss/">XSD</category>
<category domain="https://envs.net/~lucidiot/rsrsss/">Weather</category>
<link>https://envs.net/~lucidiot/rsrsss/xsd/nhc.xsd</link>
<description><![CDATA[
<p>Last time, I posted about the incredible amount of RSS feeds the <abbr title="National Hurricane Center">NHC</abbr> vomits. While trying to delve into those feeds, particularly the ones dubbed as <abbr title="Geographic Information Systems">GIS</abbr> feeds that use <abbr title="Geography Markup Language">GML</abbr>, I found an XML namespace meant to describe cyclones. Way to make your feeds way more epic!</p>
<p>With the help of <a href="https://www.nhc.noaa.gov/rss_examples/" target="_blank">the NHC's example files</a>, published solely to help developers work with their feeds, and <a href="https://www.nhc.noaa.gov/gis/rss.php" target="_blank">GIS RSS feeds documentation page</a>, I cobbled together an <abbr title="XML Schema Definition">XSD</abbr> to better document this namespace.</p>
<figure>
<pre>
&lt;rss
version="2.0"
xmlns:nhc="https://www.nhc.noaa.gov/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
https://www.nhc.noaa.gov
https://envs.net/~lucidiot/rsrsss/xsd/nhc.xsd
"
&gt;
&lt;channel&gt;
&lt;!-- ... --&gt;
&lt;item&gt;
&lt;!-- ... --&gt;
&lt;nhc:Cyclone&gt;
&lt;nhc:center&gt;38.43317, -82.02346&lt;/nhc:center&gt;
&lt;nhc:type&gt;TROPICAL STORM&lt;/nhc:type&gt;
&lt;nhc:name&gt;FLORIDA MAN&lt;/nhc:name&gt;
&lt;nhc:wallet&gt;EP3&lt;/nhc:wallet&gt;
&lt;nhc:atcf&gt;EP872023&lt;/nhc:atcf&gt;
&lt;nhc:datetime&gt;11:11 AM PDT Wed Jan 25&lt;/nhc:datetime&gt;
&lt;nhc:movement&gt;NE at 54 mph&lt;/nhc:movement&gt;
&lt;nhc:pressure&gt;984 mb&lt;/nhc:pressure&gt;
&lt;nhc:wind&gt;115 mph&lt;/nhc:wind&gt;
&lt;nhc:headline&gt;...FLORIDA MAN MESSES UP THE TOWN OF HURRICANE, WV...&lt;/nhc:headline&gt;
&lt;/nhc:Cyclone&gt;
&lt;/item&gt;
&lt;/channel&gt;
&lt;/rss&gt;
</pre>
<figcaption>Example of a tropical storm added to an RSS item using the NHC XML namespace</figcaption>
</figure>
<p>Note that in this example, I am using the <a href="https://www.w3.org/TR/xmlschema-1/#xsi_schemaLocation" target="_blank"><code>xsi:schemaLocation</code></a> attribute to tell any XML schema validators where the <abbr title="XML Schema Definition">XSD</abbr> for the <code>nhc</code> namespace is located. This can help you if you are using an XML editor to write your RSS feeds, or want some automatic validation of the validity of your feeds with namespaces and features that go beyond the <a href="https://validator.w3.org/feed/" target="_blank">W3C Feed Validation Service</a>. Let's have a look at all those new XML elements:</p>
<dl>
<dt><code>&lt;<dfn>nhc:Cyclone</dfn>&gt;</code></dt>
<dd>A tropical weather system: a tropical depression, tropical storm, hurricane, etc. This can only be used on items, not channels, and can only be used once per item.</dd>
<dt><code>&lt;<dfn>nhc:center</dfn>&gt;</code></dt>
<dd>WGS84 coordinates of the center of the weather system, as latitude then longitude separated with a comma and optionally spaces.</dd>
<dt><code>&lt;<dfn>nhc:type</dfn>&gt;</code></dt>
<dd>Type of the weather system: whether it is a tropical depression, tropical storm, hurricane, etc. Usually written entirely in uppercase.</dd>
<dt><code>&lt;<dfn>nhc:name</dfn>&gt;</code></dt>
<dd>Name of the weather system. Usually written entirely in uppercase.</dd>
<dt><code>&lt;<dfn>nhc:wallet</dfn>&gt;</code></dt>
<dd>
<p>The <dfn>storm wallet</dfn>: Back before hurricane forecasting became computerized, all of the hurricane data was stored in binders, called wallets. There are five wallets for each of the three areas of responsibility of the <abbr title="National Hurricane Center">NHC</abbr> and the <abbr title="Central Pacific Hurricane Center">CPHC</abbr>.</p>
<p>Storm wallets are numbered with two letters representing the area of responsibility, followed by a digit from 1 to 5 matching the storm advisory number. The two-letter codes for areas of responsibility are:</p>
<dl>
<dt>AT</dt>
<dd>Atlantic</dd>
<dt>CP</dt>
<dd>Central Pacific</dd>
<dt>EP</dt>
<dd>Eastern Pacific</dd>
</dl>
</dd>
<dt><code>&lt;<dfn>nhc:atcf</dfn>&gt;</code></dt>
<dd>
<p>Storm identifier in the <abbr title="Automated Tropical Cyclone Forecast">ATCF</abbr> software. This is the software used for hurricane forecasting ever since it became computerized. It can be used to find the raw data from that software on <a href="https://ftp.nhc.noaa.gov/atcf/" target="_blank">the NHC's public file server</a>.</p>
<p>ATCF IDs begin with a two-letter code for the area of responsibility, followed by a two-digit storm number and the four-digit year in which the storm occurs. The two-letter codes for areas of responsibility are:</p>
<dl>
<dt>AL</dt>
<dd>Atlantic. Note that this is different from the <code>AT</code> code for storm wallets.</dd>
<dt>CP</dt>
<dd>Central Pacific</dd>
<dt>EP</dt>
<dd>Eastern Pacific</dd>
</dl>
<p>Storm numbers 01 to 30 are supposed to be unique storm numbers per season. Storm numbers 80 to 89 are used for training purposes and should be ignored when trying to process real ATCF data. Storm numbers 90 to 99 are areas of interest to forecasters that may not actually be storms and may be reused in the same season.</p>
<p>I recommend using storm numbers between 80 and 89 if you want to mess around and create fake storms, since those are explicitly designated as training or testing data that should be discarded. Also note that storm numbers 31 to 79 are not assigned, and that they assume there will never be more than 30 storms in one year. I'm sure climate change will fix that.</p>
</dd>
<dt><code>&lt;<dfn>nhc:datetime</dfn>&gt;</code></dt>
<dd>The date and time of the report, using the <a href="https://man7.org/linux/man-pages/man3/strftime.3.html" target="_blank">strftime format</a> <code>%I:%M %p %Z %a %b %d</code>. The commonly used timezones are <a href="https://en.wikipedia.org/wiki/Central_Time_Zone" target="_blank">CDT</a> on the Atlantic reports, <a href="https://en.wikipedia.org/wiki/Pacific_Time_Zone" target="_blank">PDT</a> on Eastern Pacific reports, and <a href="https://en.wikipedia.org/wiki/Hawaii%E2%80%93Aleutian_Time_Zone" target="_blank">HDT</a> on Central Pacific reports.</dd>
<dt><code>&lt;<dfn>nhc:movement</dfn>&gt;</code></dt>
<dd>
<p>The direction and speed of movement of the storm, expressed as a cardinal direction and a speed, usually in the form <code>[direction] at [speed] mph</code>. The direction can be a cardinal (<abbr title="North">N</abbr>, <abbr title="South">S</abbr>, <abbr title="East">E</abbr>, <abbr title="West">W</abbr>), intercardinal (<abbr title="Northeast">NE</abbr>, <abbr title="Southeast">SE</abbr>, <abbr title="Southwest">SW</abbr>, etc.) or secondary intercardinal direction (<abbr title="West-northwest">WNW</abbr>, <abbr title="East-southeast">ESE</abbr>, etc.). Speeds are non-negative integers, and always in miles per hour.</p>
<p>Note that this is a manually written value, not necessarily intended for machine consumption, and that nothing prevents other values from being set. Other known values include <code>Stationary</code> and <code>Nearly stationary</code>.</p>
</dd>
<dt><code>&lt;<dfn>nhc:pressure</dfn>&gt;</code></dt>
<dd>The atmospheric pressure at the center of the storm, expressed in millibars without decimals, as <code>[pressure] mb</code>.</dd>
<dt><code>&lt;<dfn>nhc:wind</dfn>&gt;</code></dt>
<dd>The wind speed in the storm, expressed in miles per hour without decimals, as <code>[speed] mph</code>.</dd>
<dt><code>&lt;<dfn>nhc:headline</dfn>&gt;</code></dt>
<dd>A headline for the report, usually written in uppercase, with each sentence surrounded by ellipsis characters ("…", <code>&amp;hellip;</code>, U+2026).</dd>
</dl>
<p>All of the child elements of <code>&lt;nhc:Cyclone&gt;</code> are required.</p>
<p>And as with most of the XML namespaces that I showcase on this feed, I added support for it on the <abbr title="Extensible Stylesheet Language Transformations">XSLT</abbr> that allows this feed to be displayed on most modern web browsers without RSS support. <a href="https://envs.net/~lucidiot/rsrsss/#nhc-xsd" target="_blank">View this post in your browser</a> and admire the additional hurricane information available!</p>
]]></description>
<nhc:Cyclone>
<nhc:center>40.1509066, -77.0312744</nhc:center>
<nhc:type>HURRICANE</nhc:type>
<nhc:name>REALLY STORMY SYNDICATION</nhc:name>
<nhc:wallet>AT1</nhc:wallet>
<nhc:atcf>AL812023</nhc:atcf>
<nhc:datetime>06:29 PM GMT Sun Nov 12</nhc:datetime>
<nhc:movement>WSW at 88 mph</nhc:movement>
<nhc:pressure>0 mb</nhc:pressure>
<nhc:wind>9000 mph</nhc:wind>
<nhc:headline>...CATASTROPHIC DAMAGE TO SOCIAL MEDIA AS REALLY STORMY SYNDICATION SWEEPS THROUGH THE COUNTRY...</nhc:headline>
</nhc:Cyclone>
</item>
</channel>
<access:restriction relationship="allow" />
</rss>