Skip to content

Commit b9d6a2f

Browse files
authored
Update README.md
1 parent 207b58c commit b9d6a2f

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

README.md

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,12 @@ Accessing CDO data requires a token.
3232

3333
Get a token by going to [www.ncdc.noaa.gov/cdo-web/token](https://www.ncdc.noaa.gov/cdo-web/token) and entering your email address.
3434

35+
### Functions
3536

36-
## `get_climate_data()`
37+
### `get_climate_data()`
3738

3839
The `get_climate_data()` function allows you to retrieve climate and weather data from the [NOAA Climate Data Online (CDO) API](https://www.ncdc.noaa.gov/cdo-web/webservices/v2#gettingStarted) for a wide range of dataset types. It supports pagination and can retrieve large numbers of records by iteratively querying the API.
3940

40-
### Function Overview
41-
4241
```r
4342
get_climate_data(noaa_token, datasetid, stationid = NULL, locationid = NULL, startdate, enddate, n_results = Inf)
4443
```
@@ -55,7 +54,7 @@ get_climate_data(noaa_token, datasetid, stationid = NULL, locationid = NULL, sta
5554
| `enddate` | `string` | End date for the query in `"YYYY-MM-DD"` format. |
5655
| `n_results` | `numeric` | Maximum number of results to return. Use `Inf` (default) to fetch all available records. |
5756

58-
### Supported Dataset IDs
57+
Supported Dataset IDs:
5958

6059
The function currently supports the following datasets:
6160

@@ -72,7 +71,7 @@ The function currently supports the following datasets:
7271
- `AGRMET` – Agricultural Meteorological data
7372
- `STORM_EVENTS` – Storm event data
7473

75-
### Example
74+
Example:
7675

7776
```r
7877
# Example: Get daily precipitation for Central Park, NY in January 2020
@@ -87,12 +86,10 @@ df <- get_climate_data(
8786
```
8887

8988

90-
## `get_locationid()`
89+
### `get_locationid()`
9190

9291
The `get_locationid()` function retrieves location identifiers from the NOAA Climate Data Online (CDO) API based on a specified category. It supports pagination to return large sets of location data.
9392

94-
### Function Overview
95-
9693
```r
9794
get_locationid(noaa_token, category_id, n_results = Inf)
9895
```
@@ -105,7 +102,7 @@ get_locationid(noaa_token, category_id, n_results = Inf)
105102
| `category_id` | `string` | The location category identifier. Must be one of the valid location categories (see below). |
106103
| `n_results` | `numeric` | Maximum number of results to retrieve. Defaults to `Inf` to fetch all available records. |
107104

108-
### Supported Location Category IDs
105+
Supported Location Category IDs:
109106

110107
The function supports the following location categories:
111108

@@ -117,7 +114,7 @@ The function supports the following location categories:
117114
- `HYDROL_REG` – Hydrologic regions used for water resource planning
118115
- `FIPS` – Federal Information Processing Standards codes (e.g., `"FIPS:37"` for North Carolina)
119116

120-
### Example
117+
Example:
121118

122119
```r
123120
# Example: Retrieve a list of U.S. states
@@ -128,15 +125,15 @@ df <- get_locationid(
128125
)
129126
```
130127

131-
### Returns
128+
Returns:
132129

133130
A data frame containing location metadata from the specified category. If no results are returned or the request fails, an error is thrown or an empty data frame is returned.
134131

135-
## `get_stationid()`
132+
### `get_stationid()`
136133

137134
The `get_stationid()` function retrieves weather station metadata from the NOAA Climate Data Online (CDO) API for a given dataset and time range. It supports pagination and can return a large number of station records.
138135

139-
### Function Overview
136+
Function Overview:
140137

141138
```r
142139
get_stationid(noaa_token, datasetid, locationid = NULL, startdate, enddate, n_results = Inf)
@@ -153,7 +150,7 @@ get_stationid(noaa_token, datasetid, locationid = NULL, startdate, enddate, n_re
153150
| `enddate` | `string` | End date in `"YYYY-MM-DD"` format. |
154151
| `n_results` | `numeric` | Maximum number of station records to retrieve. Defaults to `Inf` to fetch all. |
155152

156-
### Example
153+
Example:
157154

158155
```r
159156
# Example: Get stations in Texas for the GHCND dataset during 2020
@@ -167,10 +164,8 @@ df <- get_stationid(
167164
)
168165
```
169166

170-
### Returns
167+
Returns:
171168

172169
A data frame containing weather station metadata, such as station IDs, names, geographic coordinates, and available coverage. If no results are returned or the request fails, an error is thrown or an empty data frame is returned.
173170

174-
175-
176171
A detailed list of NOAA acronyms can be found here: https://www1.ncdc.noaa.gov/pub/data/ghcn/daily/readme.txt

0 commit comments

Comments
 (0)