# class instantiation creates a netCDF Dataset object as an attribute nwgofs = tri_grid.ugrid(data_url) # get longitude, latitude, and time variables print 'Downloading data dimensions' nwgofs.get_dimensions(var_map) #display available time range for model output nctools.show_tbounds(nwgofs.Dataset.variables['time']) # get grid topo variables (nbe, nv) print 'Downloading grid topo variables' nwgofs.get_grid_topo(var_map) # GNOME needs to know whether the elements are ordered clockwise (FVCOM) or counter-clockwise (SELFE) nwgofs.atts['nbe']['order'] = 'cw' # find and order the boundary print 'Finding boundary' bnd = nwgofs.find_bndry_segs() print 'Ordering boundary' seg_types = noaa_coops.specify_bnd_types('nwgofs',bnd) nwgofs.order_boundary(bnd,seg_types) # get the data print 'Downloading data' #nwgofs.get_data(var_map,tindex=[0,1,1]) #First time step only nwgofs.get_data(var_map) #All time steps in file print 'Writing to GNOME file' nwgofs.write_unstruc_grid(os.path.join(data_files_dir, 'nwgofs_example.nc'))
print 'Downloading data dimensions' creofs.get_dimensions(var_map) #display available time range for model output nctools.show_tbounds(creofs.Dataset.variables['time']) # get grid topo variables (nbe, nv) print 'Downloading grid topo variables' creofs.get_grid_topo(var_map) creofs.atts['nbe']['order'] = 'ccw' creofs.find_nodes_eles_in_ss(nl,sl,wl,el) # find and order the boundary print 'Finding boundary' bnd = creofs.find_bndry_segs(subset=True) #In order to correctly specify land/ow segments requires comparison with full domain boundary #Create this by downloading entire domain grid info then saving it (write_bndry_file) bry_file = 'C:\\Users\\amy.macfadyen\\Documents\\Projects\\goods\\trunk\\static\\ocean_models\\COOPS\\creofs.bry' land_nodes = creofs.find_subset_land_nodes(bry_file) seg_types = noaa_coops.specify_bnd_types('creofs',bnd,ss_land_nodes=land_nodes) print 'Ordering boundary' creofs.order_boundary(bnd,seg_types) # get the data print 'Downloading data' #creofs.get_data(var_map,tindex=[0,1,1]) #First time step only creofs.get_data(var_map,zindex=-1,nindex=creofs.nodes_in_ss) #All time steps in file print 'Writing to GNOME file' creofs.write_unstruc_grid(os.path.join(data_files_dir, 'creofs_example.nc'))
# # get longitude, latitude, and time variables # print 'Downloading data dimensions' # ngofs.get_dimensions(var_map) # get grid topo variables (nbe, nv) print 'Downloading grid topo variables' ngofs.get_grid_topo(var_map) # GNOME needs to know whether the elements are ordered clockwise (FVCOM) or counter-clockwise (SELFE) ngofs.atts['nbe']['order'] = 'cw' # find and order the boundary print 'Finding boundary' bnd = ngofs.find_bndry_segs() print 'Ordering boundary' seg_types = noaa_coops.specify_bnd_types('ngofs',bnd) ngofs.order_boundary(bnd,seg_types) else: ngofs.update(f) print 'Downloading data dimensions' ngofs.get_dimensions(var_map) #get the data print 'Downloading data' #ngofs.get_data(var_map,tindex=[0,1,1]) #First time step only ngofs.get_data(var_map) #All time steps in file of_dt = nctools.round_time(num2date(ngofs.data['time'][0],ngofs.atts['time']['units']),roundto=3600)