In [1]:
%matplotlib inline
from pyseidon import FVCOM
In [2]:
fvcomOD=FVCOM('http://ecoii.acadiau.ca/thredds/dodsC/ecoii/test/FVCOM3D_dngrid_BF_20130619_20130621.nc')
Retrieving data through OpenDap server...
Initialisation...
In [13]:
from pydap.client import open_url
url='http://www.smast.umassd.edu:8080/thredds/dodsC/fvcom/mwra/fvcom'
nc = open_url(url)
In [17]:
import pyugrid
try:
ug = pyugrid.UGrid.from_ncfile(url)
lon = ug.nodes[:,0]
lat = ug.nodes[:,1]
nv = ug.faces
except:
pass
In [20]:
ug.nodes
Out[20]:
array([[-70.56564331, 43.30540466],
[-70.54650116, 43.30025101],
[-70.52427673, 43.2926712 ],
...,
[-71.10289764, 42.40766907],
[-71.10121155, 42.41378403],
[-71.10549164, 42.41140747]])
In [ ]:
ug.nodes
In [4]:
fvcomWQ=FVCOM(url)
---------------------------------------------------------------------------
PyseidonError Traceback (most recent call last)
<ipython-input-4-4ece61990481> in <module>()
----> 1 fvcomWQ=FVCOM(url)
/home/usgs/miniconda/envs/ioos/lib/python2.7/site-packages/pyseidon/fvcomClass/fvcomClass.pyc in __init__(self, filename, ax, tx, debug)
159 raise PyseidonError("---Functionality not yet implemented---")
160 else:
--> 161 raise PyseidonError("---Wrong file format---")
162
163 self.Plots = PlotsFvcom(self.Variables,
PyseidonError: ---Wrong file format---
In [6]:
import netCDF4
nc = netCDF4.Dataset(url)
nc.variables
Out[6]:
OrderedDict([(u'nprocs', <type 'netCDF4._netCDF4.Variable'>
int32 nprocs(scalar)
long_name: number of processors
unlimited dimensions:
current shape = (1,)
filling off), (u'partition', <type 'netCDF4._netCDF4.Variable'>
int32 partition(nele)
long_name: partition
grid: TWOD_MESH
unlimited dimensions:
current shape = (9739,)
filling off), (u'Initial_Density',
<type 'netCDF4._netCDF4.Variable'>
float32 Initial_Density(siglay, node)
long_name: Initial Density
grid: SigmaLayer_Mesh
unlimited dimensions:
current shape = (30, 5472)
filling off), (u'x', <type 'netCDF4._netCDF4.Variable'>
float32 x(node)
long_name: nodal x-coordinate
units: meters
grid: TWOD_MESH
unlimited dimensions:
current shape = (5472,)
filling off), (u'y', <type 'netCDF4._netCDF4.Variable'>
float32 y(node)
long_name: nodal y-coordinate
units: meters
grid: TWOD_MESH
unlimited dimensions:
current shape = (5472,)
filling off), (u'lon', <type 'netCDF4._netCDF4.Variable'>
float32 lon(node)
long_name: Longitude
standard_name: longitude
units: degrees_east
grid: Bathymetry_Mesh
unlimited dimensions:
current shape = (5472,)
filling off), (u'lat', <type 'netCDF4._netCDF4.Variable'>
float32 lat(node)
long_name: Latitude
standard_name: latitude
units: degrees_north
grid: Bathymetry_Mesh
unlimited dimensions:
current shape = (5472,)
filling off), (u'siglay', <type 'netCDF4._netCDF4.Variable'>
float32 siglay(siglay, node)
long_name: Sigma Layers
standard_name: ocean_sigma_coordinate
positive: up
formula_terms: sigma: siglay eta: zeta depth: h
unlimited dimensions:
current shape = (30, 5472)
filling off), (u'siglay_shift',
<type 'netCDF4._netCDF4.Variable'>
float32 siglay_shift(siglay, node)
long_name: Shifted Sigma Layers
unlimited dimensions:
current shape = (30, 5472)
filling off), (u'siglev', <type 'netCDF4._netCDF4.Variable'>
float32 siglev(siglev, node)
long_name: Sigma Levels
standard_name: ocean_sigma_coordinate
positive: up
formula_terms: siglev:siglev eta:zeta depth:depth
unlimited dimensions:
current shape = (31, 5472)
filling off), (u'h', <type 'netCDF4._netCDF4.Variable'>
float32 h(node)
long_name: Bathymetry
units: m
standard_name: sea_floor_depth_below_geoid
grid: fvcom_grid
coordinates: lat lon
mesh: fvcom_mesh
location: node
unlimited dimensions:
current shape = (5472,)
filling off), (u'nv', <type 'netCDF4._netCDF4.Variable'>
int32 nv(three, nele)
long_name: nodes surrounding element
cf_role: face_node_connnectivity
start_index: 1
unlimited dimensions:
current shape = (3, 9739)
filling off), (u'a1u', <type 'netCDF4._netCDF4.Variable'>
float32 a1u(four, nele)
long_name: a1u
unlimited dimensions:
current shape = (4, 9739)
filling off), (u'a2u', <type 'netCDF4._netCDF4.Variable'>
float32 a2u(four, nele)
long_name: a2u
unlimited dimensions:
current shape = (4, 9739)
filling off), (u'aw0', <type 'netCDF4._netCDF4.Variable'>
float32 aw0(three, nele)
long_name: aw0
unlimited dimensions:
current shape = (3, 9739)
filling off), (u'awx', <type 'netCDF4._netCDF4.Variable'>
float32 awx(three, nele)
long_name: awx
unlimited dimensions:
current shape = (3, 9739)
filling off), (u'awy', <type 'netCDF4._netCDF4.Variable'>
float32 awy(three, nele)
long_name: awy
unlimited dimensions:
current shape = (3, 9739)
filling off), (u'latc', <type 'netCDF4._netCDF4.Variable'>
float32 latc(nele)
long_name: zonal latitude
standard_name: latitude
units: degrees_north
unlimited dimensions:
current shape = (9739,)
filling off), (u'lonc', <type 'netCDF4._netCDF4.Variable'>
float32 lonc(nele)
long_name: zonal longitude
standard_name: longitude
units: degrees_east
unlimited dimensions:
current shape = (9739,)
filling off), (u'time', <type 'netCDF4._netCDF4.Variable'>
float32 time(time)
long_name: Time
units: hours since 1995-01-01 00:00
calendar: gregorian
standard_name: time
unlimited dimensions:
current shape = (131611,)
filling off), (u'iint', <type 'netCDF4._netCDF4.Variable'>
int32 iint(time)
long_name: internal mode iteration number
unlimited dimensions:
current shape = (131611,)
filling off), (u'u', <type 'netCDF4._netCDF4.Variable'>
float32 u(time, siglay, nele)
long_name: Eastward Water Velocity
units: meters s-1
grid: fvcom_grid
type: data
missing_value: -999.0
field: ua, scalar
coverage_content_type: modelResult
standard_name: eastward_sea_water_velocity
coordinates: time siglay latc lonc
mesh: fvcom_mesh
location: face
unlimited dimensions:
current shape = (131611, 30, 9739)
filling off), (u'v', <type 'netCDF4._netCDF4.Variable'>
float32 v(time, siglay, nele)
long_name: Northward Water Velocity
units: meters s-1
grid: fvcom_grid
type: data
missing_value: -999.0
field: va, scalar
coverage_content_type: modelResult
standard_name: northward_sea_water_velocity
coordinates: time siglay latc lonc
mesh: fvcom_mesh
location: face
unlimited dimensions:
current shape = (131611, 30, 9739)
filling off), (u'kh', <type 'netCDF4._netCDF4.Variable'>
float32 kh(time, siglev, node)
long_name: Turbulent Eddy Diffusivity
units: meters2 s-1
grid: fvcom_grid
type: data
unlimited dimensions:
current shape = (131611, 31, 5472)
filling off), (u'temp', <type 'netCDF4._netCDF4.Variable'>
float32 temp(time, siglay, node)
long_name: temperature
standard_name: sea_water_potential_temperature
units: degrees_C
grid: fvcom_grid
type: data
coordinates: time siglay lat lon
coverage_content_type: modelResult
mesh: fvcom_mesh
location: node
unlimited dimensions:
current shape = (131611, 30, 5472)
filling off), (u'salinity', <type 'netCDF4._netCDF4.Variable'>
float32 salinity(time, siglay, node)
long_name: salinity
standard_name: sea_water_salinity
units: 1
grid: fvcom_grid
type: data
coordinates: time siglay lat lon
coverage_content_type: modelResult
mesh: fvcom_mesh
location: node
unlimited dimensions:
current shape = (131611, 30, 5472)
filling off), (u'zeta', <type 'netCDF4._netCDF4.Variable'>
float32 zeta(time, node)
long_name: Water Surface Elevation
units: meters
standard_name: sea_surface_height_above_geoid
type: data
coordinates: time lat lon
missing_value: -999.0
field: elev, scalar
coverage_content_type: modelResult
mesh: fvcom_mesh
location: node
unlimited dimensions:
current shape = (131611, 5472)
filling off), (u'ua', <type 'netCDF4._netCDF4.Variable'>
float32 ua(time, nele)
long_name: Vertically Averaged x-velocity
units: meters s-1
type: data
missing_value: -999.0
field: ua, scalar
coverage_content_type: modelResult
standard_name: barotropic_eastward_sea_water_velocity
coordinates: time latc lonc
mesh: fvcom_mesh
location: face
unlimited dimensions:
current shape = (131611, 9739)
filling off), (u'va', <type 'netCDF4._netCDF4.Variable'>
float32 va(time, nele)
long_name: Vertically Averaged y-velocity
units: meters s-1
type: data
missing_value: -999.0
field: va, scalar
coverage_content_type: modelResult
standard_name: barotropic_northward_sea_water_velocity
coordinates: time latc lonc
mesh: fvcom_mesh
location: face
unlimited dimensions:
current shape = (131611, 9739)
filling off), (u'wts', <type 'netCDF4._netCDF4.Variable'>
float32 wts(time, siglev, node)
long_name: vertical omega velocity
units: UDUNITS compatible units
standard_name: CF-convention standard name
type: data
unlimited dimensions:
current shape = (131611, 31, 5472)
filling off), (u'ww', <type 'netCDF4._netCDF4.Variable'>
float32 ww(time, siglay, nele)
long_name: Upward Water Velocity
units: meters s-1
grid: fvcom_grid
type: data
coverage_content_type: modelResult
standard_name: upward_sea_water_velocity
coordinates: time siglay latc lonc
mesh: fvcom_mesh
location: face
unlimited dimensions:
current shape = (131611, 30, 9739)
filling off), (u'km', <type 'netCDF4._netCDF4.Variable'>
float32 km(time, siglev, node)
long_name: Turbulent Eddy Viscosity
units: meters2 s-1
grid: fvcom_grid
type: data
unlimited dimensions:
current shape = (131611, 31, 5472)
filling off), (u'uuwind', <type 'netCDF4._netCDF4.Variable'>
float32 uuwind(time, nele)
long_name: Eastward wind velocity
units: (m/s)
standard_name: wind velocity
type: data
unlimited dimensions:
current shape = (131611, 9739)
filling off), (u'vvwind', <type 'netCDF4._netCDF4.Variable'>
float32 vvwind(time, nele)
long_name: Northward wind velocity
units: (m/s)
standard_name: wind velocity
type: data
unlimited dimensions:
current shape = (131611, 9739)
filling off), (u'fvcom_mesh', <type 'netCDF4._netCDF4.Variable'>
int32 fvcom_mesh()
cf_role: mesh_topology
topology_dimension: 2
node_coordinates: lon lat
face_coordinates: lonc latc
face_node_connectivity: nv
unlimited dimensions:
current shape = ()
filling off)])
In [6]:
%time
ax=[-65.77, -65.75, 44.675, 44.685]
tx1=['2013-06-20 12:00:00', '2013-06-21 12:00:00']
tx2=['2013-06-21 12:00:00', '2013-06-21 18:00:00']
fvcomPartial1=FVCOM('http://ecoii.acadiau.ca/thredds/dodsC/ecoii/test/FVCOM3D_dngrid_BF_20130619_20130621.nc', ax=ax, tx=tx1)
CPU times: user 0 ns, sys: 0 ns, total: 0 ns
Wall time: 14.1 µs
Retrieving data through OpenDap server...
Initialisation...
Re-indexing may take some time...
-Now working in bounding box-
-Now working in time box-
In [ ]:
In [7]:
whos
Variable Type Data/Info
-----------------------------------------------------------------
FVCOM classobj pyseidon.fvcomClass.fvcomClass.FVCOM
ax list n=4
fvcomOD pyseidon.fvcomClass.fvcomClass.FVCOM <pyseidon.fvcomClass.fvco<...>stance at 0x7f299a752b90>
fvcomPartial1 pyseidon.fvcomClass.fvcomClass.FVCOM <pyseidon.fvcomClass.fvco<...>stance at 0x7f299a09ecb0>
tx1 list n=2
tx2 list n=2
In [8]:
import sys
In [12]:
%time
fvcomPartial1.Plots.colormap_var(fvcomPartial1.Grid.h, title='Bathymetry (m)', mesh=False)
/home/usgs/miniconda/envs/ioos/lib/python2.7/site-packages/matplotlib/collections.py:590: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
if self._edgecolors == str('face'):
/home/usgs/miniconda/envs/ioos/lib/python2.7/site-packages/matplotlib/text.py:52: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
if rotation in ('horizontal', None):
CPU times: user 0 ns, sys: 0 ns, total: 0 ns
Wall time: 12.9 µs
/home/usgs/miniconda/envs/ioos/lib/python2.7/site-packages/matplotlib/text.py:54: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal
elif rotation == 'vertical':
In [ ]:
Content source: rsignell-usgs/notebook
Similar notebooks: