Update moisture_rnn.py
[notebooks.git] / fmda / OLD / opendap.py
blob6d4c73f3aacd373bf979906f3fd153ecac4db2fc
1 # Required Libraries
2 import xarray as xr
4 # Define the URL for the OpenDAP endpoint
5 # Replace with the specific URL for the dataset you're interested in
6 url = 'https://nomads.ncep.noaa.gov:8080/dods/hrrr/hrrr20200910/hrrr_sfc_t18z'
8 # Load the data using xarray
9 print('xr.open_dataset',url)
10 ds = xr.open_dataset(url)
12 # Specify the point of interest
13 lon_point = -105.0 # longitude of the point of interest
14 lat_point = 40.0 # latitude of the point of interest
16 # Select variable and point of interest
17 # Temperature is usually "tmp2m" for 2 meter temperature
18 # Make sure to check the exact variable name in your dataset
19 print('getting tmp2m at nearest to',lon_point,lat_point)
20 temp_point = ds['tmp2m'].sel(lon=lon_point, lat=lat_point, method='nearest')
22 # Print the time series for the selected point
23 print(temp_point)