#!/usr/bin/env python # coding: utf-8 # ## Fetch the data using Python's `urllib` package # This will download the data to your local drive if it doesn't exist already. # In[1]: #Import the packages needed to fetch the data import os, urllib # In[2]: #Set the URL pointing to the data url='http://thredds.northwestknowledge.net:8080/thredds/fileServer/' + \ 'NWCSC_INTEGRATED_SCENARIOS_ALL_CLIMATE/macav2livneh/bcc-csm1-1/' + \ 'macav2livneh_pr_bcc-csm1-1_r1i1p1_historical_1990_2005_CONUS_monthly.nc' # In[3]: #Get the filename from the url fileName = url.split("/")[-1] print(fileName) # In[6]: #Fetch the data and store as the local file if not os.path.exists(fileName): print("Fetching the dataset") urllib.request.urlretrieve (url, fileName); print("Done!") else: print("Data already downloaded")