Ultra High-res SST#

This notebook maps the sea surface temperature in the waters around Rhode Island at a set of times, as specified in the program. The dataset’s resolution is high enough that it should be able to capture the entire region modeled by OSOM, and could be used for climatologies and other means of comparison between model output and observation.

In the maps shown, note the ocean heat wave of 2012.

#first, some installs and imports:
!pip install netCDF4
import requests
from netCDF4 import Dataset as NetCDFFile
import matplotlib.pyplot as plt
#the code dealing with datetime here is based on code at this link: https://stackoverflow.com/questions/1060279/iterating-through-a-range-of-dates-in-python
#from google.colab import drive
#drive.mount('/content/gdrive')
#images_dir = '/content/gdrive/Shared drives/BFK_BOG/SURF_UG/Benny/Images/jplMURSST41'
import numpy as np
from datetime import date, timedelta
dates2 = []
#making a list of dates:
start_date = date(2003, 3, 1)
end_date = date(2020, 6, 2)
delta = timedelta(days = 365)
while start_date<=end_date:
  dates2.append(str(start_date))
  start_date += delta
def make_url():
  for i in dates2: #looping through the list of dates
    #making the url and opening the dataset:
    url = 'https://pricaimcit.services.brown.edu/erddap/griddap/jplMURSST41.nc?analysed_sst[('+i+'T09:00:00Z):1:('+i+'T09:00:00Z)][(40.5):1:(42.25)][(-72.75):1:(-69.75)]'
    r = requests.get(url, allow_redirects=True)
    open('test.nc', 'wb').write(r.content)
    nc = NetCDFFile('test.nc')
    nc
    #defining some dataset variables:
    lat = nc.variables['latitude'][:]
    lon = nc.variables['longitude'][:]
    time = nc.variables['time'][:]
    sst = nc.variables['analysed_sst'][:]
    plt.figure(i)
    myplot = plt.pcolormesh(lon, lat, sst[0, :, :], cmap = 'plasma', vmin = 0, vmax = 10)
    plt.title('Sea Surface Temp (Degrees C) '+i)
    plt.colorbar()
    plt.xlabel('Longitude (degrees)')
    plt.ylabel('Latitude (degrees)')
    plt.show()
    #plt.savefig(f"{images_dir}/Sea Surface Temp (Daily) "+i+".png")
make_url()
Go to this URL in a browser: https://accounts.google.com/o/oauth2/auth?client_id=947318989803-6bn6qk8qdgf4n4g3pfee6491hc0brc4i.apps.googleusercontent.com&redirect_uri=urn%3aietf%3awg%3aoauth%3a2.0%3aoob&scope=email%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdocs.test%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdrive%20https%3a%2f%2fwww.googleapis.com%2fauth%2fdrive.photos.readonly%20https%3a%2f%2fwww.googleapis.com%2fauth%2fpeopleapi.readonly&response_type=code

Enter your authorization code:
··········
Mounted at /content/gdrive
/usr/local/lib/python3.6/dist-packages/ipykernel_launcher.py:24: RuntimeWarning: invalid value encountered in greater
../../_images/c48ab0633725ae550866996faaf291b9190de389a61ae2067bffe6ad3d8d0267.png ../../_images/7158c7d16816b19a61afacd92e33e9d618455f05dd7c4ba54072ac8b34337ede.png ../../_images/87ae769fa5dfe87ddb344d597bf31247b1f34f422809547ef20d0bff43c245e9.png ../../_images/528f60f6b953279b244469d5096c2f79ad83af5bc0d8d53beef73c10cdbedcbb.png ../../_images/fef31491e5e4bb0a670961cae120f06764b565a7f59f73a1afa008ce733d9b1c.png ../../_images/c6017d53e29a632d6736d4275318aea15af16229b57e23ce9a50e1598d481383.png ../../_images/a2e8dbd9627c8ad152995a482de1ae6da9bd6e39637409e61819eda31a92ff6f.png ../../_images/bf3eac2856d354775dc29280f3fded0ac322866a11104cd04f1de6440d1c33ea.png ../../_images/4fde64ce60cba04e64ed0624d380a41e75a17fd6d152a9853b1c9fd671ed0548.png ../../_images/3d45c053691e15bc5e843176d83e4bf31899d3bde384b30015056010d9c8a1ef.png ../../_images/fbd82a2dcbedd0d9edde556faedc05bcb56ee2ff374f9cff0ca545332926fd4e.png ../../_images/700cbc6d2447447614d853e8224161fbdfcdbc2d77dabbafcb89abb489397411.png ../../_images/8f1e9e12e2d3c77a928987a7bab33aabfe7c06a1254c57d86128ac97346bd490.png ../../_images/85eaf1ba2c522667c6aafa50b020fd9b06fe62bedcace61bf76751928b3b1d40.png ../../_images/5929bfac3aaf55aa81d986ce29590f9bec7b1ccd7cc1b1f2ea6f1f328cadb27c.png ../../_images/08e5d3ef6acd08a35ca604254a1412356ae92be361b87751b30deb7b88e6343b.png ../../_images/d6bc94c2a0e9a434f57842aeee0aa6c8be5374936940de5106f8d0b8ebd16c19.png ../../_images/f24b409cd2360740f59111d64f3d1a3d27c44622e8ddce6fac09989d634c74c8.png