noaa_weather_client 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/.rspec +1 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +7 -0
- data/.yardopts +2 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +22 -0
- data/README.md +107 -0
- data/Rakefile +8 -0
- data/bin/noaa_weather_client +43 -0
- data/data/xml/current_observation.xsd +79 -0
- data/data/xml/dwml.xsd +97 -0
- data/data/xml/location.xsd +142 -0
- data/data/xml/meta_data.xsd +100 -0
- data/data/xml/moreWeatherInformation.xsd +23 -0
- data/data/xml/ndfd_data.xsd +43 -0
- data/data/xml/parameters.xsd +1173 -0
- data/data/xml/summarizationType.xsd +29 -0
- data/data/xml/time_layout.xsd +51 -0
- data/lib/noaa_weather_client.rb +9 -0
- data/lib/noaa_weather_client/cli.rb +53 -0
- data/lib/noaa_weather_client/cli/templates.rb +53 -0
- data/lib/noaa_weather_client/client.rb +61 -0
- data/lib/noaa_weather_client/errors.rb +7 -0
- data/lib/noaa_weather_client/responses/current_observation.rb +93 -0
- data/lib/noaa_weather_client/responses/forecast.rb +84 -0
- data/lib/noaa_weather_client/responses/generic_response.rb +9 -0
- data/lib/noaa_weather_client/responses/lat_lon_list.rb +25 -0
- data/lib/noaa_weather_client/responses/reactive_xml_response.rb +29 -0
- data/lib/noaa_weather_client/responses/station.rb +28 -0
- data/lib/noaa_weather_client/responses/stations.rb +41 -0
- data/lib/noaa_weather_client/responses/validatable_xml_response.rb +22 -0
- data/lib/noaa_weather_client/rest_client_factory.rb +12 -0
- data/lib/noaa_weather_client/services/calculate_distance_between_lat_lon.rb +20 -0
- data/lib/noaa_weather_client/services/current_observations.rb +32 -0
- data/lib/noaa_weather_client/services/find_nearest_station.rb +16 -0
- data/lib/noaa_weather_client/services/forecast_by_day.rb +52 -0
- data/lib/noaa_weather_client/services/postal_code_to_coordinate.rb +36 -0
- data/lib/noaa_weather_client/services/rest_service.rb +28 -0
- data/lib/noaa_weather_client/services/soap_service.rb +16 -0
- data/lib/noaa_weather_client/services/weather_stations.rb +32 -0
- data/lib/noaa_weather_client/soap_client_factory.rb +17 -0
- data/lib/noaa_weather_client/station_filters.rb +8 -0
- data/lib/noaa_weather_client/version.rb +3 -0
- data/lib/noaa_weather_client/xml_parser_factory.rb +9 -0
- data/noaa_weather_client.gemspec +27 -0
- data/spec/fixtures/vcr_cassettes/current_observations.yml +25890 -0
- data/spec/fixtures/vcr_cassettes/forecast_by_day_3.yml +772 -0
- data/spec/fixtures/vcr_cassettes/forecast_by_day_7.yml +829 -0
- data/spec/fixtures/vcr_cassettes/nearest_weather_station.yml +25842 -0
- data/spec/fixtures/vcr_cassettes/postal_code_to_coordinate.yml +75 -0
- data/spec/fixtures/vcr_cassettes/weather_stations.yml +25842 -0
- data/spec/fixtures/xml/forecast.xml +144 -0
- data/spec/lib/noaa_client/client_spec.rb +93 -0
- data/spec/lib/noaa_client/responses/current_observation_spec.rb +122 -0
- data/spec/lib/noaa_client/responses/forecast_spec.rb +66 -0
- data/spec/lib/noaa_client/responses/lat_lon_list_spec.rb +30 -0
- data/spec/lib/noaa_client/responses/station_spec.rb +53 -0
- data/spec/lib/noaa_client/responses/stations_spec.rb +86 -0
- data/spec/lib/noaa_client/rest_client_factory_spec.rb +15 -0
- data/spec/lib/noaa_client/services/calculate_distance_between_lat_lon_spec.rb +16 -0
- data/spec/lib/noaa_client/services/current_observations_spec.rb +47 -0
- data/spec/lib/noaa_client/services/find_nearest_station_spec.rb +36 -0
- data/spec/lib/noaa_client/services/forecast_by_day_spec.rb +62 -0
- data/spec/lib/noaa_client/services/postal_code_to_coordinate_spec.rb +41 -0
- data/spec/lib/noaa_client/services/rest_service_spec.rb +45 -0
- data/spec/lib/noaa_client/services/soap_service_spec.rb +56 -0
- data/spec/lib/noaa_client/services/weather_stations_spec.rb +40 -0
- data/spec/lib/noaa_client/soap_client_factory_spec.rb +13 -0
- data/spec/lib/noaa_client/xml_parser_factory_spec.rb +14 -0
- data/spec/spec_helper.rb +31 -0
- metadata +228 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d88cebdee98b0d0b91ab25364305405fd75a6b41
|
4
|
+
data.tar.gz: b5c4332f61717f2109d3788cb2cab1a7dcd410e5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a1f01ef9f9f1d21a64bd73c42bfe8ab123af15bb9eaf97fb7daec1f01464e9e84437b078bc6ce1e63edc168b9d9212900999c0079d7a7516fa3afa82de80451c
|
7
|
+
data.tar.gz: cdf73498f8b3c985edf11913f94ffcba60bf83f86243cd2486ea873ccdb7991f714d9f9536f4c56951e6a4254feae08270ceeea4498bd7d7636a5698a9e774a5
|
data/.gitignore
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
noaa_client
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.0.0-p353
|
data/.travis.yml
ADDED
data/.yardopts
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Tyler Dooling
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
[](https://travis-ci.org/tylerdooling/noaa_weather_client)
|
2
|
+
# NoaaWeatherClient
|
3
|
+
|
4
|
+
Ruby wrapper for the NOAA weather API.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
gem 'noaa_weather_client'
|
11
|
+
|
12
|
+
And then execute:
|
13
|
+
|
14
|
+
$ bundle
|
15
|
+
|
16
|
+
Or install it yourself as:
|
17
|
+
|
18
|
+
$ gem install noaa_weather_client
|
19
|
+
|
20
|
+
|
21
|
+
## Notes
|
22
|
+
|
23
|
+
### Weather Station Caching
|
24
|
+
|
25
|
+
It is important to cache a copy of the available stations for frequent use as the stations response is quite large NOAA does not appreciate repeated calls.
|
26
|
+
|
27
|
+
```ruby
|
28
|
+
# cache a copy of stations and store in memory, file, etc.
|
29
|
+
stations = client.weather_stations
|
30
|
+
|
31
|
+
# current_observations
|
32
|
+
client.current_observations(some_lat, some_lon, stations: stations)
|
33
|
+
|
34
|
+
# nearest_weather_station
|
35
|
+
client.nearest_weather_station(some_lat, some_lon, stations: stations)
|
36
|
+
|
37
|
+
```
|
38
|
+
#### Filtering Weather Stations
|
39
|
+
In my experience, the best observations tend to come from the
|
40
|
+
ICAO(mostly airports) stations. There are many other stations -
|
41
|
+
typically in cities and near the coast, but the observations tend to be
|
42
|
+
partial and intermittent.
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
# filter by station type
|
46
|
+
filter = NoaaWeatherClient::StationFilters.icao
|
47
|
+
client.nearest_weather_station(some_lat, some_lon, stations: stations, filter: filter)
|
48
|
+
```
|
49
|
+
|
50
|
+
### Postal Codes
|
51
|
+
NOAA provides a service to resolve postal codes to a coordinate.
|
52
|
+
|
53
|
+
```ruby
|
54
|
+
# convert postal code to coordinate
|
55
|
+
coordinate = client.postal_code_to_coordinate(90210)
|
56
|
+
coordinate.latitude #=> 34.0995
|
57
|
+
coordinate.longitude #=> -118.414
|
58
|
+
```
|
59
|
+
|
60
|
+
## Usage
|
61
|
+
```ruby
|
62
|
+
# create a client instance
|
63
|
+
client = NoaaWeatherClient.build_client
|
64
|
+
|
65
|
+
# all weather stations
|
66
|
+
client.weather_stations
|
67
|
+
|
68
|
+
# locate the nearest weather station
|
69
|
+
client.nearest_weather_station(34.0995, -118.414)
|
70
|
+
|
71
|
+
# 7 day forecast
|
72
|
+
client.forecast_by_day(34.0995, -118.414)
|
73
|
+
|
74
|
+
# current observations
|
75
|
+
client.current_observations(34.0995, -118.414)
|
76
|
+
```
|
77
|
+
|
78
|
+
## CLI
|
79
|
+
```bash
|
80
|
+
$ noaa_weather_client -p 65804
|
81
|
+
#=> 34.0995 -118.414
|
82
|
+
|
83
|
+
# current observations
|
84
|
+
$ noaa_weather_client 34.0995 -118.414
|
85
|
+
|
86
|
+
# include 7 day forecast
|
87
|
+
$ noaa_weather_client -f 34.0995 -118.414
|
88
|
+
|
89
|
+
# resolve postal code and pipe args
|
90
|
+
$ noaa_weather_client -p 90210 | xargs noaa_weather_client -f
|
91
|
+
```
|
92
|
+
|
93
|
+
## Contributing
|
94
|
+
Contributions are always welcome. A few notes:
|
95
|
+
|
96
|
+
* Keep changes small and on topic.
|
97
|
+
* Stay consistent with existing code conventions.
|
98
|
+
* Break changes into smaller logical commits.
|
99
|
+
|
100
|
+
To propose a change or fix a bug:
|
101
|
+
|
102
|
+
* [Fork the project.](https://help.github.com/articles/fork-a-repo)
|
103
|
+
* Make your feature addition or bug fix.
|
104
|
+
* Add tests for it.
|
105
|
+
* Commit.
|
106
|
+
* [Send a pull request](https://help.github.com/articles/using-pull-requests)
|
107
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
require 'optparse'
|
3
|
+
require 'noaa_weather_client'
|
4
|
+
|
5
|
+
def strip_coordinates!(args)
|
6
|
+
coordinates = args.last(2).select { |arg| arg =~ /-?\d{1,2}\.\d{2,}/ }
|
7
|
+
args.pop(2) if coordinates.size == 2
|
8
|
+
end
|
9
|
+
|
10
|
+
opts = OpenStruct.new(
|
11
|
+
postal_code: nil,
|
12
|
+
features: [ :observations ],
|
13
|
+
coordinates: strip_coordinates!(ARGV)
|
14
|
+
)
|
15
|
+
|
16
|
+
option_parser = OptionParser.new do |options|
|
17
|
+
options.set_banner "Usage: noaa_weather_client [options] latitude longitude"
|
18
|
+
|
19
|
+
options.separator ""
|
20
|
+
options.separator "Specific options:"
|
21
|
+
|
22
|
+
options.on("-p", "--postal_code CODE", "Resolve five digit postal code to coordinate.") do |postal_code|
|
23
|
+
opts.postal_code = postal_code
|
24
|
+
end
|
25
|
+
|
26
|
+
options.on("-f", "--forecast", "Include forecast for the location.") do |forecast|
|
27
|
+
opts.features << :forecast
|
28
|
+
end
|
29
|
+
|
30
|
+
options.on_tail("-h", "--help", "You're looking at it!") do
|
31
|
+
$stderr.puts options
|
32
|
+
exit 1
|
33
|
+
end
|
34
|
+
end
|
35
|
+
option_parser.parse!
|
36
|
+
|
37
|
+
|
38
|
+
if opts.postal_code
|
39
|
+
NoaaWeatherClient::CLI.postal_code_to_coordinate(opts.postal_code)
|
40
|
+
else
|
41
|
+
app = NoaaWeatherClient::CLI.new(*opts.coordinates)
|
42
|
+
app.render(*opts.features)
|
43
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
3
|
+
<xsd:complexType name="imageType">
|
4
|
+
<xsd:sequence>
|
5
|
+
<xsd:element name="url" type="xsd:anyURI" minOccurs="0"/>
|
6
|
+
<xsd:element name="title" type="xsd:token" minOccurs="0"/>
|
7
|
+
<xsd:element name="link" type="xsd:anyURI" minOccurs="0"/>
|
8
|
+
</xsd:sequence>
|
9
|
+
</xsd:complexType>
|
10
|
+
<xsd:element name="current_observation">
|
11
|
+
<xsd:complexType>
|
12
|
+
<xsd:sequence>
|
13
|
+
<xsd:element name="credit" type="xsd:token" minOccurs="0"/>
|
14
|
+
<xsd:element name="credit_URL" type="xsd:anyURI" minOccurs="0"/>
|
15
|
+
<xsd:element name="image" type="imageType" minOccurs="0"/>
|
16
|
+
<xsd:element name="suggested_pickup" type="xsd:token" minOccurs="0"/>
|
17
|
+
<xsd:element name="suggested_pickup_period" type="xsd:integer" minOccurs="0"/>
|
18
|
+
<xsd:element name="location" type="xsd:token" minOccurs="0"/>
|
19
|
+
<xsd:element name="station_id" type="xsd:token" minOccurs="0"/>
|
20
|
+
<xsd:element name="latitude" type="xsd:string" minOccurs="0"/>
|
21
|
+
<xsd:element name="longitude" type="xsd:string" minOccurs="0"/>
|
22
|
+
<xsd:element name="elevation" type="xsd:integer" minOccurs="0"/>
|
23
|
+
<xsd:element name="observation_time" type="xsd:token" minOccurs="0"/>
|
24
|
+
<xsd:element name="observation_time_rfc822" type="xsd:token" minOccurs="0"/>
|
25
|
+
<xsd:element name="weather" type="xsd:token" minOccurs="0"/>
|
26
|
+
<xsd:element name="temperature_string" type="xsd:token" minOccurs="0"/>
|
27
|
+
<xsd:element name="temp_f" type="xsd:decimal" minOccurs="0"/>
|
28
|
+
<xsd:element name="temp_c" type="xsd:decimal" minOccurs="0"/>
|
29
|
+
<xsd:element name="water_temp_f" type="xsd:decimal" minOccurs="0"/>
|
30
|
+
<xsd:element name="water_temp_c" type="xsd:decimal" minOccurs="0"/>
|
31
|
+
<xsd:element name="relative_humidity" type="xsd:integer" minOccurs="0"/>
|
32
|
+
<xsd:element name="wind_string" type="xsd:token" minOccurs="0"/>
|
33
|
+
<xsd:element name="wind_dir" type="xsd:string" minOccurs="0"/>
|
34
|
+
<xsd:element name="wind_degrees" type="xsd:integer" minOccurs="0"/>
|
35
|
+
<xsd:element name="wind_mph" type="xsd:decimal" minOccurs="0"/>
|
36
|
+
<xsd:element name="wind_gust_mph" type="xsd:decimal" minOccurs="0"/>
|
37
|
+
<xsd:element name="wind_kt" type="xsd:decimal" minOccurs="0"/>
|
38
|
+
<xsd:element name="wind_gust_kt" type="xsd:decimal" minOccurs="0"/>
|
39
|
+
<xsd:element name="pressure_string" type="xsd:token" minOccurs="0"/>
|
40
|
+
<xsd:element name="pressure_mb" type="xsd:decimal" minOccurs="0"/>
|
41
|
+
<xsd:element name="pressure_in" type="xsd:decimal" minOccurs="0"/>
|
42
|
+
<xsd:element name="pressure_tendency_mb" type="xsd:decimal" minOccurs="0"/>
|
43
|
+
<xsd:element name="pressure_tendency_in" type="xsd:decimal" minOccurs="0"/>
|
44
|
+
<xsd:element name="dewpoint_string" type="xsd:token" minOccurs="0"/>
|
45
|
+
<xsd:element name="dewpoint_f" type="xsd:decimal" minOccurs="0"/>
|
46
|
+
<xsd:element name="dewpoint_c" type="xsd:decimal" minOccurs="0"/>
|
47
|
+
<xsd:element name="heat_index_string" type="xsd:token" minOccurs="0"/>
|
48
|
+
<xsd:element name="heat_index_f" type="xsd:integer" minOccurs="0"/>
|
49
|
+
<xsd:element name="heat_index_c" type="xsd:integer" minOccurs="0"/>
|
50
|
+
<xsd:element name="windchill_string" type="xsd:token" minOccurs="0"/>
|
51
|
+
<xsd:element name="windchill_f" type="xsd:integer" minOccurs="0"/>
|
52
|
+
<xsd:element name="windchill_c" type="xsd:integer" minOccurs="0"/>
|
53
|
+
<xsd:element name="visibility_mi" type="xsd:decimal" minOccurs="0"/>
|
54
|
+
<xsd:element name="wave_height_m" type="xsd:decimal" minOccurs="0"/>
|
55
|
+
<xsd:element name="wave_height_ft" type="xsd:decimal" minOccurs="0"/>
|
56
|
+
<xsd:element name="dominant_period_sec" type="xsd:integer" minOccurs="0"/>
|
57
|
+
<xsd:element name="average_period_sec" type="xsd:decimal" minOccurs="0"/>
|
58
|
+
<xsd:element name="mean_wave_dir" type="xsd:string" minOccurs="0"/>
|
59
|
+
<xsd:element name="mean_wave_degrees" type="xsd:integer" minOccurs="0"/>
|
60
|
+
<xsd:element name="tide_ft" type="xsd:decimal" minOccurs="0"/>
|
61
|
+
<xsd:element name="steepness" type="xsd:string" minOccurs="0"/>
|
62
|
+
<xsd:element name="water_column_height" type="xsd:decimal" minOccurs="0"/>
|
63
|
+
<xsd:element name="surf_height_ft" type="xsd:string" minOccurs="0"/>
|
64
|
+
<xsd:element name="swell_dir" type="xsd:string" minOccurs="0"/>
|
65
|
+
<xsd:element name="swell_degrees" type="xsd:integer" minOccurs="0"/>
|
66
|
+
<xsd:element name="swell_period" type="xsd:string" minOccurs="0"/>
|
67
|
+
<xsd:element name="icon_url_base" type="xsd:anyURI" minOccurs="0"/>
|
68
|
+
<xsd:element name="icon_name" type="xsd:anyURI" minOccurs="0"/>
|
69
|
+
<xsd:element name="two_day_history_url" type="xsd:anyURI" minOccurs="0"/>
|
70
|
+
<xsd:element name="icon_url_name" type="xsd:anyURI" minOccurs="0"/>
|
71
|
+
<xsd:element name="ob_url" type="xsd:anyURI" minOccurs="0"/>
|
72
|
+
<xsd:element name="disclaimer_url" type="xsd:anyURI" minOccurs="0"/>
|
73
|
+
<xsd:element name="copyright_url" type="xsd:anyURI" minOccurs="0"/>
|
74
|
+
<xsd:element name="privacy_policy_url" type="xsd:anyURI" minOccurs="0"/>
|
75
|
+
</xsd:sequence>
|
76
|
+
<xsd:attribute name="version" type="xsd:string" default="1.0"/>
|
77
|
+
</xsd:complexType>
|
78
|
+
</xsd:element>
|
79
|
+
</xsd:schema>
|
data/data/xml/dwml.xsd
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
|
3
|
+
<!-- **********************************************************************
|
4
|
+
|
5
|
+
DWML.xsd - Top level XML Schema for Digital Weather Markup Language
|
6
|
+
|
7
|
+
John L. Schattel MDL 4 August 2004
|
8
|
+
Red Hat Linux Apache Server
|
9
|
+
|
10
|
+
Paul Hershberg MDL 11 July 2007
|
11
|
+
-Added keyref for new <moreWeatherInformation> element.
|
12
|
+
|
13
|
+
<xsd:include schemaLocation="http://graphical.weather.gov/xml/DWMLgen/schema/meta_data.xsd" />
|
14
|
+
<xsd:include schemaLocation="http://graphical.weather.gov/xml/DWMLgen/schema/ndfd_data.xsd" />
|
15
|
+
|
16
|
+
************************************************************************* -->
|
17
|
+
|
18
|
+
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
19
|
+
|
20
|
+
<xsd:include schemaLocation="meta_data.xsd" />
|
21
|
+
<xsd:include schemaLocation="ndfd_data.xsd" />
|
22
|
+
|
23
|
+
<xsd:simpleType name="latLonListType">
|
24
|
+
<xsd:restriction base="xsd:string">
|
25
|
+
<xsd:annotation>
|
26
|
+
<xsd:documentation xml:lang="en">
|
27
|
+
This expression enforces a space delimited list
|
28
|
+
of latitude longitude pairs. The latitude and
|
29
|
+
longitude values are delimited by a comma
|
30
|
+
(i.e. 38.00,-100.00 40.00,-78.00)
|
31
|
+
</xsd:documentation>
|
32
|
+
</xsd:annotation>
|
33
|
+
<xsd:pattern value="[\-]?\d{1,2}\.\d+,[\-]?\d{1,3}\.\d+( [\-]?\d{1,2}\.\d+,[\-]?\d{1,3}\.\d+)*" />
|
34
|
+
</xsd:restriction>
|
35
|
+
</xsd:simpleType>
|
36
|
+
|
37
|
+
<xsd:simpleType name="cityNameListType">
|
38
|
+
<xsd:restriction base="xsd:string">
|
39
|
+
<xsd:annotation>
|
40
|
+
<xsd:documentation xml:lang="en">
|
41
|
+
This expression enforces a coma delimited list city names.
|
42
|
+
The city names are ordered to match the cities latitude
|
43
|
+
and longitude value in the accompanying latLonListType element
|
44
|
+
(i.e. Dallas,Los Angeles,Salt Lake City)
|
45
|
+
</xsd:documentation>
|
46
|
+
</xsd:annotation>
|
47
|
+
<xsd:pattern value="[a-zA-Z'\-]*( ?[a-zA-Z'\-]*)*,[A-Z][A-Z](\|[a-zA-Z'\-]*( ?[a-zA-Z'\-]*)*,[A-Z][A-Z])*" />
|
48
|
+
</xsd:restriction>
|
49
|
+
</xsd:simpleType>
|
50
|
+
|
51
|
+
<xsd:element name="dwml">
|
52
|
+
<xsd:complexType>
|
53
|
+
<xsd:choice>
|
54
|
+
<xsd:sequence>
|
55
|
+
<xsd:element name="head" type="headType" minOccurs="1" maxOccurs="1" />
|
56
|
+
<xsd:element name="data" type="dataType" minOccurs="1" maxOccurs="unbounded">
|
57
|
+
<xsd:keyref name="applicable-locationKey" refer="locationKey">
|
58
|
+
<xsd:selector xpath="data/parameters" />
|
59
|
+
<xsd:field xpath="@applicable-location" />
|
60
|
+
</xsd:keyref>
|
61
|
+
<xsd:keyref name="moreWeatherInformationKey" refer="locationKey">
|
62
|
+
<xsd:selector xpath="data/moreWeatherInformation" />
|
63
|
+
<xsd:field xpath="@applicable-location" />
|
64
|
+
</xsd:keyref>
|
65
|
+
<xsd:keyref name="applicable-timeKey" refer="timeKey">
|
66
|
+
<xsd:selector xpath="data/parameters/*" />
|
67
|
+
<xsd:field xpath="@time-layout" />
|
68
|
+
</xsd:keyref>
|
69
|
+
<xsd:keyref name="applicable-categoriesKey" refer="categoriesKey">
|
70
|
+
<xsd:selector xpath="data/parameters/*" />
|
71
|
+
<xsd:field xpath="@applicable-categories" />
|
72
|
+
</xsd:keyref>
|
73
|
+
<xsd:key name="locationKey">
|
74
|
+
<xsd:selector xpath=".//location" />
|
75
|
+
<xsd:field xpath="location-key" />
|
76
|
+
</xsd:key>
|
77
|
+
<xsd:key name="timeKey">
|
78
|
+
<xsd:selector xpath=".//time-layout" />
|
79
|
+
<xsd:field xpath="layout-key" />
|
80
|
+
</xsd:key>
|
81
|
+
<xsd:key name="categoriesKey">
|
82
|
+
<xsd:selector xpath=".//categories" />
|
83
|
+
<xsd:field xpath="categories-key" />
|
84
|
+
</xsd:key>
|
85
|
+
</xsd:element>
|
86
|
+
</xsd:sequence>
|
87
|
+
<xsd:sequence>
|
88
|
+
<xsd:element name="minResolution" type="xsd:decimal" minOccurs="0" maxOccurs="1" />
|
89
|
+
<xsd:element name="latLonList" type="latLonListType" />
|
90
|
+
<xsd:element name="cityNameList" type="cityNameListType" minOccurs="0" maxOccurs="1" />
|
91
|
+
</xsd:sequence>
|
92
|
+
</xsd:choice>
|
93
|
+
<xsd:attribute name="version" type="xsd:string" default="1.0" />
|
94
|
+
</xsd:complexType>
|
95
|
+
</xsd:element>
|
96
|
+
|
97
|
+
</xsd:schema>
|
@@ -0,0 +1,142 @@
|
|
1
|
+
<?xml version="1.0"?>
|
2
|
+
|
3
|
+
<!-- **********************************************************************
|
4
|
+
|
5
|
+
location.xsd
|
6
|
+
|
7
|
+
John L. Schattel MDL 4 August 2004
|
8
|
+
Red Hat Linux Apache Server
|
9
|
+
|
10
|
+
<xsd:include schemaLocation="http://graphical.weather.gov/xml/DWMLgen/schema/summarizationType.xsd" />
|
11
|
+
|
12
|
+
************************************************************************* -->
|
13
|
+
|
14
|
+
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
15
|
+
|
16
|
+
<xsd:include schemaLocation="summarizationType.xsd" />
|
17
|
+
|
18
|
+
<xsd:complexType name="locationType">
|
19
|
+
<xsd:sequence>
|
20
|
+
<xsd:element name="location-key" type="xsd:string" minOccurs="1" maxOccurs="1" />
|
21
|
+
<xsd:element name="description" type="xsd:string" minOccurs="0" maxOccurs="1" />
|
22
|
+
<xsd:choice>
|
23
|
+
<xsd:element name="point" type="pointType" minOccurs="0" maxOccurs="1" />
|
24
|
+
<xsd:element name="nws-zone" type="nws-zoneType" minOccurs="0" maxOccurs="1" />
|
25
|
+
<xsd:element name="area" type="areaType" minOccurs="0" maxOccurs="1" />
|
26
|
+
</xsd:choice>
|
27
|
+
<xsd:element name="city" type="cityType" minOccurs="0" maxOccurs="1" />
|
28
|
+
<xsd:element name="area-description" type="xsd:string" minOccurs="0" maxOccurs="1" />
|
29
|
+
<xsd:choice>
|
30
|
+
<xsd:element name="height" type="heightType" minOccurs="0" maxOccurs="1" />
|
31
|
+
<xsd:element name="level" type="levelType" minOccurs="0" maxOccurs="1" />
|
32
|
+
<xsd:element name="layer" type="layerType" minOccurs="0" maxOccurs="1" />
|
33
|
+
</xsd:choice>
|
34
|
+
</xsd:sequence>
|
35
|
+
</xsd:complexType>
|
36
|
+
|
37
|
+
<xsd:complexType name="pointType">
|
38
|
+
<xsd:attribute name="latitude" type="xsd:decimal" use="required" />
|
39
|
+
<xsd:attribute name="longitude" type="xsd:decimal" use="required" />
|
40
|
+
<xsd:attribute name="summarization" type="summarizationType" use="optional" />
|
41
|
+
</xsd:complexType>
|
42
|
+
|
43
|
+
<xsd:complexType name="cityType">
|
44
|
+
<xsd:simpleContent>
|
45
|
+
<xsd:extension base="xsd:string">
|
46
|
+
<xsd:attribute name="state" type="xsd:string" use="required" />
|
47
|
+
<xsd:attribute name="summarization" type="summarizationType" use="optional" />
|
48
|
+
</xsd:extension>
|
49
|
+
</xsd:simpleContent>
|
50
|
+
</xsd:complexType>
|
51
|
+
|
52
|
+
<xsd:complexType name="nws-zoneType">
|
53
|
+
<xsd:simpleContent>
|
54
|
+
<xsd:extension base="xsd:string">
|
55
|
+
<xsd:attribute name="state" type="xsd:string" use="required" />
|
56
|
+
<xsd:attribute name="summarization" type="summarizationType" use="optional" />
|
57
|
+
</xsd:extension>
|
58
|
+
</xsd:simpleContent>
|
59
|
+
</xsd:complexType>
|
60
|
+
|
61
|
+
<xsd:complexType name="areaType">
|
62
|
+
<xsd:choice>
|
63
|
+
<xsd:element name="circle" type="circleType" minOccurs="1" maxOccurs="1" />
|
64
|
+
<xsd:element name="rectangle" type="rectangleType" minOccurs="1" maxOccurs="1" />
|
65
|
+
</xsd:choice>
|
66
|
+
<xsd:attribute name="area-type" use="optional">
|
67
|
+
<xsd:simpleType>
|
68
|
+
<xsd:restriction base="xsd:string">
|
69
|
+
<xsd:enumeration value="circle" />
|
70
|
+
<xsd:enumeration value="rectangle" />
|
71
|
+
</xsd:restriction>
|
72
|
+
</xsd:simpleType>
|
73
|
+
</xsd:attribute>
|
74
|
+
</xsd:complexType>
|
75
|
+
|
76
|
+
<xsd:complexType name="circleType">
|
77
|
+
<xsd:sequence>
|
78
|
+
<xsd:element name="point" type="pointType" minOccurs="1" maxOccurs="1" />
|
79
|
+
<xsd:element name="radius" type="radiusType" minOccurs="1" maxOccurs="1">
|
80
|
+
</xsd:element>
|
81
|
+
</xsd:sequence>
|
82
|
+
<xsd:attribute name="summarization" type="summarizationType" use="optional" />
|
83
|
+
</xsd:complexType>
|
84
|
+
|
85
|
+
<xsd:complexType name="radiusType">
|
86
|
+
<xsd:attribute name="radius-units" use="required">
|
87
|
+
<xsd:simpleType>
|
88
|
+
<xsd:restriction base="xsd:string">
|
89
|
+
<xsd:enumeration value="statute miles" />
|
90
|
+
<xsd:enumeration value="kilometers" />
|
91
|
+
</xsd:restriction>
|
92
|
+
</xsd:simpleType>
|
93
|
+
</xsd:attribute>
|
94
|
+
</xsd:complexType>
|
95
|
+
|
96
|
+
<xsd:complexType name="rectangleType">
|
97
|
+
<xsd:sequence>
|
98
|
+
<xsd:element name="point" type="pointType" minOccurs="4" maxOccurs="4" />
|
99
|
+
</xsd:sequence>
|
100
|
+
<xsd:attribute name="summarization" type="summarizationType" use="optional" />
|
101
|
+
</xsd:complexType>
|
102
|
+
|
103
|
+
<xsd:complexType name="heightType">
|
104
|
+
<xsd:simpleContent>
|
105
|
+
<xsd:extension base="xsd:nonNegativeInteger">
|
106
|
+
<xsd:attribute name="datum" type="datumType" use="required" />
|
107
|
+
<xsd:attribute name="height-units" type="height-unitsType" use="optional" />
|
108
|
+
</xsd:extension>
|
109
|
+
</xsd:simpleContent>
|
110
|
+
</xsd:complexType>
|
111
|
+
|
112
|
+
<xsd:complexType name="levelType">
|
113
|
+
<xsd:simpleContent>
|
114
|
+
<xsd:extension base="xsd:nonNegativeInteger">
|
115
|
+
<xsd:attribute name="vertical-coordinate" type="xsd:string" use="optional" />
|
116
|
+
</xsd:extension>
|
117
|
+
</xsd:simpleContent>
|
118
|
+
</xsd:complexType>
|
119
|
+
|
120
|
+
<xsd:complexType name="layerType">
|
121
|
+
<xsd:simpleContent>
|
122
|
+
<xsd:extension base="xsd:nonNegativeInteger">
|
123
|
+
<xsd:attribute name="vertical-coordinate" type="xsd:string" use="optional" />
|
124
|
+
</xsd:extension>
|
125
|
+
</xsd:simpleContent>
|
126
|
+
</xsd:complexType>
|
127
|
+
|
128
|
+
<xsd:simpleType name="datumType">
|
129
|
+
<xsd:restriction base="xsd:string">
|
130
|
+
<xsd:enumeration value="surface" />
|
131
|
+
<xsd:enumeration value="mean sea level" />
|
132
|
+
</xsd:restriction>
|
133
|
+
</xsd:simpleType>
|
134
|
+
|
135
|
+
<xsd:simpleType name="height-unitsType">
|
136
|
+
<xsd:restriction base="xsd:string">
|
137
|
+
<xsd:enumeration value="feet" />
|
138
|
+
<xsd:enumeration value="meters" />
|
139
|
+
</xsd:restriction>
|
140
|
+
</xsd:simpleType>
|
141
|
+
|
142
|
+
</xsd:schema>
|