Tides & Currents
Published on .
NOAA has a nice tides and currents API, so I wondered how good AI would be at taking a user’s data description like “tides in boston” and generating the API URL with all the query parameters replaced. It works well! Check out the demo at https://nattaylor.com/ai/tidesandcurrents/
I think this idea could have many applications in reporting tools with well defined URL patterns.
The code (below) is really simple, although I wrote a very long and detailed prompt.
from openai import OpenAI
import os
from textwrap import dedent
import re
import requests
api_docs = """
<api_docs>
CO-OPS Data Retrieval API
=========================
### CO-OPS API For Data Retrieval
The CO-OPS API for data retrieval can be used to retrieve observations and predictions from CO-OPS stations.
#### Station ID
A 7 character station ID, or a currents station ID. Specify the station ID with the "station=" parameter.
Examples:
station=9414290 (water level / met station)
station=cb1401 (currents station)
Station listings for various products can be viewed at [https://tidesandcurrents.noaa.gov](https://tidesandcurrents.noaa.gov/) or viewed on a map at [Tides & Currents Station Map](https://tidesandcurrents.noaa.gov/map)
####
Date & Time
The API understands several parameters related to date ranges.
All dates can be formatted as follows:
yyyyMMdd, yyyyMMdd HH:mm, MM/dd/yyyy, or MM/dd/yyyy HH:mm
One the 5 following sets of parameters can be specified in a request:
Parameter Name (s)
Description
begin\_date and end\_date
Specify the date/time range of retrieval
begin\_date and range
Specify a begin date and a number of hours to retrieve data starting from that date
end\_date and range
Specify an end date and a number of hours to retrieve data ending at that date
date
Data from today’s date.
Note! Only available for preliminary water level data, meteorological data and predictions.
Valid options for the date parameter are:
• Today (24 hours starting at midnight)
• Latest (last data point available within the last 18 min)
• Recent (last 72 hours)
range
Specify a number of hours to to back from now and retrieve data for that period
Note!
• If used alone, only available for preliminary water level data, meteorological data
• If used with a historical begin or end date, may be used with verified data
**_Examples:_**
begin\_date=20120101&end\_date=20120102
Retrieves data for January 1st, 2012 through January 2nd, 2012
begin\_date=20120415&range=48
Retrieves data for 48 hours beginning on April 15, 2012
end\_date=20120307&range=48
Retrieves data for 48 hours ending on March 17, 2012
date=today
Retrieves data for today
date=latest
Retrieves the last data point available within the last 18 min
date=recent
Retrieves the last 3 days of data
range=12
Retrieves the last 12 hours of data
####
Data Products
Specify the type of data with the "product=" option parameter.
**Data Length Limitations:**
To prevent numerous large data requests slowing data access through the internet services; all internet data services have limits on the amount/length of data which can be retrieved per request. These limits are based on the interval of data requested.
1-minute interval data
Data length is limited to 4 days
6-minute interval data
Data length is limited to 1 month
Hourly interval data
Data length is limited to 1 year
High / Low data
Data length is limited to 1 year
Daily Means data
Data length is limited to 10 years
Monthly Means data
Data length is limited to 200 years
**Tides / Water Levels Data**
Note!Data is verified on a monthly basis for the past month. (Example: January data is verified in February). No specific date can be provided for verified data availability; as the order stations are verified will change each month to avoid appearances of one station being “more important” than another.
[Datum is mandatory for water level data products, except Air Gap](#datum)
**Option**
**Description**
water\_level
Preliminary or verified 6-minute interval water levels, depending on data availability.
hourly\_height
Verified hourly height water level data for the station.
high\_low
Verified high tide / low tide water level data for the station.
daily\_mean
Verified daily mean water level data for the station.
Note!Great Lakes stations only. [Only available with “time\_zone=LST”](#timezone)
monthly\_mean
Verified monthly mean water level data for the station.
one\_minute\_water\_level
Preliminary 1-minute interval water level data for the station.
predictions
Water level / tide prediction data for the station.
Note![See Interval for available data interval options and data length limitations.](#interval)
datums
Observed tidal datum values at the station for the present [National Tidal Datum Epoch (NTDE).](https://tidesandcurrents.noaa.gov/datum-updates/ntde/#:~:text=The%20National%20Tidal%20Datum%20Epoch,%2C%20mean%20lower%20low%20water).)
air\_gap
Air Gap (distance between a bridge and the water's surface) at the station.
**Meteorological Data**
Note!Default is 6-minute interval data. [Use with “interval=h” for hourly data](#interval)
**Option**
**Description**
air\_temperature
Air temperature as measured at the station.
water\_temperature
Water temperature as measured at the station.
wind
Wind speed, direction, and gusts as measured at the station.
air\_pressure
Barometric pressure as measured at the station.
conductivity
The water's conductivity as measured at the station.
visibility
Visibility (atmospheric clarity) as measured at the station.
[(Units of Nautical Miles or Kilometers.)](#units)
humidity
Relative humidity as measured at the station.
salinity
Salinity and specific gravity data for the station.
**Currents Data**
[Bin is required for most stations](#bin)
**Option**
**Description**
currents
Currents data for the station. Note! Default data interval is 6-minute interval data.[Use with “interval=h” for hourly data](#interval)\> There may be differences in bin depths across the deployments as sensor depth and on rare occasions bin size could change when a sensor is re-deployed.
currents\_predictions
Currents prediction data for the stations. Note! [See Interval for options available and data length limitations.](#interval)
**Operational Forecast (OFS)**
Note! Model nowcast / forecast data is available at most real-time water level stations within OFS model domains.
**Option**
**Description**
ofs\_water\_level
Water level model guidance at 6-minute intervals based on NOS OFS models. Data available from 2020 to present.
**_Examples:_**
product=water\_level
Retrieves 6-minute interval water level data for the station
product=hourly\_height
Retrieves verified hourly water level data for the station
product=visibility
Retrieves visibility data for the station
product =currents\_predictions
Retrieves predicted currents for the station
product=ofs\_water\_level
Retrieves 6-minute nowcast/forecast guidance from OFS models for the station
#### Expand
The expand can be specified with the "expand=" option parameter.
Note! expand is for currents product to retrieve echo intensity and correlation magnitude data.
Only apply to currents product.
Option
Description
detailed
Currents product - to retrieve echo intensity and correlation magnitude data(The units are in counts)
**_Examples:_**
expand=detailed
Retrieves currents data with echo intensity and correlation magnitude data for the station
#### Datum
The datum can be specified with the "datum=" option parameter.
Note! Datum is mandatory for all water level products to correct the data to the reference point desired.
Does not apply to Air Gap data, which is only provided relative to a fixed reference point on the bridge.
Option
Description
CRD
Columbia River Datum. Note!Only available for certain stations on the Columbia River, Washington/Oregon
IGLD
International Great Lakes Datum Note! Only available for Great Lakes stations.
LWD
Great Lakes Low Water Datum (Nautical Chart Datum for the Great Lakes).
Note! Only available for Great Lakes Stations
MHHW
Mean Higher High Water
MHW
Mean High Water
MTL
Mean Tide Level
MSL
Mean Sea Level
MLW
Mean Low Water
MLLW
Mean Lower Low Water (Nautical Chart Datum for all U.S. coastal waters)
Note! Subordinate tide prediction stations must use “datum=MLLW”
NAVD
North American Vertical Datum Note! This datum is not available for all stations.
STND
Station Datum - original reference that all data is collected to, uniquely defined for each station.
**_Examples:_**
datum=MLLW
Retrieves data with heights relative to Mean Lower Low Water (MLLW) for the station
####
Units
The unit type can be specified with the "units=" option parameter.
Option
Description
metric
Metric units (Celsius, meters, cm/s appropriate for the data)
Note!Visibility data is kilometers (km), Currents data is in cm/s.
english
English units (fahrenheit, feet, knots appropriate for the data)
Note!Visibility data is Nautical Miles (nm), Currents data is in knots.
**_Examples:_**
units=english
Retrieves data in english units.
####
Time Zone
The time\_zone of the data can be specified with the "time\_zone=" option parameter.
Note!Does not apply to products of datums or monthly\_mean; daily\_mean (Great Lakes) must use time\_zone=lst
Option
Description
gmt
Greenwich Mean Time
lst
Local Standard Time, not corrected for Daylight Saving Time, local to the requested station.
lst\_ldt
Local Standard Time, corrected for Daylight Saving Time when appropriate, local to the requested station
**_Examples:_**
time\_zone=gmt
Retrieves data with date/times in Greenwich Mean Time.
time\_zone=lst\_ldt
Retrieves data with dates/times in Local Time, adjusted for daylight saving time when appropriate.
####
Interval
**Tide/Water Level Data
**Verified water level height data cannot be retrieved using the Interval parameter.
Each available interval for verified water level data is a separate data product and must be retrieved using the appropriate product type.
**Tide/Water Level Predictions**
Note! Harmonic tide prediction stations can provide tide predictions on any available interval.
Subordinate tide prediction stations can only provide tide predictions on a high / low interval.
Data Length Limitation: High/Low tide predictions are limited to 10 years. All other intervals are limited to 1 year.
Option
Description
h
Hourly tide predictions for the station.
1, 5, 6, 10, 15, 30, 60
Tide predictions on the interval (number of minutes) requested. These are the only values accepted.
hilo
Tide predictions for high tide and low tide times and heights.
**_Examples:_**
interval=h
Returns tide predictions on an hourly interval
interval=15
Returns tide predictions on a 15-minute interval
interval =hilo
Returns tide predictions for high tide and low tide times and heights
**Currents Data**
Note!The default interval is a 6-minute interval and there is no need to specify it.
Option
Description
h
Hourly interval data (the 6-minute interval value on the hour) is returned.
**_Examples:_**
interval=h
Retrieves current data on the hour.
**Currents Predictions**
Note!Harmonic currents prediction stations can provide tidal current predictions on any available interval.
Subordinate current prediction stations can only provide tidal current predictions on a max/slack interval.
Data Length Limitation: Max\_Slack current predictions are limited to 1 year. All other intervals are limited to 1 month.
Option
Description
h
Hourly current predictions for the station.
1, 6, 10, 30, 60
Current predictions on the interval (number of minutes) requested. These are the only values accepted.
max\_slack
Current predictions of max flood/ebb currents (time and speed) and slack water (times).
**_Examples:_**
interval=h
Returns current predictions on an hourly interval
interval=10
Returns current predictions on a 10-minute interval
interval=max\_slack
Returns current predictions for max flood, slack water, and max ebb currents
**
Meteorological Data**
Note! The default interval is a 6-minute interval and there is no need to specify it.
Option
Description
h
Hourly interval data (the 6-minute interval value on the hour) is returned.
**_Examples:_**
interval=h
Retrieves meteorological data on the hour.
####
Bin
Current data and predictions provide information for a specific depth, each depth available for a station has a different Bin number.
• At PORTS (real time currents) stations a bin number is not required, the data is returned using a predefined bin.
◦ If a bin number of 0 (bin=0) is used, data for all bins are provided. (Data Length Limitation: 7 days for all bins)
• All other current stations require a bin number to access data.
• Historic Survey Current Stations - the Bin numbers / depths for historical survey currents stations are available through the [MetaData API](https://api.tidesandcurrents.noaa.gov/mdapi/prod/)
◦ If a bin number of 0 (bin=0) is used, data for all bins is provided. (Data Length Limitation: 7 days for all bins)
• Tidal current predictions stations - the Bin number for tidal current prediction stations are available through the [MetaData API](https://api.tidesandcurrents.noaa.gov/mdapi/prod/) and [Soap Web Services Station Listing](https://opendap.co-ops.nos.noaa.gov/axis/webservices/currentpredictionstations/response.jsp?format=html)
◦ If a bin number is not used, the bin nearest the surface will be provided.
◦ Using an invalid number (like bin=-1) will provide an error message noting the valid bin numbers.
Option
Description
<numerical value>
The bin number requested
**_Examples:_**
bin=3
Returns currents data for bin number 3 of the specified station
####
Velocity Type
The Velocity Type can be specified with the "vel\_type=" option parameter.
Note! This only applies to Current Predictions at Harmonic Stations.
Option
Description
speed\_dir
Return results for speed and direction -the 2 dimensional speed and direction, may not match flood/ebb directions
Note!only supports current prediction intervals of 1, 6, 10, 30, 60; does not apply to max\_slack predictions.
default
Return results for velocity major, mean flood direction and mean ebb direction.
If not included in the API query, the default is automatically used
**_Examples:_**
Vel\_type = speed\_dir
Returns current predictions data in a velocity and direction output.
Vel\_type = default
Returns current predictions data in flood/ebb directions
####
Format
The data file output format can be specified.
Option
Description
xml
Extensible Markup Language. This format is an industry standard for data.
json
Javascript Object Notation. This format is useful for direct import to a javascript plotting library. Parsers are available for other languages such as Java and Perl.
csv
Comma Separated Values. This format is suitable for import into Microsoft Excel or other spreadsheet programs.
**_Examples:_**
format=xml
Returns data requested in xml format.
####
Application
This parameter provides an “identifier” in automated activity / error logs that allows us to identify your query from others.
This allows us to identify and assist you in correcting any problems encountered in your query.
• External Users: please use the name of your company, organization, application, your name, or a combination / variation of these.
• Internal NOAA Users: please include the office acronym and name of the application calling the API.
Initials, abbreviations or acronyms for part of the value are acceptable.
Separate words of the name can be separated by an underscore, or merged into a single entry.
Note! This is not a required parameter. Not including the parameter will make identifying issues through automated logs impossible.
**_Examples:_**
Your\_Company
A user or application from Your Company has called the API
MyTideApp
An application, My Tide App, has called the API
John\_Public
The customer, John Public, has called the API
UnivAlpha\_AStudent
The customer, A. Student from University Alpha, has called the API
NWSMarineForecast
The NOAA National Weather Service (NWS), Marine Forecast application has called the API
####
Data API Response Descriptions
The formatted data responses (columns and data flags) for different data types are described in the [Response Help Page.](https://api.tidesandcurrents.noaa.gov/api/prod/responseHelp.html)
####
Sample API Queries
Note! The order of specific parameters listed in the query is flexible. The samples below use the parameter order created by our [API Builder Tool.](https://tidesandcurrents.noaa.gov/api-helper/url-generator.html)
• Real Time Water Levels Data - 9414290 San Francisco, CA - Today.[
https://api.tidesandcurrents.noaa.gov/api/prod/datagetter?date=today&station=9414290&product=water\_level&datum=MLLW&time\_zone=gmt&units=english&application=DataAPI\_Sample&format=xml](https://api.tidesandcurrents.noaa.gov/api/prod/datagetter?date=today&station=9414290&product=water_level&datum=MLLW&time_zone=gmt&units=english&application=DataAPI_Sample&format=xml)
• Verified Hourly Heights Data - 8518750 The Battery, NY - 2020
[https://api.tidesandcurrents.noaa.gov/api/prod/datagetter?begin\_date=20200101&end\_date=20201231&station=8518750&product=hourly\_height&datum=MLLW&time\_zone=lst&units=metric&application=DataAPI\_Sample&format=json](https://api.tidesandcurrents.noaa.gov/api/prod/datagetter?begin_date=20200101&end_date=20201231&station=8518750&product=hourly_height&datum=MLLW&time_zone=lst&units=metric&application=DataAPI_Sample&format=json)
• Tide Predictions (high/low) - 8557863 Rehoboth Beach, MD - August 2025
[https://api.tidesandcurrents.noaa.gov/api/prod/datagetter?begin\_date=20250801&end\_date=20250831&station=8557863&product=predictions&datum=MLLW&time\_zone=lst\_ldt&interval=hilo&units=english&application=DataAPI\_Sample&format=xml](https://api.tidesandcurrents.noaa.gov/api/prod/datagetter?begin_date=20250801&end_date=20250831&station=8557863&product=predictions&datum=MLLW&time_zone=lst_ldt&interval=hilo&units=english&application=DataAPI_Sample&format=xml)
• Wind Data (Hourly) - 8724580 Key West, FL - June 2021
[https://api.tidesandcurrents.noaa.gov/api/prod/datagetter?begin\_date=20210601&end\_date=20210630&station=8724580&product=wind&time\_zone=lst\_ldt&interval=h&units=english&application=DataAPI\_Sample&format=csv](https://api.tidesandcurrents.noaa.gov/api/prod/datagetter?begin_date=20210601&end_date=20210630&station=8724580&product=wind&time_zone=lst_ldt&interval=h&units=english&application=DataAPI_Sample&format=csv)
• Visibility Data - 8453662 Providence Visibility (kilometers) - Today
[https://api.tidesandcurrents.noaa.gov/api/prod/datagetter?date=today&station=8453662&product=visibility&time\_zone=lst\_ldt&units=metric&format=csv](https://api.tidesandcurrents.noaa.gov/api/prod/datagetter?date=today&station=8453662&product=visibility&time_zone=lst_ldt&units=metric&format=csv)
• Real Time Currents Data - cb0102 Cape Henry (PORTS station) - Today
[https://api.tidesandcurrents.noaa.gov/api/prod/datagetter?date=today&station=cb0102&product=currents&time\_zone=gmt&units=english&application=DataAPI\_Sample&format=xml](https://api.tidesandcurrents.noaa.gov/api/prod/datagetter?date=today&station=cb0102&product=currents&time_zone=gmt&units=english&application=DataAPI_Sample&format=xml)
• Historical Currents Survey Data - CFR1624 Southport, NC; 10ft depth (bin 9) - April 2016
[https://api.tidesandcurrents.noaa.gov/api/prod/datagetter?begin\_date=20160401&end\_date=20160430&station=CFR1624&product=currents&time\_zone=gmt&units=english&application=DataAPI\_Sample&format=csv&bin=9](https://api.tidesandcurrents.noaa.gov/api/prod/datagetter?begin_date=20160401&end_date=20160430&station=CFR1624&product=currents&time_zone=gmt&units=english&application=DataAPI_Sample&format=csv&bin=9)
• Current Predictions (10 minute Interval, flood/ebb direction) - EPT0003 Eastport, Estes Head - Today
[https://api.tidesandcurrents.noaa.gov/api/prod/datagetter?date=today&station=EPT0003&product=currents\_predictions&time\_zone=gmt&interval=10&units=english&application=DataAPI\_Sample&format=xml&bin=14](https://api.tidesandcurrents.noaa.gov/api/prod/datagetter?date=today&station=EPT0003&product=currents_predictions&time_zone=gmt&interval=10&units=english&application=DataAPI_Sample&format=xml&bin=14)
• Current Predictions (10 Minute Interval, speed/direction) - EPT0003 Eastport, Estes Head - Today
[https://api.tidesandcurrents.noaa.gov/api/prod/datagetter?date=today&station=EPT0003&product=currents\_predictions&time\_zone=gmt&interval=10&units=english&vel\_type=speed\_dir&application=DataAPI\_Sample&format=xml&bin=14](https://api.tidesandcurrents.noaa.gov/api/prod/datagetter?date=today&station=EPT0003&product=currents_predictions&time_zone=gmt&interval=10&units=english&vel_type=speed_dir&application=DataAPI_Sample&format=xml&bin=14)
• Current Predictions (Max/Slack) - PCT1291 Grays Harbor Entrance, WA - November 2022
[https://api.tidesandcurrents.noaa.gov/api/prod/datagetter?begin\_date=20221101&end\_date=20221130&station=PCT1291&product=currents\_predictions&time\_zone=lst&interval=MAX\_SLACK&units=english&application=DataAPI\_Sample&format=xml&bin=1](https://api.tidesandcurrents.noaa.gov/api/prod/datagetter?begin_date=20221101&end_date=20221130&station=PCT1291&product=currents_predictions&time_zone=lst&interval=MAX_SLACK&units=english&application=DataAPI_Sample&format=xml&bin=1)
• OFS Water Level (6-min) - 8638610 Sewells Point, VA (CBOFS)
[https://api.tidesandcurrents.noaa.gov/api/prod/datagetter?begin\_date=20220701&end\_date=20220703&station=8638610&product=ofs\_water\_level&datum=MLLW&time\_zone=gmt&units=english&format=xml](https://api.tidesandcurrents.noaa.gov/api/prod/datagetter?begin_date=20220701&end_date=20220703&station=8638610&product=ofs_water_level&datum=MLLW&time_zone=gmt&units=english&format=xml)
• OFS Water Level (6-min) - 9063020 Buffalo, NY (LEOFS)
[https://api.tidesandcurrents.noaa.gov/api/prod/datagetter?begin\_date=20220701&end\_date=20220703&station=9063020&product=ofs\_water\_level&datum=LWD&time\_zone=gmt&units=english&format=xml](https://api.tidesandcurrents.noaa.gov/api/prod/datagetter?begin_date=20220701&end_date=20220703&station=9063020&product=ofs_water_level&datum=LWD&time_zone=gmt&units=english&format=xml)
####
Error Message
Depending on the nature of the exception the user will get a customized error message back in the same format of the request.
<?xml version="1.0" encoding="UTF-8" ?>
<error>
Wrong Date: The end date should be greater than the begin date
</error>
{
"error":
{
"message":
"Great Lakes stations don't have Predictions data."
}
}
####
Contact Us
E-mail: [User Services (co-ops.userservices@noaa.gov)](mailto:co-ops.userservices@noaa.gov?subject=CO-OPS%20Data%20API)
</api_docs>"""
def generate(prompt):
client = OpenAI(
api_key=os.environ["GEMINI_API_KEY"],
base_url="https://generativelanguage.googleapis.com/v1beta/openai/"
)
response = client.chat.completions.create(
model="gemini-1.5-flash-8b",
n=1,
messages=[
{"role": "system", "content": dedent("""\
You are tasked with generating a URL for api.tidesandcurrents.noaa.gov that according to the users request. Follow these instructions carefully to construct the URL:
1. Consider the full API docs:
""" + api_docs + """
2. Start with the base URL:
<base_url>https://api.tidesandcurrents.noaa.gov/api/prod/datagetter</base_url>
3. You will need to add the following required parameters to the URL:
- station: The station ID for Boston
- product: The type of data you're requesting (predictions)
- date: The date range for the predictions
- units: The unit of measurement
- time_zone: The time zone for the data
- datum: The tidal datum
- format: The format of the response
4. Here is the stations
<stations>
Dauphin Island, AL 8735180
Dog River Bridge, AL 8735391
East Fowl River Bridge, AL 8735523
Coast Guard Sector Mobile, AL 8736897
Mobile State Docks, AL 8737048
Chickasaw Creek, AL 8737138
West Fowl River Bridge, AL 8738043
Bayou La Batre Bridge, AL 8739803
Map icon Alaska
Ketchikan, AK 9450460
Port Alexander, AK 9451054
Sitka, AK 9451600
Juneau, AK 9452210
Skagway, Taiya Inlet, AK 9452400
Elfin Cove, AK 9452634
Yakutat, Yakutat Bay, AK 9453220
Cordova, AK 9454050
Valdez, AK 9454240
Seward, AK 9455090
Seldovia, AK 9455500
Nikiski, AK 9455760
Anchorage, AK 9455920
Kodiak Island, AK 9457292
Alitak, AK 9457804
Sand Point, AK 9459450
King Cove, AK 9459881
Adak Island, AK 9461380
Atka, AK 9461710
Nikolski, AK 9462450
Unalaska, AK 9462620
Port Moller, AK 9463502
Village Cove, St Paul Island, AK 9464212
Unalakleet, AK 9468333
Nome, Norton Sound, AK 9468756
Red Dog Dock, AK 9491094
Prudhoe Bay, AK 9497645
Map icon Bermuda
Bermuda Biological Station, Bermuda 2695535
Bermuda, St. Georges Island, Bermuda 2695540
Map icon California
San Diego, CA 9410170
La Jolla, CA 9410230
Los Angeles, CA 9410660
Santa Monica, CA 9410840
Santa Barbara, CA 9411340
Port San Luis, CA 9412110
Monterey, CA 9413450
San Francisco, CA 9414290
Redwood City, CA 9414523
Alameda, CA 9414750
Richmond, CA 9414863
Point Reyes, CA 9415020
Martinez-Amorco Pier, CA 9415102
Port Chicago, CA 9415144
Arena Cove, CA 9416841
North Spit, CA 9418767
Crescent City, CA 9419750
Map icon Caribbean/Central America
Christiansted Harbor, St Croix, VI 9751364
Lameshur Bay, St John, VI 9751381
Limetree Bay, VI 9751401
Charlotte Amalie, VI 9751639
Culebra, PR 9752235
Esperanza, Vieques Island, PR 9752695
San Juan, La Puntilla, San Juan Bay, PR 9755371
Magueyes Island, PR 9759110
Mayaguez, PR 9759394
Mona Island, PR 9759938
Map icon Connecticut
New London, CT 8461490
New Haven, CT 8465705
Bridgeport, CT 8467150
Map icon Delaware
Delaware City, DE 8551762
Reedy Point, DE 8551910
Brandywine Shoal Light, DE 8555889
Lewes, DE 8557380
Map icon District of Columbia
Washington, DC 8594900
Map icon Florida
Fernandina Beach, FL 8720030
Mayport (Bar Pilots Dock), FL 8720218
Dames Point, FL 8720219
Southbank Riverwalk, St Johns River, FL 8720226
I-295 Buckman Bridge, FL 8720357
Trident Pier, Port Canaveral, FL 8721604
Lake Worth Pier, Atlantic Ocean, FL 8722670
South Port Everglades, FL 8722956
Virginia Key, FL 8723214
Vaca Key, Florida Bay, FL 8723970
Key West, FL 8724580
Naples Bay, North, FL 8725114
Fort Myers, FL 8725520
Port Manatee, FL 8726384
St. Petersburg, FL 8726520
Old Port Tampa, FL 8726607
East Bay, FL 8726674
Clearwater Beach, FL 8726724
Cedar Key, FL 8727520
Apalachicola, FL 8728690
Panama City, FL 8729108
Panama City Beach, FL 8729210
Pensacola, FL 8729840
Map icon Georgia
Fort Pulaski, GA 8670870
Kings Bay MSF Pier, GA 8679598
Map icon Great Lakes - Detroit River
Gibraltar, MI 9044020
Wyandotte, MI 9044030
Fort Wayne, MI 9044036
Windmill Point, MI 9044049
Map icon Great Lakes - Lake Erie
Buffalo, NY 9063020
Sturgeon Point, NY 9063028
Erie, Lake Erie, PA 9063038
Fairport, OH 9063053
Cleveland, OH 9063063
Marblehead, OH 9063079
Toledo, OH 9063085
Fermi Power Plant, MI 9063090
Map icon Great Lakes - Lake Huron
Lakeport, MI 9075002
Harbor Beach, MI 9075014
Essexville, MI 9075035
Alpena, MI 9075065
Mackinaw City, MI 9075080
De Tour Village, MI 9075099
Map icon Great Lakes - Lake Michigan
Ludington, MI 9087023
Holland, MI 9087031
Calumet Harbor, IL 9087044
Milwaukee, WI 9087057
Kewaunee, Lake Michigan, WI 9087068
Sturgeon Bay Canal, WI 9087072
Green Bay East, WI 9087077
Menominee, MI 9087088
Port Inland, MI 9087096
Map icon Great Lakes - Lake Ontario
Cape Vincent, NY 9052000
Oswego, NY 9052030
Rochester, NY 9052058
Olcott, NY 9052076
Map icon Great Lakes - Lake St. Clair
St Clair Shores, MI 9034052
Map icon Great Lakes - Lake Superior
Point Iroquois, MI 9099004
Marquette C.G., MI 9099018
Ontonagon, MI 9099044
Duluth, MN 9099064
Grand Marais, Lake Superior, MN 9099090
Map icon Great Lakes - Niagara River
Ashland Ave, NY 9063007
American Falls, NY 9063009
Niagara Intake, NY 9063012
Map icon Great Lakes - St. Clair River
Algonac, MI 9014070
St. Clair State Police, MI 9014080
Dry Dock, MI 9014087
Mouth of the Black River, MI 9014090
Fort Gratiot, MI 9014098
Map icon Great Lakes - St. Lawrence River
Ogdensburg, NY 8311030
Alexandria Bay, NY 8311062
Map icon Great Lakes - St. Marys River
Rock Cut, MI 9076024
West Neebish Island, MI 9076027
Little Rapids, MI 9076033
U.S. Slip, MI 9076060
S.W. Pier, St. Marys River, MI 9076070
Map icon Hawaii
Nawiliwili, HI 1611400
Honolulu, HI 1612340
Pearl Harbor, HI 1612401
Mokuoloe, HI 1612480
Kahului, Kahului Harbor, HI 1615680
Kawaihae, HI 1617433
Hilo, Hilo Bay, Kuhio Bay, HI 1617760
Map icon Louisiana
Pilottown, LA 8760721
Pilots Station East, S.W. Pass, LA 8760922
Shell Beach, LA 8761305
Grand Isle, LA 8761724
New Canal Station, LA 8761927
Carrollton, LA 8761955
Port Fourchon, Belle Pass, LA 8762075
West Bank 1, Bayou Gauche, LA 8762482
Berwick, Atchafalaya River, LA 8764044
LAWMA, Amerada Pass, LA 8764227
Eugene Island, North of, Atchafalaya Bay, LA 8764314
Freshwater Canal Locks, LA 8766072
Lake Charles, LA 8767816
Bulk Terminal, LA 8767961
Calcasieu Pass, LA 8768094
Map icon Maine
Eastport, ME 8410140
Cutler Farris Wharf, ME 8411060
Bar Harbor, ME 8413320
Portland, ME 8418150
Seavey Island, ME 8419870
Map icon Maryland
Ocean City Inlet, MD 8570283
Bishops Head, MD 8571421
Cambridge, MD 8571892
Tolchester Beach, MD 8573364
Chesapeake City, MD 8573927
Baltimore, MD 8574680
Annapolis, MD 8575512
Solomons Island, MD 8577330
Map icon Massachusetts
Boston, MA 8443970
Fall River, MA 8447386
Chatham, MA 8447435
New Bedford Harbor, MA 8447636
Woods Hole, MA 8447930
Nantucket Island, MA 8449130
Map icon Mississippi
Pascagoula NOAA Lab, MS 8741533
Bay Waveland Yacht Club, MS 8747437
Map icon New Jersey
Sandy Hook, NJ 8531680
Atlantic City, NJ 8534720
Cape May, NJ 8536110
Ship John Shoal, NJ 8537121
Burlington, Delaware River, NJ 8539094
Map icon New York
Montauk, NY 8510560
Kings Point, NY 8516945
The Battery, NY 8518750
Turkey Point Hudson River NERRS, NY 8518962
Map icon North Carolina
Duck, NC 8651370
Oregon Inlet Marina, NC 8652587
USCG Station Hatteras, NC 8654467
Beaufort, Duke Marine Lab, NC 8656483
Wilmington, NC 8658120
Wrightsville Beach, NC 8658163
Map icon Oregon
Port Orford, OR 9431647
Charleston, OR 9432780
South Beach, OR 9435380
Garibaldi, OR 9437540
Astoria, OR 9439040
Wauna, OR 9439099
St Helens, OR 9439201
Map icon Pacific Islands
Sand Island, Midway Islands, United States of America 1619910
Apra Harbor, Guam, United States of America 1630000
Pago Bay, Guam, United States of America 1631428
Pago Pago, American Samoa, American Samoa 1770000
Kwajalein, Marshall Islands, United States of America 1820000
Wake Island, Pacific Ocean, United States of America 1890000
Map icon Pennsylvania
Marcus Hook, PA 8540433
Philadelphia, PA 8545240
Bridesburg, PA 8546252
Newbold, PA 8548989
Map icon Rhode Island
Newport, RI 8452660
Conimicut Light, RI 8452944
Providence, RI 8454000
Quonset Point, RI 8454049
Map icon South Carolina
Springmaid Pier, SC 8661070
Charleston, SC 8665530
Map icon Texas
Port Arthur, TX 8770475
Rainbow Bridge, TX 8770520
Morgans Point, Barbours Cut, TX 8770613
Manchester, TX 8770777
High Island, TX 8770808
Texas Point, Sabine Pass, TX 8770822
Rollover Pass, TX 8770971
Eagle Point, Galveston Bay, TX 8771013
Galveston Bay Entrance, North Jetty, TX 8771341
Sabine Offshore Light, TX 8771367
Galveston Pier 21, TX 8771450
Galveston Railroad Bridge, TX 8771486
San Luis Pass, TX 8771972
Freeport Harbor, TX 8772471
Sargent, TX 8772985
Seadrift, TX 8773037
Matagorda City, TX 8773146
Port Lavaca, TX 8773259
Port O'Connor, TX 8773701
Matagorda Bay Entrance Channel, TX 8773767
Aransas Wildlife Refuge, TX 8774230
Rockport, TX 8774770
La Quinta Channel North, TX 8775132
Viola Turning Basin, TX 8775222
Port Aransas, TX 8775237
Aransas, Aransas Pass, TX 8775241
Enbridge, Ingleside, TX 8775283
USS Lexington, Corpus Christi Bay, TX 8775296
Packery Channel, TX 8775792
S. Bird Island, TX 8776139
Baffin Bay, TX 8776604
Rincon Del San Jose, TX 8777812
Port Mansfield, TX 8778490
Realitos Peninsula, TX 8779280
South Padre Island CG Station, TX 8779748
SPI Brazos Santiago, TX 8779749
Port Isabel, TX 8779770
Map icon Virginia
Wachapreague, VA 8631044
Kiptopeke, VA 8632200
Dahlgren, VA 8635027
Lewisetta, VA 8635750
Windmill Point, VA 8636580
Yorktown USCG Training Center, VA 8637689
Sewells Point, VA 8638610
CBBT, Chesapeake Channel, VA 8638901
Money Point, VA 8639348
Map icon Washington
Vancouver, WA 9440083
TEMCO Kalama Terminal, WA 9440357
Longview, WA 9440422
Skamokawa, WA 9440569
Cape Disappointment, WA 9440581
Toke Point, WA 9440910
Westport, WA 9441102
La Push, Quillayute River, WA 9442396
Neah Bay, WA 9443090
Port Angeles, WA 9444090
Port Townsend, WA 9444900
Bremerton, WA 9445958
Tacoma, WA 9446484
Seattle, WA 9447130
Cherry Point, WA 9449424
Friday Harbor, WA 9449880
</stations>
5. Combine the base URL with the parameters, separating each parameter with an ampersand (&) and beginning the parameter list with a question mark (?).
6. Here's an example of how the final URL should look:
https://api.tidesandcurrents.noaa.gov/api/prod/datagetter?station=8443970&product=predictions&date=latest&units=english&time_zone=lst_ldt&datum=STND&format=json
7. Now, construct the URL using the provided base URL and the required parameters. Output your final URL within <generated_url> tags. You can pick the nearest station. Do not explain.
Remember to double-check that you've included all required parameters and that they are correctly formatted before submitting your answer.""")},
{
"role": "user",
"content": prompt
}
]
)
return re.findall(r".*<generated_url>(.*?)<\/generated_url>.*", response.choices[0].message.content)[0]
def render(url):
response = requests.get(url).json()
key = list(response.keys())[-1]
cols = list(response[key][0].keys())
return {'cols': cols, 'data': [list(x.values()) for x in response[key]]}
def handle(payload):
return render(generate(payload['text']))