for url in dap_urls: if "hfrnet" in url: print "Skipping HF Radar Obs Data" continue if "NECOFS" in url: try: print "Attemping to load {0}".format(url) u = iris.load_cube(url, u_constraint) v = iris.load_cube(url, v_constraint) # take first 20 chars for model name mod_name = u.attributes["title"][0:20] r = u.shape timevar = find_timevar(u) lat = u.coord(axis="Y").points lon = u.coord(axis="X").points jd = timevar.units.num2date(timevar.points) start = timevar.units.date2num(jd_start) istart = timevar.nearest_neighbour_index(start) stop = timevar.units.date2num(jd_stop) istop = timevar.nearest_neighbour_index(stop) # Only proceed if we have data in the range requested. if istart != istop: nsta = len(stations) if len(r) == 4: # HYCOM and ROMS # Dimensions are time, elevation, lat, lon d = u[0, 0:1, :, :].data
# <codecell> min_var = 0.01 # <codecell> for url in dap_urls: try: a = iris.load_cube(url, constraint) # convert to units of meters # a.convert_units('m') # this isn't working for unstructured data # take first 20 chars for model name mod_name = a.attributes['title'][0:20] r = a.shape timevar = find_timevar(a) lat = a.coord(axis='Y').points lon = a.coord(axis='X').points jd = timevar.units.num2date(timevar.points) start = timevar.units.date2num(jd_start) istart = timevar.nearest_neighbour_index(start) stop = timevar.units.date2num(jd_stop) istop = timevar.nearest_neighbour_index(stop) # Only proceed if we have data in the range requested. if istart != istop: nsta = len(obs_lon) if len(r) == 3: print('[Structured grid model]:', url) d = a[0, :, :].data # Find the closest non-land point from a structured grid model.
# Use only data within 0.04 degrees (about 4 km). max_dist = 0.04 # Use only data where the standard deviation of the time series exceeds 0.01 m (1 cm). # This eliminates flat line model time series that come from land points that should have had missing values. min_var = 0.01 for url in dap_urls: try: print 'Attemping to load {0}'.format(url) a = iris.load_cube(url, constraint) # convert to units of meters # a.convert_units('m') # this isn't working for unstructured data # take first 20 chars for model name mod_name = a.attributes['title'][0:20] r = a.shape timevar = find_timevar(a) lat = a.coord(axis='Y').points lon = a.coord(axis='X').points jd = timevar.units.num2date(timevar.points) start = timevar.units.date2num(jd_start) istart = timevar.nearest_neighbour_index(start) stop = timevar.units.date2num(jd_stop) istop = timevar.nearest_neighbour_index(stop) # Only proceed if we have data in the range requested. if istart != istop: nsta = len(station_list) if len(r) == 3: print('[Structured grid model]:', url) d = a[0, :, :].data # Find the closest non-land point from a structured grid model.
# Use only data where the standard deviation of the time series exceeds 0.01 m (1 cm). # This eliminates flat line model time series that come from land points that should have had missing values. min_var = 0.01 # print dap_urls for url in dap_urls: # model_df, model_lat, model_lon = get_model_data(url, model_df, max_dist, min_var) try: print 'Attemping to load {0}'.format(url) u = iris.load_cube(url, u_constraint) v = iris.load_cube(url, v_constraint) # take first 20 chars for model name mod_name = u.attributes['title'][0:30] r = u.shape timevar = find_timevar(u) lat = u.coord(axis='Y').points lon = u.coord(axis='X').points # Convert longitude to [-180 180] if max(lon) > 180: lon[lon > 180] = lon[lon > 180] - 360 jd = timevar.units.num2date(timevar.points) start = timevar.units.date2num(jd_start) istart = timevar.nearest_neighbour_index(start) stop = timevar.units.date2num(jd_stop) istop = timevar.nearest_neighbour_index(stop) # Only proceed if we have data in the range requested. if istart != istop: nsta = len(stations)
max_dist = 0.4 # Use only data where the standard deviation of the time series exceeds 0.01 m (1 cm). # This eliminates flat line model time series that come from land points that should have had missing values. min_var = 0.01 #Try the WaveWatchIII global model url = 'http://oos.soest.hawaii.edu/thredds/dodsC/hioos/model/wav/ww3/WaveWatch_III_Global_Wave_Model_best.ncd' try: print 'Attemping to load {0}'.format(url) cube = iris.load_cube(url, constraint) # take first 20 chars for model name mod_name = cube.attributes['title'][0:30] r = cube.shape timevar = find_timevar(cube) lat = cube.coord(axis='Y').points lon = cube.coord(axis='X').points # Convert longitude to [-180 180] if max(lon) > 180: lon[lon > 180] = lon[lon > 180] - 360 jd = timevar.units.num2date(timevar.points) start = timevar.units.date2num(jd_start) istart = timevar.nearest_neighbour_index(start) stop = timevar.units.date2num(jd_stop) istop = timevar.nearest_neighbour_index(stop) # Only proceed if we have data in the range requested. if istart != istop: # Wave Watch III uses a 4D grid (time, z, lat, lon) d = cube[0, 0, :, :].data
max_dist = 0.4 # Use only data where the standard deviation of the time series exceeds 0.01 m (1 cm). # This eliminates flat line model time series that come from land points that should have had missing values. min_var = 0.01 #Try the WaveWatchIII global model url = 'http://oos.soest.hawaii.edu/thredds/dodsC/hioos/model/wav/ww3/WaveWatch_III_Global_Wave_Model_best.ncd' try: print 'Attemping to load {0}'.format(url) cube = iris.load_cube(url, constraint) # take first 20 chars for model name mod_name = cube.attributes['title'][0:30] r = cube.shape timevar = find_timevar(cube) lat = cube.coord(axis='Y').points lon = cube.coord(axis='X').points # Convert longitude to [-180 180] if max(lon) > 180: lon[lon>180] = lon[lon>180]-360 jd = timevar.units.num2date(timevar.points) start = timevar.units.date2num(jd_start) istart = timevar.nearest_neighbour_index(start) stop = timevar.units.date2num(jd_stop) istop = timevar.nearest_neighbour_index(stop) # Only proceed if we have data in the range requested. if istart != istop: # Wave Watch III uses a 4D grid (time, z, lat, lon) d = cube[0, 0, :, :].data