This notebook documents the process of creating XML fragments
for nowcast system run results files
for inclusion in /results/erddap-datasets/datasets.xml
which is symlinked to /opt/tomcat/content/erddap/datasets.xml
on the skookum
ERDDAP server instance.
The contents are a combination of:
GenerateDatasetsXml.sh
and DasDds.sh
tools found in the
/opt/tomcat/webapps/erddap/WEB-INF/
directory
via the /results/erddap/flags/
directory
GenerateDatasetsXml.sh
into XML fragments that are ready for inclusion in /results/erddap-datasets/datasets.xml
from collections import OrderedDict
from copy import copy
from lxml import etree
NOTE
The next cell mounts the /results2
filesystem on skookum
locally.
It is intended for use if when this notebook is run on a laptop
or other non-Waterhole machine that has sshfs
installed
and a mount point for /results2
available in its root filesystem.
Don't execute the cell if that doesn't describe your situation.
!sshfs -o nonempty skookum:/results /results
The metadata
dictionary below contains information for dataset
attribute tags whose values need to be changed,
or that need to be added for all datasets.
The keys are the dataset attribute names.
The values are dicts containing a required text
item
and perhaps an optional after
item.
The value associated with the text
key is the text content
for the attribute tag.
When present,
the value associated with the after
key is the name
of the dataset attribute after which a new attribute tag
containing the text
value is to be inserted.
metadata = OrderedDict([
('infoUrl', {
'text':
'https://salishsea-meopar-docs.readthedocs.io/en/latest/results_server/index.html#salish-sea-model-results',
}),
('institution', {
'text': 'UBC EOAS',
}),
('institution_fullname', {
'text': 'Earth, Ocean & Atmospheric Sciences, University of British Columbia',
'after': 'institution',
}),
('license', {
'text': '''The SalishSeaCast MEOPAR NEMO model results are copyright
by the SalishSeaCast MEOPAR Project Contributors and The University of British Columbia.
They are licensed under the Apache License, Version 2.0. https://www.apache.org/licenses/LICENSE-2.0''',
}),
('project', {
'text':'Salish Sea MEOPAR NEMO Model',
'after': 'title',
}),
('creator_name', {
'text': 'Salish Sea MEOPAR Project Contributors',
'after': 'project',
}),
('creator_email', {
'text': 'sallen@eoas.ubc.ca',
'after': 'creator_name',
}),
('creator_url', {
'text': 'https://salishsea-meopar-docs.readthedocs.io/',
'after': 'creator_email',
}),
('acknowledgement', {
'text': 'MEOPAR, ONC, Compute Canada',
'after': 'creator_url',
}),
('drawLandMask', {
'text': 'over',
'after': 'acknowledgement',
}),
])
The datasets
dictionary below provides the content
for the dataset title
and summary
attributes.
The title
attribute content appears in the the datasets list table
(among other places).
It should be <
80 characters long,
and note that only the 1st 40 characters will appear in the table.
The summary
attribute content appears
(among other places)
when a user hovers the cursor over the ?
icon beside the title
content in the datasets list table.
The text that is inserted into the summary
attribute tag
by code later in this notebook is the
title
content followed by the summary
content,
separated by a blank line.
The keys of the datasets
dict are the datasetID
strings that
are used in many places by the ERDDAP server.
They are structured as follows:
ubc
to indicate that the dataset was produced at UBC
SS
to indicate that the dataset is a product of the Salish Sea NEMO model
a few letters to indicate the model runs that produce the dataset:
n
to indicate that the dataset is from a nowcast run,f
for rolling forecast composed of the more recent 5 days of nowcast run results and the most recent forecast or forecast2 run,g
for nowcast-green,a
for atmospheric forcing,a description of the dataset variables; e.g. PointAtkinsonSSH
or 3DuVelocity
the time interval of values in the dataset; e.g. 15m
, 1h
, 1d
the dataset version; e.g. V16-10
, or V1
Versioning was changed to a CalVer type scheme in Oct-2016.
Thereafter versions are of the form Vyy-mm
and indicate the year and month when the dataset entered production.
So:
ubcSSnPointAtkinsonSSH15mV1
is the version 1 dataset of 15 minute averaged sea surface height values at Point Atkinson from PointAtkinson.nc
output files
ubcSSn3DwVelocity1hV2
is the version 2 dataset of 1 hr averaged vertical (w) velocity values over the entire domain from SalishSea_1h_*_grid_W.nc
output files
ubcSSnSurfaceTracers1dV1
is the version 1 dataset of daily averaged surface tracer values over the entire domain from SalishSea_1d_*_grid_T.nc
output files
ubcSSnBathymetry2V16-07
is the version 16-07 dataset of longitude, latitude, and bathymetry of the Salish Sea NEMO model grid that came into use in Jul-2016.
The corresponding NEMO-generated mesh mask variables are in the ubcSSn2DMeshMaskDbo2V16-07
(y, x variables),
and the ubcSSn3DMeshMaskDbo2V16-07
(z, y, x variables) datasets.
The dataset version part of the datasetID
is used to indicate changes in the variables
contained in the dataset.
For example,
the transition from the ubcSSn3DwVelocity1hV1
to the ubcSSn3DwVelocity1hV2
dataset
occurred on 24-Jan-2016 when we started to output vertical eddy viscosity and diffusivity
values at the w
grid points.
All dataset ids end with their version identifier and their summary
ends with a notation about the variables
that they contain; e.g.
v1: wVelocity variable
When the a dataset version is incremented a line describing the change is added
to the end of its summary
; e.g.
v1: wVelocity variable
v2: Added eddy viscosity & diffusivity variables ve_eddy_visc & ve_eddy_diff
datasets = {
'ubcSSnBathymetry2V1' :{
'type': 'geolocation bathymetry',
'title': 'Salish Sea NEMO Model Grid, Geo-location and Bathymetry, v1',
'summary':'''Longitude, latitude, and bathymetry of the Salish Sea NEMO model grid.
The bathymetry values are those calculated by NEMO from the input bathymetry file.
NEMO modifies the input bathymetry to remove isolated holes, and too-small partial steps.
The model grid includes the Juan de Fuca Strait, the Strait of Georgia, Puget Sound,
and Johnstone Strait on the coasts of Washington State and British Columbia.
v1: longitude, latitude and bathymetry variables
''',
'fileNameRegex': '.*SalishSea2_NEMO_bathy\.nc$'
},
'ubcSSnBathymetry2V16-07' :{
'type': 'geolocation bathymetry',
'title': 'Salish Sea NEMO Model Grid, Geo-location and Bathymetry, v16-07',
'summary':'''Longitude, latitude, and bathymetry of the Salish Sea NEMO model grid.
The bathymetry values are those calculated by NEMO from the input bathymetry file.
NEMO modifies the input bathymetry to remove isolated holes, and too-small partial steps.
The model grid includes the Juan de Fuca Strait, the Strait of Georgia, Puget Sound,
and Johnstone Strait on the coasts of Washington State and British Columbia.
v1: longitude, latitude and bathymetry variables
v16-07: same variables,
bathymetry uniformly deepened by 1 grid level,
smoothed at Juan de Fuca & Johnstone Strait open boundaries,
Fraser River lengthened,
bathymetry deepened near mouth of Fraser River
''',
'fileNameRegex': '.*downbyone2_NEMO_bathy\.nc$'
},
'ubcSSnBathymetryV17-02' :{
'type': 'geolocation bathymetry',
'title': 'Salish Sea NEMO Model Grid, Geo-location and Bathymetry, v17-02',
'keywords': '''bathymetry, depth, nav_lat, nav_lon, ocean, oceans,
Oceans > Bathymetry/Seafloor Topography > Bathymetry,
Salish Sea, sea floor, sea_floor_depth, seafloor, topography''',
'summary':'''Longitude, latitude, and bathymetry of the Salish Sea NEMO model grid.
The bathymetry values are those calculated by NEMO from the input bathymetry file.
NEMO modifies the input bathymetry to remove isolated holes, and too-small partial steps;
See the ubcSSn2DMeshMaskV17-02 dataset for the complete details of the calculation grid.
The model grid includes the Juan de Fuca Strait, the Strait of Georgia, Puget Sound,
and Johnstone Strait on the coasts of Washington State and British Columbia.
v1: longitude, latitude and bathymetry variables
v16-07: same variables,
bathymetry uniformly deepened by 1 grid level,
smoothed at Juan de Fuca & Johnstone Strait open boundaries,
Fraser River lengthened,
bathymetry deepened near mouth of Fraser River
v17-02: same variables,
Bathymetry composed from 3 datasets:
* USGS Digital elevation model (DEM) of Cascadia, latitude 39N-53N, longitude 116W-133W, Open-File Report 99-369, https://pubs.er.usgs.gov/publication/ofr99369
* NOAA British Columbia, 3 arc-second MSL DEM, https://www.ngdc.noaa.gov/dem/squareCellGrid/download/4956
* CHS Multibeam data and all point cloud data for the Salish Sea.
Smoothed at Juan de Fuca & Johnstone Strait open boundaries.
Proxy channel for Fraser River upstream of confluence with the Pitt River.
Adjustments by Michael Dunphy to make increase resolution of Fraser River channels downstream of confluence with the Pitt River.
''',
'fileNameRegex': '.*bathymetry_201702\.nc$'
},
}
datasets.update({
'ubcSSn2DMeshMask2V1': {
'type': 'geolocation bathymetry',
'title': 'Salish Sea NEMO Model Grid, 2D Mesh Mask, v1',
'summary':'''NEMO grid variable value for the u-v plane of the
Salish Sea NEMO model Arakawa-C grid.
The values are those calculated by NEMO from the input coordinates and bathymetry files.
The variable names are those used by NEMO-3.4,
see the NEMO-3.4 book (http://www.nemo-ocean.eu/Media/Files/NEMO_book_V3_4.pdf) for details,
or the long_name attributes of the variables for succinct descriptions of the variables.
The model grid includes the Juan de Fuca Strait, the Strait of Georgia, Puget Sound,
and Johnstone Strait on the coasts of Washington State and British Columbia.
v1: e1t, e2t, e1u, e2u, e1v, e2v, e1f, e2f, glamt, gphit, glamu, gphiu, glamv, gphiv,
tmaskutil, umaskutil, vmaskutil, fmaskutil, ff, mbathy variables
''',
'fileNameRegex': '.*mesh_mask_SalishSea2\.nc$',
},
'ubcSSn2DMeshMask2V16-07': {
'type': 'geolocation bathymetry',
'title': 'Salish Sea NEMO Model Grid, 2D Mesh Mask, v16-07',
'summary':'''NEMO grid variable value for the u-v plane of the
Salish Sea NEMO model Arakawa-C grid.
The values are those calculated by NEMO from the input coordinates and bathymetry files.
The variable names are those used by NEMO-3.6,
see the NEMO-3.6 book (http://www.nemo-ocean.eu/Media/Files/NEMO_book_V3_6.pdf) for details,
or the long_name attributes of the variables for succinct descriptions of the variables.
The model grid includes the Juan de Fuca Strait, the Strait of Georgia, Puget Sound,
and Johnstone Strait on the coasts of Washington State and British Columbia.
v1: e1t, e2t, e1u, e2u, e1v, e2v, e1f, e2f, glamt, gphit, glamu, gphiu, glamv, gphiv,
tmaskutil, umaskutil, vmaskutil, fmaskutil, ff, mbathy variables
v16-07: e1t, e2t, e1u, e2u, e1v, e2v, e1f, e2f, glamt, gphit, glamu, gphiu, glamv, gphiv,
glamf, gphif, tmaskutil, umaskutil, vmaskutil, fmaskutil, ff, mbathy variables
''',
'fileNameRegex': '.*mesh_mask_downbyone2\.nc$',
},
'ubcSSn3DMeshMask2V1': {
'type': 'geolocation bathymetry',
'title': 'Salish Sea NEMO Model Grid, 3D Mesh Mask, v1',
'summary':'''NEMO grid variable value for the Salish Sea NEMO model Arakawa-C grid.
The values are those calculated by NEMO from the input coordinates and bathymetry files.
The variable names are those used by NEMO-3.4,
see the NEMO-3.4 book (http://www.nemo-ocean.eu/Media/Files/NEMO_book_V3_4.pdf) for details,
or the long_name attributes of the variables for succinct descriptions of the variables.
The model grid includes the Juan de Fuca Strait, the Strait of Georgia, Puget Sound,
and Johnstone Strait on the coasts of Washington State and British Columbia.
v1: e3t, e3u, e3v, e3w, gdept, gdepu, gdepv, gdepw, tmask, umask, vmask, fmask variables
''',
'fileNameRegex': '.*mesh_mask_SalishSea2\.nc$'
},
'ubcSSn3DMeshMask2V16-07': {
'type': 'geolocation bathymetry',
'title': 'Salish Sea NEMO Model Grid, 3D Mesh Mask, v16-07',
'summary':'''NEMO grid variable value for the Salish Sea NEMO model Arakawa-C grid.
The values are those calculated by NEMO from the input coordinates and bathymetry files.
The variable names are those used by NEMO-3.6,
see the NEMO-3.6 book (http://www.nemo-ocean.eu/Media/Files/NEMO_book_V3_6.pdf) for details,
or the long_name attributes of the variables for succinct descriptions of the variables.
The model grid includes the Juan de Fuca Strait, the Strait of Georgia, Puget Sound,
and Johnstone Strait on the coasts of Washington State and British Columbia.
v1: e3t_0, e3u_0, e3v_0, e3w_0, gdept_0, gdepu, gdepv, gdepw_0, tmask, umask, vmask, fmask variables
v16-07: e3t, e3u, e3v, e3w, gdept, gdepu, gdepv, gdepw, tmask, umask, vmask, fmask variables
''',
'fileNameRegex': '.*mesh_mask_downbyone2\.nc$'
},
})
datasets['ubcSSn2DMeshMaskV17-02'] = copy(datasets['ubcSSn2DMeshMask2V16-07'])
datasets['ubcSSn2DMeshMaskV17-02'].update({
'title': datasets['ubcSSn2DMeshMask2V16-07']['title'].replace(', v16-07', ', v17-02'),
'keywords': '''bathymetry, coordinates, depth, e1t, e1u, e1v, e1f, e2t, e2u, e2v, e2f, ff, f-grid, fmaskutil,
glamt, glamu, glamv, glamf, gphit, gphiu, gphiv, gphif, grid, grid parameters, mbathy, mesh mask, NEMO, ocean,
Salish Sea, sea, spacing, t-grid, tmaskutil, u-grid, umaskutil, v-grid, vmaskutil, vorticity-grid''',
'summary': datasets['ubcSSn2DMeshMask2V16-07']['summary'] +
'''v17-02: tmaskutil, umaskutil, vmaskutil, fmaskutil, glamt, glamu, glamv, glamf, gphit, gphiu, gphiv, gphif,
e1t, e1u, e1v, e1f, e2t, e2u, e2v, e2f, ff, mbathy variables''',
'fileNameRegex': '.*mesh_mask201702\.nc$',
})
datasets['ubcSSn3DMeshMaskV17-02'] = copy(datasets['ubcSSn3DMeshMask2V16-07'])
datasets['ubcSSn3DMeshMaskV17-02'].update({
'title': datasets['ubcSSn3DMeshMask2V16-07']['title'].replace(', v16-07', ', v17-02'),
'keywords': '''bathymetry, coordinates, depth, e3t_0, e3u_0, e3v_0, e3w_0, f-grid, fmask, gdept_0, gdepu, gdepv,
gdepw_0, grid, grid parameters, mesh mask, NEMO, ocean, Salish Sea, sea, spacing, t-grid, tmask, u-grid, umask,
v-grid, vmask, vorticity-grid, w-grid''',
'summary': datasets['ubcSSn3DMeshMask2V16-07']['summary'] +
'''v17-02: tmask, umask, vmask, fmask, e3t_0, e3u_0, e3v_0, e3w_0, gdept_0, gdepu, gdepv, gdepw_0 variables''',
'fileNameRegex': '.*mesh_mask201702\.nc$',
})
datasets.update({
'ubcSSaSurfaceAtmosphereFieldsV1': {
'type': 'surface fields',
'title': 'HRDPS, Salish Sea, Atmospheric Forcing Fields, Hourly, v1',
'summary': '''2d hourly atmospheric field values from the
Environment Canada HRDPS atmospheric forcing model that are used to force the Salish Sea NEMO model.
The model grid includes the Juan de Fuca Strait, the Strait of Georgia, Puget Sound,
and Johnstone Strait on the coasts of Washington State and British Columbia.
Geo-location data for the atmospheric forcing grid are available in the ubcSSaAtmosphereGridV1 dataset.
Atmospheric field values are interpolated on to the Salish Sea NEMO model grid on-the-fly by NEMO.
v1: atmospheric pressure, precipitation rate, 2m specific humidity, 2m air temperature,
short-wave radiation flux, long-wave radiation flux, 10m u wind component, 10m v wind component variables
''',
'fileNameRegex': '.*ops_y\d{4}m\d{2}d\d{2}\.nc$',
},
})
datasets.update({
'ubcSSn3DuVelocity1hV1': {
'type': '3d fields',
'title': 'Nowcast, Salish Sea, 3d u Velocity Field, Hourly, v1',
'summary': '''3d zonal (u) component velocity field values averaged over 1 hour intervals
from Salish Sea NEMO model nowcast runs. The values are calculated for the entire model grid
that includes the Juan de Fuca Strait, the Strait of Georgia, Puget Sound,
and Johnstone Strait on the coasts of Washington State and British Columbia.
The time values are the centre of the intervals over which the calculated model results are averaged.
Geo-location and depth data for the Salish Sea NEMO model grid are available in the ubcSSnBathymetry2V1 dataset.
v1: uVelocity variable
''',
'fileNameRegex': '.*SalishSea_1h_\d{8}_\d{8}_grid_U\.nc$',
},
'ubcSSn3DvVelocity1hV1': {
'type': '3d fields',
'title': 'Nowcast, Salish Sea, 3d v Velocity Field, Hourly, v1',
'summary': '''3d meridional (v) component velocity field values averaged over 1 hour intervals
from Salish Sea NEMO model nowcast runs. The values are calculated for the entire model grid
that includes the Juan de Fuca Strait, the Strait of Georgia, Puget Sound,
and Johnstone Strait on the coasts of Washington State and British Columbia.
The time values are the centre of the intervals over which the calculated model results are averaged.
Geo-location and depth data for the Salish Sea NEMO model grid are available in the ubcSSnBathymetry2V1 dataset.
v1: vVelocity variable
''',
'fileNameRegex': '.*SalishSea_1h_\d{8}_\d{8}_grid_V\.nc$',
},
'ubcSSn3DwVelocity1hV1': {
'type': '3d fields',
'title': 'Nowcast, Salish Sea, 3d w Velocity Field, Hourly, v1',
'summary': '''3d vertical (w) component velocity field values averaged over 1 hour intervals
from Salish Sea NEMO model nowcast runs. The values are calculated for the entire model grid
that includes the Juan de Fuca Strait, the Strait of Georgia, Puget Sound,
and Johnstone Strait on the coasts of Washington State and British Columbia.
The time values are the centre of the intervals over which the calculated model results are averaged.
Geo-location and depth data for the Salish Sea NEMO model grid are available in the ubcSSnBathymetry2V1 dataset.
v1: wVelocity variable
''',
'fileNameRegex': '.*SalishSea_1h_\d{8}_\d{8}_grid_W\.nc$',
},
})
datasets['ubcSSn3DwVelocity1hV2'] = datasets['ubcSSn3DwVelocity1hV1']
datasets['ubcSSn3DwVelocity1hV2'].update({
'title': datasets['ubcSSn3DwVelocity1hV1']['title'].replace(', v1', ', v2'),
'summary': datasets['ubcSSn3DwVelocity1hV1']['summary'] + '''
v2: Added eddy viscosity & diffusivity variables ve_eddy_visc & ve_eddy_diff''',
})
datasets['ubcSSn3DuVelocity1hV16-10'] = datasets['ubcSSn3DuVelocity1hV1']
datasets['ubcSSn3DuVelocity1hV16-10'].update({
'title': datasets['ubcSSn3DuVelocity1hV1']['title'].replace(', v1', ', v16-10'),
'summary': datasets['ubcSSn3DuVelocity1hV1']['summary']
.replace('ubcSSnBathymetry2V1', 'ubcSSnBathymetry2V1-07') + '''
v16-10: NEMO-3.6; ubcSSnBathymetry2V16-07 bathymetry; see infoUrl link for full details.'''
})
datasets['ubcSSg3DuGridFields1hV17-02'] = datasets['ubcSSn3DuVelocity1hV16-10']
datasets['ubcSSg3DuGridFields1hV17-02'].update({
'title': 'Green, Salish Sea, 3d u Grid Variable Fields, Hourly, v17-02',
'keywords': '''circulation, current, currents, depthu, u grid, ocean, oceans,
Oceans > Ocean Circulation > Ocean Currents,
sea, sea_water_x_velocity, seawater, time_counter, u velocity component, velocity along x-axis, vozocrtx''',
'summary': '''Variable values at the 3d zonal (u) component velocity grid points averaged over 1 hour intervals
from Salish Sea NEMO model runs with physics and biology. The values are calculated for the entire model grid
that includes the Juan de Fuca Strait, the Strait of Georgia, Puget Sound,
and Johnstone Strait on the coasts of Washington State and British Columbia.
The time values are the centre of the intervals over which the calculated model results are averaged.
Geo-location and depth data for the Salish Sea NEMO model grid are available in the ubcSSnBathymetryV17-02 dataset.
v1: uVelocity variable
v16-10: NEMO-3.6; ubcSSnBathymetry2V16-07 bathymetry; see infoUrl link for full details.
v17-02: NEMO-3.6; ubcSSnBathymetryV17-02 bathymetry; see infoUrl link for full details.
''',
})
datasets['ubcSSn3DvVelocity1hV16-10'] = datasets['ubcSSn3DvVelocity1hV1']
datasets['ubcSSn3DvVelocity1hV16-10'].update({
'title': datasets['ubcSSn3DvVelocity1hV1']['title'].replace(', v1', ', v16-10'),
'summary': datasets['ubcSSn3DvVelocity1hV1']['summary']
.replace('ubcSSnBathymetry2V1', 'ubcSSnBathymetry2V1-07') + '''
v16-10: NEMO-3.6; ubcSSnBathymetry2V16-07 bathymetry; see infoUrl link for full details.'''
})
datasets['ubcSSg3DvGridFields1hV17-02'] = datasets['ubcSSn3DvVelocity1hV16-10']
datasets['ubcSSg3DvGridFields1hV17-02'].update({
'title': 'Green, Salish Sea, 3d v Grid Variable Fields, Hourly, v17-02',
'keywords': '''circulation, current, currents, depthv, v grid, ocean, oceans,
Oceans > Ocean Circulation > Ocean Currents,
sea, sea_water_y_velocity, seawater, time_counter, v velocity component, velocity along y-axis, vomecrty''',
'summary': '''Variable values at the 3d meridional (v) component velocity grid points averaged over 1 hour intervals
from Salish Sea NEMO model runs with physics and biology. The values are calculated for the entire model grid
that includes the Juan de Fuca Strait, the Strait of Georgia, Puget Sound,
and Johnstone Strait on the coasts of Washington State and British Columbia.
The time values are the centre of the intervals over which the calculated model results are averaged.
Geo-location and depth data for the Salish Sea NEMO model grid are available in the ubcSSnBathymetryV17-02 dataset.
v1: vVelocity variable
v16-10: NEMO-3.6; ubcSSnBathymetry2V16-07 bathymetry; see infoUrl link for full details.
v17-02: NEMO-3.6; ubcSSnBathymetryV17-02 bathymetry; see infoUrl link for full details.
''',
})
datasets['ubcSSn3DwVelocity1hV16-10'] = datasets['ubcSSn3DwVelocity1hV2']
datasets['ubcSSn3DwVelocity1hV16-10'].update({
'title': datasets['ubcSSn3DwVelocity1hV2']['title'].replace(', v2', ', v16-10'),
'summary': datasets['ubcSSn3DwVelocity1hV2']['summary']
.replace('ubcSSnBathymetry2V1', 'ubcSSnBathymetry2V1-07') + '''
v16-10: NEMO-3.6; ubcSSnBathymetry2V16-07 bathymetry; see infoUrl link for full details.
Renamed eddy viscosity & diffusivity variables to vert_eddy_visc & vert_eddy_diff
Added turbulent kinetic energy dissipation rate variable.'''
})
datasets['ubcSSg3DwGridFields1hV17-02'] = datasets['ubcSSn3DwVelocity1hV16-10']
datasets['ubcSSg3DwGridFields1hV17-02'].update({
'title': 'Green, Salish Sea, 3d w Grid Variable Fields, Hourly, v17-02',
'keywords': '''circulation, currents, depthw, vertical eddy diffusivity, downwelling, w grid, ocean, oceans,
Oceans > Ocean Circulation > Diffusion,
Oceans > Ocean Circulation > Ocean Currents,
Oceans > Ocean Circulation > Upwelling/Downwelling,
sea, seawater, time_counter, turbulent kinetic energy dissipation rate, upward, upward_sea_water_velocity, upwelling,
w velocity component, velocity along z-axis, vert_eddy_diff, vert_eddy_visc, vertical eddy viscosity,
vovecrtz''',
'summary': '''Variable values at the 3d vertical (w) component velocity grid points averaged over 1 hour intervals
from Salish Sea NEMO model runs with physics and biology. The values are calculated for the entire model grid
that includes the Juan de Fuca Strait, the Strait of Georgia, Puget Sound,
and Johnstone Strait on the coasts of Washington State and British Columbia.
The time values are the centre of the intervals over which the calculated model results are averaged.
Geo-location and depth data for the Salish Sea NEMO model grid are available in the ubcSSnBathymetryV17-02 dataset.
v1: wVelocity variable
v16-10: NEMO-3.6; ubcSSnBathymetry2V16-07 bathymetry; see infoUrl link for full details.
Renamed eddy viscosity & diffusivity variables to vert_eddy_visc & vert_eddy_diff
Added turbulent kinetic energy dissipation rate variable.
v17-02: NEMO-3.6; ubcSSnBathymetryV17-02 bathymetry; see infoUrl link for full details.
''',
})
datasets.update({
'ubcSSnNearSurfaceUVelocity20mV17-02': {
'type': '3d fields',
'title': 'Nowcast, Salish Sea, 3d Near Surface u Velocity Field, 20min, v17-02',
'keywords': '''circulation, current, currents, depthu, u grid, ocean, oceans,
Oceans > Ocean Circulation > Ocean Currents,
sea, sea_water_x_velocity, seawater, time_counter, u velocity component, velocity along x-axis, vozocrtx''',
'summary': '''Variable values at the 3d zonal (u) component velocity grid points
of the surface-most 5 layers, averaged over 20 minute intervals from Salish Sea NEMO model physics-only runs.
The values are for a sub-domain of the calculated model grid. The sub-domain covers only
the Juan de Fuca Strait, and the Strait of Georgia on the coasts of Washington State and British Columbia.
The time values are the centre of the intervals over which the calculated model results are averaged.
Geo-location and depth data for the Salish Sea NEMO model grid are available in the ubcSSnBathymetryV17-02 dataset.
v17-02: uVelocity variable; NEMO-3.6; ubcSSnBathymetryV17-02 bathymetry; see infoUrl link for full details.
''',
'fileNameRegex': '.*Slab_U\.nc$',
},
})
datasets.update({
'ubcSSnNearSurfaceVVelocity20mV17-02': {
'type': '3d fields',
'title': 'Nowcast, Salish Sea, 3d Near Surface v Velocity Field, 20min, v17-02',
'keywords': '''circulation, current, currents, depthv, v grid, ocean, oceans,
Oceans > Ocean Circulation > Ocean Currents,
sea, sea_water_y_velocity, seawater, time_counter, v velocity component, velocity along y-axis, vomecrty''',
'summary': '''Variable values at the 3d meridional (v) component velocity grid points
of the surface-most 5 layers, averaged over 20 minute intervals from Salish Sea NEMO model physics-only runs.
The values are for a sub-domain of the calculated model grid. The sub-domain covers only
the Juan de Fuca Strait, and the Strait of Georgia on the coasts of Washington State and British Columbia.
The time values are the centre of the intervals over which the calculated model results are averaged.
Geo-location and depth data for the Salish Sea NEMO model grid are available in the ubcSSnBathymetryV17-02 dataset.
v17-02: vVelocity variable; NEMO-3.6; ubcSSnBathymetryV17-02 bathymetry; see infoUrl link for full details.
''',
'fileNameRegex': '.*Slab_V\.nc$',
},
})
datasets.update({
'ubcSSn3DTracerFields1hV1': {
'type': '3d fields',
'title': 'Nowcast, Salish Sea, 3d Tracer Fields, Hourly, v1',
'summary': '''3d salinity and water temperature field values averaged over 1 hour intervals
from Salish Sea NEMO model nowcast runs. The values are calculated for the entire model grid
that includes the Juan de Fuca Strait, the Strait of Georgia, Puget Sound,
and Johnstone Strait on the coasts of Washington State and British Columbia.
The time values are the centre of the intervals over which the calculated model results are averaged.
Geo-location and depth data for the Salish Sea NEMO model grid are available in the ubcSSnBathymetry2V1 dataset.
v1: salinity (practical) and temperature variables
''',
'fileNameRegex': '.*SalishSea_1h_\d{8}_\d{8}_grid_T\.nc$',
},
'ubcSSnSurfaceTracerFields1hV1': {
'type': 'surface fields',
'title': 'Nowcast, Salish Sea, Surface Tracer Fields, Hourly, v1',
'summary': '''2d sea surface height and rainfall rate field values averaged over 1 hour intervals
from Salish Sea NEMO model nowcast runs. The values are calculated for the surface of the model grid
that includes the Juan de Fuca Strait, the Strait of Georgia, Puget Sound,
and Johnstone Strait on the coasts of Washington State and British Columbia.
The time values are the centre of the intervals over which the calculated model results are averaged.
Geo-location and depth data for the Salish Sea NEMO model grid are available in the ubcSSnBathymetry2V1 dataset.
v1: sea surface height and rainfall rate variables
''',
'fileNameRegex': '.*SalishSea_1h_\d{8}_\d{8}_grid_T\.nc$',
},
})
datasets['ubcSSn3DTracerFields1hV16-10'] = datasets['ubcSSn3DTracerFields1hV1']
datasets['ubcSSn3DTracerFields1hV16-10'].update({
'title': datasets['ubcSSn3DTracerFields1hV1']['title'].replace(', v1', ', v16-10'),
'summary': datasets['ubcSSn3DTracerFields1hV1']['summary']
.replace('ubcSSnBathymetry2V1', 'ubcSSnBathymetry2V1-07') + '''
v16-10: NEMO-3.6; ubcSSnBathymetry2V16-07 bathymetry; see infoUrl link for full details.
Changed salinity variable to reference salinity.
Changed temperature variable to conservative temperature.
Added squared buoyancy frequency variable.''',
})
datasets['ubcSSg3DTracerFields1hV17-02'] = datasets['ubcSSn3DTracerFields1hV16-10']
datasets['ubcSSg3DTracerFields1hV17-02'].update({
'title': datasets['ubcSSn3DTracerFields1hV16-10']['title']
.replace('Nowcast, ', 'Green, ')
.replace(', v16-10', ', v17-02'),
'keywords': '''buoy_n2, density, deptht, squared buoyancy frequency, grid, ocean, oceans,
Oceans > Ocean Temperature > Conservative Temperature,
Oceans > Salinity/Density > Salinity,
reference salinity, sea water, sea_water_conservative_temperature, sea_water_reference_salinity, seawater,
conservative temperature, time_counter, vosaline, votemper, water''',
'summary': '''3d salinity, water temperature, and squared buoyancy frequency field values averaged over 1 hour intervals
from Salish Sea NEMO model runs with physics and biology. The values are calculated for the entire model grid
that includes the Juan de Fuca Strait, the Strait of Georgia, Puget Sound,
and Johnstone Strait on the coasts of Washington State and British Columbia.
The time values are the centre of the intervals over which the calculated model results are averaged.
Geo-location and depth data for the Salish Sea NEMO model grid are available in the ubcSSnBathymetry2V17-02 dataset.
v1: salinity (practical) and temperature variables
v16-10: NEMO-3.6; ubcSSnBathymetry2V16-07 bathymetry; see infoUrl link for full details.
Changed salinity variable to reference salinity.
Changed temperature variable to conservative temperature.
Added squared buoyancy frequency variable.
v17-02: NEMO-3.6; ubcSSnBathymetryV17-02 bathymetry; see infoUrl link for full details.''',
})
datasets['ubcSSnSurfaceTracerFields1hV16-10'] = datasets['ubcSSnSurfaceTracerFields1hV1']
datasets['ubcSSnSurfaceTracerFields1hV16-10'].update({
'title': datasets['ubcSSnSurfaceTracerFields1hV1']['title'].replace(', v1', ', v16-10'),
'summary': datasets['ubcSSnSurfaceTracerFields1hV1']['summary']
.replace('ubcSSnBathymetry2V1', 'ubcSSnBathymetry2V1-07') + '''
v16-10: NEMO-3.6; ubcSSnBathymetry2V16-07 bathymetry; see infoUrl link for full details.
Deleted rainfall rate variable.''',
})
datasets['ubcSSgSurfaceTracerFields1hV17-02'] = datasets['ubcSSnSurfaceTracerFields1hV16-10']
datasets['ubcSSgSurfaceTracerFields1hV17-02'].update({
'title': datasets['ubcSSnSurfaceTracerFields1hV16-10']['title']
.replace('Nowcast, ', 'Green, ')
.replace(', v16-10', ', v17-02'),
'keywords': '''deptht, grid, ocean, oceans,
Oceans > Ocean Circulation > Ocean Mixed Layer,
Oceans > Sea Surface Topography > Sea Surface Height,
mixed_depth, mixed_layer_depth, ocean_mixed_layer_thickness_defined_by_sigma_theta,
mixed layer depth (dsigma = 0.01 wrt 10m),
sea surface height, sea_surface_height_above_geoid, sea water, seawater, ssh,
sossheig, time_counter, water''',
'summary': '''2d sea surface height and mixed layer depth field values averaged over 1 hour intervals
from Salish Sea NEMO model runs with physics and biology. The values are calculated for the surface of the model grid
that includes the Juan de Fuca Strait, the Strait of Georgia, Puget Sound,
and Johnstone Strait on the coasts of Washington State and British Columbia.
The time values are the centre of the intervals over which the calculated model results are averaged.
Geo-location and depth data for the Salish Sea NEMO model grid are available in the ubcSSnBathymetry2V17-02 dataset.
v1: sea surface height and rainfall rate variables
v16-10: NEMO-3.6; ubcSSnBathymetry2V16-07 bathymetry; see infoUrl link for full details.
Deleted rainfall rate variable.
v17-02: NEMO-3.6; ubcSSnBathymetryV17-02 bathymetry; see infoUrl link for full details.
Added mixed layer depth variable (dsigma = 0.01 wrt 10m)''',
})
datasets.update({
'ubcSSg3DBiologyFields1hV17-02': {
'type': '3d fields',
'title': 'Green, Salish Sea, 3d Biology Fields, Hourly, v17-02',
'keywords': '''ammonia, ammonium, aquatic, biogenic, biogenic_silicon, biological,
Biological Classification > Protists > Diatoms,
biosphere,
Biosphere > Aquatic Ecosystems > Plankton > Zooplankton,
chemistry, ciliates, concentration, deptht, detritus, diatoms, dissolved, dissolved_organic_nitrogen, ecosystems,
flagellates, Fraser_tracer, Fraser River, marine, mesodinium rubrum, mesozooplankton, microzooplankton,
mole_concentration_of_ammonium_in_sea_water, fraser_river_turbidity_tracer,
mole_concentration_of_diatoms_expressed_as_nitrogen_in_sea_water,
mole_concentration_of_flagellates_expressed_as_nitrogen_in_sea_water,
mole_concentration_of_mesodinium_rubrum_expressed_as_nitrogen_in_sea_water,
mole_concentration_of_mesozooplankton_expressed_as_nitrogen_in_sea_water,
mole_concentration_of_microzooplankton_expressed_as_nitrogen_in_sea_water,
mole_concentration_of_nitrate_in_sea_water, mole_concentration_of_organic_detritus_expressed_as_nitrogen_in_sea_water,
mole_concentration_of_organic_detritus_expressed_as_silicon_in_sea_water,
mole_concentration_of_particulate_organic_matter_expressed_as_nitrogen_in_sea_water,
mole_concentration_of_silicate_in_sea_water, n02, nh4, nitrate, nitrogen, no3, ocean, oceans,
Oceans > Marine Sediments > Sediment Chemistry,
Oceans > Marine Sediments > Sediment Composition,
Oceans > Marine Sediments > Suspended Solids,
Oceans > Ocean Chemistry > Ammonia,
Oceans > Ocean Chemistry > Nitrate,
Oceans > Ocean Chemistry > Nitrogen,
Oceans > Ocean Chemistry > Organic Matter,
Oceans > Ocean Chemistry > Silicate,
organic, particulate, particulate_organic_nitrogen, plankton, protists, river, sea, seawater, sediment, sediments,
silicate, silicon, solids, suspended, time_counter, tracer, turbidity, water, zooplankton
''',
'summary': '''3d SMELT biological model field values averaged over 1 hour intervals
from Salish Sea NEMO model runs with physics and biology. The values are calculated for the entire model grid
that includes the Juan de Fuca Strait, the Strait of Georgia, Puget Sound,
and Johnstone Strait on the coasts of Washington State and British Columbia.
The time values are the centre of the intervals over which the calculated model results are averaged.
Geo-location and depth data for the Salish Sea NEMO model grid are available in the ubcSSnBathymetry2V17-02 dataset.
v17-02: Micromolar concentrations of ammonium, biogenic silicon, ciliates (mesodinium rubrum),
diatoms, dissolved organic nitrogen, flagellates (nanophytoplankton), mesozooplankton, microzooplankton,
nitrate, particulate organic nitrogen, silicon.
NEMO-3.6; ubcSSnBathymetryV17-02 bathymetry; see infoUrl link for full details.
''',
'fileNameRegex': '.*SalishSea_1h_\d{8}_\d{8}_ptrc_T\.nc$',
}
})
datasets.update({
'ubcSSg3DAuxiliaryFields1hV19-05': {
'type': '3d fields',
'title': 'Green, Salish Sea, 3d Auxiliary Fields, Hourly, v19-05',
'keywords': '''auxilary, cell_thickness, density, deptht,
downwelling_photosynthetic_photon_radiance_in_sea_water, e3t,
Oceans > Ocean Chemistry > Inorganic Matter,
Oceans > Ocean Optics > Photosynthetically Active Radiation,
Oceans > Ocean Optics > Radiance,
Oceans > Salinity/Density > Density,
Oceans > Marine Sediments > Suspended Solids,
Fraser_tracer, Fraser River, fraser_river_turbidity_tracer, ocean, oceans, optics,
PAR, photon, photosynthetic, photosynthetically, radiance, radiation, river,
sea, sea_water_sigma_theta, seawater, sediment, sediments, sigma, sigma0, sigma_theta, solids, suspended,
t-cell, thickness, time_counter, tracer, turbidity, water
''',
'summary': '''3d auxiliary model field values averaged over 1 hour intervals
from SalishSeaCast NEMO model runs with physics, biology, and chemistry.
The values are calculated for the entire model grid that includes Juan de Fuca Strait,
he Strait of Georgia, Puget Sound, and Johnstone Strait on the coasts of
Washington State and British Columbia.
The time values are the centre of the intervals over which the calculated model results are averaged.
Geo-location and depth data for the Salish Sea NEMO model grid are available in the ubcSSnBathymetry2V17-02 dataset.
v19-05: Photosynthetically available radiation (PAR), Potential density anomaly (sigma_theta),
Time-varying z-layer thickness (NEMO e3t), Fraser River water turbidity.
NEMO-3.6; ubcSSnBathymetryV17-02 bathymetry; see infoUrl link for full details.
''',
'fileNameRegex': '.*SalishSea_1h_\d{8}_\d{8}_carp_T\.nc$',
}
})
ssh_keywords = '''10min, earth, geodetics, sea surface height above geoid, geoid, ocean, oceans,
Oceans > Sea Surface Topography > Sea Surface Height,
sea, sea_surface_height_above_geoid,
sossheig, ssh, surface, tides, time_counter, topography'''
datasets.update({
'ubcSSnPointAtkinsonSSH15mV1': {
'type': 'tide gauge',
'title': 'Nowcast, Point Atkinson, Sea Surface Height, 15min, v1',
'summary': '''Sea surface height values averaged over 15 minute intervals from
Salish Sea NEMO model nowcast runs. The values are calculated at the model grid point
closest to the Point Atkinson tide gauge station on the north side of English Bay,
near Vancouver, British Columbia.
The time values are the centre of the intervals over which the calculated model results are averaged.
Geo-location and depth data for the Salish Sea NEMO model grid are available in the ubcSSnBathymetry2V1 dataset.
v1: ssh variable''',
'fileNameRegex': '.*PointAtkinson\.nc$',
},
'ubcSSnBoundaryBaySSH15mV16-10': {
'type': 'tide gauge',
'title': 'Nowcast, Boundary Bay, Sea Surface Height, 15min, v16-10',
'summary': '''Sea surface height values averaged over 15 minute intervals from
Salish Sea NEMO model nowcast runs. The values are calculated at the model grid point
closest to the Point Atkinson tide gauge station on the north side of English Bay,
near Vancouver, British Columbia.
The time values are the centre of the intervals over which the calculated model results are averaged.
Geo-location and depth data for the Salish Sea NEMO model grid are available in the ubcSSnBathymetry2V16-07 dataset.
v1: ssh variable''',
'fileNameRegex': '.*BoundaryBay\.nc$',
},
'ubcSSnCampbellRiverSSH15mV1': {
'type': 'tide gauge',
'title': 'Nowcast, Campbell River, Sea Surface Height, 15min, v1',
'summary': '''Sea surface height values averaged over 15 minute intervals from
Salish Sea NEMO model nowcast runs. The values are calculated at the model grid point
closest to the Campbell River tide gauge station at the north end of the Strait of Georgia,
near Campbell River, British Columbia.
The time values are the centre of the intervals over which the calculated model results are averaged.
Geo-location and depth data for the Salish Sea NEMO model grid are available in the ubcSSnBathymetry2V1 dataset.
v1: ssh variable''',
'fileNameRegex': '.*CampbellRiver\.nc$',
},
'ubcSSnCherryPointSSH15mV1': {
'type': 'tide gauge',
'title': 'Nowcast, Cherry Point, WA, Sea Surface Height, 15min, v1',
'summary': '''Sea surface height values averaged over 15 minute intervals from
Salish Sea NEMO model nowcast runs. The values are calculated at the model grid point
closest to the Cherry Point, WA tide gauge station in the southern Strait of Georgia,
near Birch Bay, Washington.
The time values are the centre of the intervals over which the calculated model results are averaged.
Geo-location and depth data for the Salish Sea NEMO model grid are available in the ubcSSnBathymetry2V1 dataset.
v1: ssh variable''',
'fileNameRegex': '.*CherryPoint\.nc$',
},
'ubcSSnFridayHarborSSH15mV1': {
'type': 'tide gauge',
'title': 'Nowcast, Friday Harbor, WA, Sea Surface Height, 15min, v1',
'summary': '''Sea surface height values averaged over 15 minute intervals from
Salish Sea NEMO model nowcast runs. The values are calculated at the model grid point
closest to the Friday Harbor, WA tide gauge station at San Juan Island in Haro Strait,
near Friday Harbor, Washington.
The time values are the centre of the intervals over which the calculated model results are averaged.
Geo-location and depth data for the Salish Sea NEMO model grid are available in the ubcSSnBathymetry2V1 dataset.
v1: ssh variable''',
'fileNameRegex': '.*FridayHarbor\.nc$',
},
'ubcSSnNanaimoSSH15mV1': {
'type': 'tide gauge',
'title': 'Nowcast, Nanaimo, Sea Surface Height, 15min, v1',
'summary': '''Sea surface height values averaged over 15 minute intervals from
Salish Sea NEMO model nowcast runs. The values are calculated at the model grid point
closest to the Nanaimo tide gauge station on the west side of the central Strait of Georgia,
near Nanaimo, British Columbia.
The time values are the centre of the intervals over which the calculated model results are averaged.
Geo-location and depth data for the Salish Sea NEMO model grid are available in the ubcSSnBathymetry2V1 dataset.
v1: ssh variable''',
'fileNameRegex': '.*Nanaimo\.nc$',
},
'ubcSSnNeahBaySSH15mV1': {
'type': 'tide gauge',
'title': 'Nowcast, Neah Bay, WA, Sea Surface Height, 15min, v1',
'summary': '''Sea surface height values averaged over 15 minute intervals from
Salish Sea NEMO model nowcast runs. The values are calculated at the model grid point
closest to the Neah Bay, WA tide gauge station on the south side of the west end of the Juan de Fuca Strait,
near Neah Bay, Washington.
The time values are the centre of the intervals over which the calculated model results are averaged.
Geo-location and depth data for the Salish Sea NEMO model grid are available in the ubcSSnBathymetry2V1 dataset.
v1: ssh variable''',
'fileNameRegex': '.*NeahBay\.nc$',
},
'ubcSSnVictoriaSSH15mV1': {
'type': 'tide gauge',
'title': 'Nowcast, Victoria, Sea Surface Height, 15min, v1',
'summary': '''Sea surface height values averaged over 15 minute intervals from
Salish Sea NEMO model nowcast runs. The values are calculated at the model grid point
closest to the Victoria tide gauge station on the north side of the east end of the Juan de Fuca Strait,
in the Victoria Inner Harbour, near Victoria, British Columbia.
The time values are the centre of the intervals over which the calculated model results are averaged.
Geo-location and depth data for the Salish Sea NEMO model grid are available in the ubcSSnBathymetry2V1 dataset.
v1: ssh variable''',
'fileNameRegex': '.*Victoria\.nc$',
},
'ubcSSnSandHeadsSSH15mV1': {
'type': 'tide gauge',
'title': 'Nowcast, Sand Heads, Sea Surface Height, 15min, v1',
'summary': '''Sea surface height values averaged over 15 minute intervals from
Salish Sea NEMO model nowcast runs. The values are calculated at the model grid point
closest to the Sand Heads light station on the east side of the central Strait of Georgia,
near Steveston, British Columbia.
The time values are the centre of the intervals over which the calculated model results are averaged.
Geo-location and depth data for the Salish Sea NEMO model grid are available in the ubcSSnBathymetry2V1 dataset.
v1: ssh variable''',
'fileNameRegex': '.*Sandheads\.nc$',
},
})
datasets['ubcSSnPointAtkinsonSSH10mV16-10'] = copy(datasets['ubcSSnPointAtkinsonSSH15mV1'])
datasets['ubcSSnPointAtkinsonSSH10mV16-10'].update({
'title': datasets['ubcSSnPointAtkinsonSSH15mV1']['title']
.replace(', v1', ', v16-10')
.replace(', 15min,', ', 10min,'),
'summary': datasets['ubcSSnPointAtkinsonSSH15mV1']['summary']
.replace('ubcSSnBathymetry2V1', 'ubcSSnBathymetry2V16-07')
.replace(' 15 minute ', ' 10 minute ') + '''
v16-10: NEMO-3.6; ubcSSnBathymetry2V16-07 bathymetry; see infoUrl link for full details.'''
})
datasets['ubcSSgPointAtkinsonSSH10mV17-02'] = copy(datasets['ubcSSnPointAtkinsonSSH10mV16-10'])
datasets['ubcSSgPointAtkinsonSSH10mV17-02'].update({
'title': datasets['ubcSSnPointAtkinsonSSH10mV16-10']['title']
.replace('Nowcast,', 'Green,')
.replace(', v16-10', ', v17-02')
.replace(', 15min,', ', 10min,'),
'keywords': ssh_keywords,
'summary': datasets['ubcSSnPointAtkinsonSSH10mV16-10']['summary']
.replace('ubcSSnBathymetry2V16-10', 'ubcSSnBathymetryV17-02')
.replace('Salish Sea NEMO model nowcast runs.', 'Salish Sea NEMO model runs with physics and biology.') + '''
v17-02: NEMO-3.6; ubcSSnBathymetry2V17-02 bathymetry; see infoUrl link for full details.'''
})
datasets['ubcSSnCampbellRiverSSH10mV16-10'] = copy(datasets['ubcSSnCampbellRiverSSH15mV1'])
datasets['ubcSSnCampbellRiverSSH10mV16-10'].update({
'title': datasets['ubcSSnCampbellRiverSSH15mV1']['title']
.replace(', v1', ', v16-10')
.replace(', 15min,', ', 10min,'),
'summary': datasets['ubcSSnCampbellRiverSSH15mV1']['summary']
.replace('ubcSSnBathymetry2V1', 'ubcSSnBathymetry2V1-07')
.replace(' 15 minute ', ' 10 minute ') + '''
v16-10: NEMO-3.6; ubcSSnBathymetry2V16-07 bathymetry; see infoUrl link for full details.'''
})
datasets['ubcSSnCherryPointSSH10mV16-10'] = datasets['ubcSSnCherryPointSSH15mV1']
datasets['ubcSSnCherryPointSSH10mV16-10'].update({
'title': datasets['ubcSSnCherryPointSSH15mV1']['title']
.replace(', v1', ', v16-10')
.replace(', 15min,', ', 10min,'),
'summary': datasets['ubcSSnCherryPointSSH15mV1']['summary']
.replace('ubcSSnBathymetry2V1', 'ubcSSnBathymetry2V1-07')
.replace(' 15 minute ', ' 10 minute ') + '''
v16-10: NEMO-3.6; ubcSSnBathymetry2V16-07 bathymetry; see infoUrl link for full details.'''
})
datasets['ubcSSnFridayHarborSSH10mV16-10'] = datasets['ubcSSnFridayHarborSSH15mV1']
datasets['ubcSSnFridayHarborSSH10mV16-10'].update({
'title': datasets['ubcSSnFridayHarborSSH15mV1']['title']
.replace(', v1', ', v16-10')
.replace(', 15min,', ', 10min,'),
'summary': datasets['ubcSSnFridayHarborSSH15mV1']['summary']
.replace('ubcSSnBathymetry2V1', 'ubcSSnBathymetry2V1-07')
.replace(' 15 minute ', ' 10 minute ') + '''
v16-10: NEMO-3.6; ubcSSnBathymetry2V16-07 bathymetry; see infoUrl link for full details.'''
})
datasets['ubcSSnNanaimoSSH10mV16-10'] = datasets['ubcSSnNanaimoSSH15mV1']
datasets['ubcSSnNanaimoSSH10mV16-10'].update({
'title': datasets['ubcSSnNanaimoSSH15mV1']['title']
.replace(', v1', ', v16-10')
.replace(', 15min,', ', 10min,'),
'summary': datasets['ubcSSnNanaimoSSH15mV1']['summary']
.replace('ubcSSnBathymetry2V1', 'ubcSSnBathymetry2V1-07')
.replace(' 15 minute ', ' 10 minute ') + '''
v16-10: NEMO-3.6; ubcSSnBathymetry2V16-07 bathymetry; see infoUrl link for full details.'''
})
datasets['ubcSSnNeahBaySSH10mV16-10'] = datasets['ubcSSnNeahBaySSH15mV1']
datasets['ubcSSnNeahBaySSH10mV16-10'].update({
'title': datasets['ubcSSnNeahBaySSH15mV1']['title']
.replace(', v1', ', v16-10')
.replace(', 15min,', ', 10min,'),
'summary': datasets['ubcSSnNeahBaySSH15mV1']['summary']
.replace('ubcSSnBathymetry2V1', 'ubcSSnBathymetry2V1-07')
.replace(' 15 minute ', ' 10 minute ') + '''
v16-10: NEMO-3.6; ubcSSnBathymetry2V16-07 bathymetry; see infoUrl link for full details.'''
})
datasets['ubcSSnVictoriaSSH10mV16-10'] = datasets['ubcSSnVictoriaSSH15mV1']
datasets['ubcSSnVictoriaSSH10mV16-10'].update({
'title': datasets['ubcSSnVictoriaSSH15mV1']['title']
.replace(', v1', ', v16-10')
.replace(', 15min,', ', 10min,'),
'summary': datasets['ubcSSnVictoriaSSH15mV1']['summary']
.replace('ubcSSnBathymetry2V1', 'ubcSSnBathymetry2V1-07')
.replace(' 15 minute ', ' 10 minute ') + '''
v16-10: NEMO-3.6; ubcSSnBathymetry2V16-07 bathymetry; see infoUrl link for full details.'''
})
datasets['ubcSSnSandHeadsSSH10mV16-10'] = datasets['ubcSSnSandHeadsSSH15mV1']
datasets['ubcSSnSandHeadsSSH10mV16-10'].update({
'title': datasets['ubcSSnSandHeadsSSH15mV1']['title']
.replace(', v1', ', v16-10')
.replace(', 15min,', ', 10min,'),
'summary': datasets['ubcSSnSandHeadsSSH15mV1']['summary']
.replace('ubcSSnBathymetry2V1', 'ubcSSnBathymetry2V1-07')
.replace(' 15 minute ', ' 10 minute ') + '''
v16-10: NEMO-3.6; ubcSSnBathymetry2V16-07 bathymetry; see infoUrl link for full details.'''
})
datasets.update({
'ubcSSf3DuGridFields1hV17-02': {
'type': '3d fields',
'title': 'Forecast, Salish Sea, 3d u Grid Variable Fields, Hourly, v17-02',
'keywords': '''circulation, current, currents, depthu, u grid, ocean, oceans,
Oceans > Ocean Circulation > Ocean Currents,
sea, sea_water_x_velocity, seawater, time_counter, u velocity component, velocity along x-axis, vozocrtx''',
'summary': '''3d zonal (u) component velocity field values averaged over 1 hour intervals
from the most recent Salish Sea NEMO model forecast run. The values are calculated for the entire model grid
that includes the Juan de Fuca Strait, the Strait of Georgia, Puget Sound,
and Johnstone Strait on the coasts of Washington State and British Columbia.
The time values are UTC. They are the centre of the intervals over which the calculated model results are averaged.
Geo-location and depth data for the Salish Sea NEMO model grid are available in the ubcSSnBathymetry2V17-02 dataset.
This dataset is updated daily to move it forward 1 day in time.
It starts at 00:30:00 UTC 5 days prior to the most recently completed forecast run,
and extends to 11:30:00 UTC on the 2nd day after the forecast run date.
So, for example, after completion of the 10-Nov-2017 forecast run,
this dataset included data from 2017-11-05 00:30:00 UTC to 2017-11-12 11:30:00 UTC.
v17-02: NEMO-3.6; ubcSSnBathymetryV17-02 bathymetry; see infoUrl link for full details: uVelocity variable
''',
'fileNameRegex': '.*SalishSea_1h_\d{8}_\d{8}_grid_U\.nc$',
},
'ubcSSf3DvGridFields1hV17-02': {
'type': '3d fields',
'title': 'Forecast, Salish Sea, 3d v Grid Variable Fields, Hourly, v17-02',
'keywords': '''circulation, current, currents, depthv, v grid, ocean, oceans,
Oceans > Ocean Circulation > Ocean Currents,
sea, sea_water_y_velocity, seawater, time_counter, v velocity component, velocity along y-axis, vomecrty''',
'summary': '''3d meridional (v) component velocity field values averaged over 1 hour intervals
from the most recent Salish Sea NEMO model forecast run. The values are calculated for the entire model grid
that includes the Juan de Fuca Strait, the Strait of Georgia, Puget Sound,
and Johnstone Strait on the coasts of Washington State and British Columbia.
The time values are UTC. They are the centre of the intervals over which the calculated model results are averaged.
Geo-location and depth data for the Salish Sea NEMO model grid are available in the ubcSSnBathymetry2V17-02 dataset.
This dataset is updated daily to move it forward 1 day in time.
It starts at 00:30:00 UTC 5 days prior to the most recently completed forecast run,
and extends to 11:30:00 UTC on the 2nd day after the forecast run date.
So, for example, after completion of the 10-Nov-2017 forecast run,
this dataset included data from 2017-11-05 00:30:00 UTC to 2017-11-12 11:30:00 UTC.
v17-02: NEMO-3.6; ubcSSnBathymetryV17-02 bathymetry; see infoUrl link for full details: vVelocity variable
''',
'fileNameRegex': '.*SalishSea_1h_\d{8}_\d{8}_grid_V\.nc$',
},
})
datasets.update({
'ubcSSg2DTracerFieldsSeasonalV17-02': {
'type': '2d fields',
'title': 'Green, Salish Sea, 2d Depth-averaged Tracer Fields, Seasonal, v17-02',
'keywords': '''grid, ocean, oceans,
Oceans > Ocean Temperature > Conservative Temperature,
Oceans > Salinity/Density > Salinity,
reference salinity, sea water, sea_water_conservative_temperature, sea_water_reference_salinity, seawater,
conservative temperature, time_counter, vosaline, votemper, water''',
'summary': '''2d depth-averaged salinity and water temperature field values
averaged over 3 month seasonal intervals from Salish Sea NEMO model nowcast runs.
The values are calculated for the entire model grid that includes the Juan de Fuca Strait,
the Strait of Georgia, Puget Sound,
and Johnstone Strait on the coasts of Washington State and British Columbia.
The time values are UTC. They are the centre of the intervals over which the calculated model results are averaged.
The variable values are averaged over the upper 22 layers of the model grid,
approximately 0 to 30 metres depth.
Geo-location and depth data for the Salish Sea NEMO model grid are available in the ubcSSnBathymetry2V17-02 dataset.
v17-02: NEMO-3.6; ubcSSnBathymetryV17-02 bathymetry; see infoUrl link for full details:
reference salinity and conservative temperature variables
''',
'fileNameRegex': '.*seasonal-30_\d{4}\.nc$',
},
})
The dataset_vars
dictionary below is used to rename
variables from the often cryptic NEMO names to the names
that appear in the ERDDAP generated files and web content.
The keys are the NEMO variable names to replace.
The values are dicts that map the variable names to use in ERDDAP
to the destinationName
attribute name.
dataset_vars = {
'Bathymetry': {'destinationName': 'bathymetry'},
'nav_lat': {'destinationName': 'latitude'},
'nav_lon': {'destinationName': 'longitude'},
'sossheig': {'destinationName': 'ssh'},
'vosaline': {'destinationName': 'salinity'},
'vosalineoverdepth': {'destinationName': 'salinity'},
'votemper': {'destinationName': 'temperature'},
'votemperoverdepth': {'destinationName': 'temperature'},
'vozocrtx': {'destinationName': 'uVelocity'},
'vomecrty': {'destinationName': 'vVelocity'},
'vovecrtz': {'destinationName': 'wVelocity'},
't': {'destinationName': 'time'},
'Fraser_tracer': {'destinationName': 'fraserTurbidity'}
}
The var_colour_ranges
dictionary below is used to set the colorBarMinimum
and colorBarMaximum
attribute values for dataset variables.
The keys are the dataset variable destinationName
values.
var_colour_ranges = {
'salinity': {'colorBarMinimum': '0.0', 'colorBarMaximum': '34.0'},
'temperature': {'colorBarMinimum': '4.0', 'colorBarMaximum': '20.0'},
'uVelocity': {'colorBarMinimum': '-8.0', 'colorBarMaximum': '8.0'},
'vVelocity': {'colorBarMinimum': '-8.0', 'colorBarMaximum': '8.0'},
'ssh': {'colorBarMinimum': '-4.0', 'colorBarMaximum': '4.0'},
'mixed_layer_depth': {'colorBarMinimum': '0', 'colorBarMaximum': '30.0'},
'biogenic_silicon': {'colorBarMinimum': '0', 'colorBarMaximum': '70.0'},
'nitrate': {'colorBarMinimum': '0', 'colorBarMaximum': '40.0'},
'silicon': {'colorBarMinimum': '0', 'colorBarMaximum': '70.0'},
'diatoms': {'colorBarMinimum': '0', 'colorBarMaximum': '20.0'},
'longitude': {'colorBarMinimum': '-127.0', 'colorBarMaximum': '-121.0'},
'latitude': {'colorBarMinimum': '46.0', 'colorBarMaximum': '52.0'},
'bathymetry': {'colorBarMinimum': '0.0', 'colorBarMaximum': '450.0'},
'PAR': {'colorBarMinimum': '0.0', 'colorBarMaximum': '350.0'},
'sigma_theta': {'colorBarMinimum': '0.0', 'colorBarMaximum': '26.0'},
'e3t': {'colorBarMinimum': '0.0', 'colorBarMaximum': '30.0'},
'fraserTurbidity': {'colorBarMinimum': '0.0', 'colorBarMaximum': '30.0'},
}
The ioos_categories
dictionary below is used to set the ioos_category
attribute values for dataset variables
(see ERDDAP docs IOOS category section).
The keys are the dataset variable destinationName
values.
ioos_categories = {
'time': 'time',
'gridX': 'location',
'gridY': 'location',
'gridZ': 'location',
'latitude': 'location',
'longitude': 'location',
'bathymetry': 'bathymetry',
'salinity': 'salinity',
'temperature': 'temperature',
'uVelocity': 'currents',
'vVelocity': 'currents',
'wVelocity': 'currents',
'ssh': 'sea_level',
'mixed_layer_depth': 'physical_oceanography',
'dissipation': 'physical_oceanography',
'vert_eddy_diff': 'physical_oceanography',
'vert_eddy_visc': 'physical_oceanography',
'ammonium': 'dissolved_nutrients',
'biogenic_silicon': 'dissolved_nutrients',
'dissolved_organic_nitrogen': 'dissolved_nutrients',
'nitrate': 'dissolved_nutrients',
'particulate_organic_nitrogen': 'dissolved_nutrients',
'silicon': 'dissolved_nutrients',
'ciliates': 'biology',
'diatoms': 'biology',
'flagellates': 'biology',
'mesozooplankton': 'biology',
'microzooplankton': 'biology',
'PAR': 'optical_properties',
'sigma_theta': 'physical_oceanography',
'e3t': 'numerics',
'fraserTurbidity': 'optical_properties',
}
A few convenient functions to reduce code repetition:
def print_tree(root):
"""Display an XML tree fragment with indentation.
"""
print(etree.tostring(root, pretty_print=True).decode('ascii'))
def find_att(root, att):
"""Return the dataset attribute element named att
or raise a ValueError exception if it cannot be found.
"""
e = root.find('.//att[@name="{}"]'.format(att))
if e is None:
raise ValueError('{} attribute element not found'.format(att))
return e
def replace_yx_with_lonlat(root):
new_axes = {
'y': {'sourceName': 'nav_lon', 'destinationName': 'longitude'},
'x': {'sourceName': 'nav_lat', 'destinationName': 'latitude'},
}
for axis in root.findall('.//axisVariable'):
if axis.find('.//sourceName').text in new_axes:
key = axis.find('.//sourceName').text
new_axis = etree.Element('axisVariable')
etree.SubElement(new_axis, 'sourceName').text = new_axes[key]['sourceName']
etree.SubElement(new_axis, 'destinationName').text = new_axes[key]['destinationName']
axis.getparent().replace(axis, new_axis)
def update_xml(root, datasetID, metadata, datasets, dataset_vars):
root.attrib['datasetID'] = datasetID
root.find('.//fileNameRegex').text = datasets[datasetID]['fileNameRegex']
title = datasets[datasetID]['title']
if 'keywords' in datasets[datasetID]:
keywords = find_att(root, 'keywords')
keywords.text = datasets[datasetID]['keywords']
summary = find_att(root, 'summary')
summary.text = f'{title}\n\n{datasets[datasetID]["summary"]}'
e = etree.Element('att', name='title')
e.text = title
summary.addnext(e)
for att, info in metadata.items():
e = etree.Element('att', name=att)
e.text = info['text']
try:
root.find(f'''.//att[@name="{info['after']}"]'''.format()).addnext(e)
except KeyError:
find_att(root, att).text = info['text']
attrs = root.find('addAttributes')
etree.SubElement(attrs, 'att', name='NCO').text = 'null'
if not 'Bathymetry' in datasetID:
etree.SubElement(attrs, 'att', name='history').text = 'null'
etree.SubElement(attrs, 'att', name='name').text = 'null'
for axis_name in root.findall('.//axisVariable/sourceName'):
# Since v1.80 the ERDDAP GenerateDatasetsXml.sh tool changes variables named y and x
# into latitude and longitude variables. But our y and x are grid indices, so we fix them.
if axis_name.text in ('y', 'x'):
dest_name = axis_name.getparent().find('destinationName')
dest_name.text = f'grid{axis_name.text.upper()}'
attrs = axis_name.getparent().find('addAttributes')
long_name = find_att(attrs, 'long_name')
long_name.text = axis_name.text.upper()
for att_name in ('source_name', 'standard_name', 'units'):
att = find_att(attrs, att_name)
att.getparent().remove(att)
for axis_name in root.findall('.//axisVariable/destinationName'):
attrs = axis_name.getparent().find('addAttributes')
etree.SubElement(attrs, 'att', name='coverage_content_type').text = 'modelResult'
if axis_name.text == 'time':
etree.SubElement(attrs, 'att', name='comment').text = (
'time values are UTC at the centre of the intervals over which the calculated model results are averaged')
if axis_name.text in ('x', 'y', 'z'):
axis_name.text = f'grid{axis_name.text.upper()}'
if axis_name.text in ioos_categories:
etree.SubElement(attrs, 'att', name='ioos_category').text = ioos_categories[axis_name.text]
if datasets[datasetID]['type'] == 'tide gauge':
replace_yx_with_lonlat(root)
for var_name in root.findall('.//dataVariable/destinationName'):
if var_name.text in dataset_vars:
var_name.text = dataset_vars[var_name.text]['destinationName']
if var_name.text in var_colour_ranges:
for att_name in ('colorBarMinimum', 'colorBarMaximum'):
cb_att = var_name.getparent().find(f'addAttributes/att[@name="{att_name}"]')
if cb_att is not None:
cb_att.text = var_colour_ranges[var_name.text][att_name]
else:
attrs = var_name.getparent().find('addAttributes')
etree.SubElement(attrs, 'att', name=att_name, type='double').text = (
var_colour_ranges[var_name.text][att_name])
attrs = var_name.getparent().find('addAttributes')
etree.SubElement(attrs, 'att', name='coverage_content_type').text = 'modelResult'
etree.SubElement(attrs, 'att', name='cell_measures').text = 'null'
etree.SubElement(attrs, 'att', name='cell_methods').text = 'null'
etree.SubElement(attrs, 'att', name='interval_operation').text = 'null'
etree.SubElement(attrs, 'att', name='interval_write').text = 'null'
etree.SubElement(attrs, 'att', name='online_operation').text = 'null'
if var_name.text in ioos_categories:
etree.SubElement(attrs, 'att', name='ioos_category').text = ioos_categories[var_name.text]
Now we're ready to produce a dataset!!!
Use the /opt/tomcat/webapps/erddap/WEB-INF/GenerateDatasetsXml.sh
script
generate the initial version of an XML fragment for a dataset:
$ cd /opt/tomcat/webapps/erddap/WEB-INF/
$ bash GenerateDatasetsXml.sh EDDGridFromNcFiles /results/SalishSea/nowcast/ ".*SalishSea_1h_\d{8}_\d{8}_grid_U\.nc$" "" 10080
The EDDGridFromNcFiles
,
/results/SalishSea/nowcast/
,
".*SalishSea_1h_\d{8}_\d{8}_grid_U\.nc$"
,
""
,
and 10080
arguments
tell the script:
EDDType
""
to concatenate the parent directory and the file name regex to find a sample fileavoiding having to type those in answer to prompts.
Other examples of file name regex are:
.*PointAtkinson.nc$
.*SalishSea_1d_\d{8}_\d{8}_grid_W\.nc$
The output is written to /results/erddap/logs/GenerateDatasetsXml.out
Dataset ids and file name regexs from datasets dict:
for dataset in sorted(datasets):
print(dataset, datasets[dataset]['fileNameRegex'])
ubcSSaSurfaceAtmosphereFieldsV1 .*ops_y\d{4}m\d{2}d\d{2}\.nc$ ubcSSf3DuGridFields1hV17-02 .*SalishSea_1h_\d{8}_\d{8}_grid_U\.nc$ ubcSSf3DvGridFields1hV17-02 .*SalishSea_1h_\d{8}_\d{8}_grid_V\.nc$ ubcSSg2DTracerFieldsSeasonalV17-02 .*seasonal-30_\d{4}\.nc$ ubcSSg3DAuxiliaryFields1hV19-05 .*SalishSea_1h_\d{8}_\d{8}_carp_T\.nc$ ubcSSg3DBiologyFields1hV17-02 .*SalishSea_1h_\d{8}_\d{8}_ptrc_T\.nc$ ubcSSg3DuGridFields1hV17-02 .*SalishSea_1h_\d{8}_\d{8}_grid_U\.nc$ ubcSSg3DvGridFields1hV17-02 .*SalishSea_1h_\d{8}_\d{8}_grid_V\.nc$ ubcSSg3DwGridFields1hV17-02 .*SalishSea_1h_\d{8}_\d{8}_grid_W\.nc$ ubcSSgPointAtkinsonSSH10mV17-02 .*PointAtkinson\.nc$ ubcSSn2DMeshMask2V1 .*mesh_mask_SalishSea2\.nc$ ubcSSn2DMeshMask2V16-07 .*mesh_mask_downbyone2\.nc$ ubcSSn2DMeshMaskV17-02 .*mesh_mask201702\.nc$ ubcSSn3DMeshMask2V1 .*mesh_mask_SalishSea2\.nc$ ubcSSn3DMeshMask2V16-07 .*mesh_mask_downbyone2\.nc$ ubcSSn3DMeshMaskV17-02 .*mesh_mask201702\.nc$ ubcSSn3DuVelocity1hV1 .*SalishSea_1h_\d{8}_\d{8}_grid_U\.nc$ ubcSSn3DuVelocity1hV16-10 .*SalishSea_1h_\d{8}_\d{8}_grid_U\.nc$ ubcSSn3DvVelocity1hV1 .*SalishSea_1h_\d{8}_\d{8}_grid_V\.nc$ ubcSSn3DvVelocity1hV16-10 .*SalishSea_1h_\d{8}_\d{8}_grid_V\.nc$ ubcSSn3DwVelocity1hV1 .*SalishSea_1h_\d{8}_\d{8}_grid_W\.nc$ ubcSSn3DwVelocity1hV16-10 .*SalishSea_1h_\d{8}_\d{8}_grid_W\.nc$ ubcSSn3DwVelocity1hV2 .*SalishSea_1h_\d{8}_\d{8}_grid_W\.nc$ ubcSSnBathymetry2V1 .*SalishSea2_NEMO_bathy\.nc$ ubcSSnBathymetry2V16-07 .*downbyone2_NEMO_bathy\.nc$ ubcSSnBathymetryV17-02 .*bathymetry_201702\.nc$ ubcSSnBoundaryBaySSH15mV16-10 .*BoundaryBay\.nc$ ubcSSnCampbellRiverSSH10mV16-10 .*CampbellRiver\.nc$ ubcSSnCampbellRiverSSH15mV1 .*CampbellRiver\.nc$ ubcSSnCherryPointSSH10mV16-10 .*CherryPoint\.nc$ ubcSSnCherryPointSSH15mV1 .*CherryPoint\.nc$ ubcSSnFridayHarborSSH10mV16-10 .*FridayHarbor\.nc$ ubcSSnFridayHarborSSH15mV1 .*FridayHarbor\.nc$ ubcSSnNanaimoSSH10mV16-10 .*Nanaimo\.nc$ ubcSSnNanaimoSSH15mV1 .*Nanaimo\.nc$ ubcSSnNeahBaySSH10mV16-10 .*NeahBay\.nc$ ubcSSnNeahBaySSH15mV1 .*NeahBay\.nc$ ubcSSnNearSurfaceUVelocity20mV17-02 .*Slab_U\.nc$ ubcSSnNearSurfaceVVelocity20mV17-02 .*Slab_V\.nc$ ubcSSnPointAtkinsonSSH10mV16-10 .*PointAtkinson\.nc$ ubcSSnPointAtkinsonSSH15mV1 .*PointAtkinson\.nc$ ubcSSnSandHeadsSSH10mV16-10 .*Sandheads\.nc$ ubcSSnSandHeadsSSH15mV1 .*Sandheads\.nc$ ubcSSnVictoriaSSH10mV16-10 .*Victoria\.nc$ ubcSSnVictoriaSSH15mV1 .*Victoria\.nc$
Now, we:
datasetID
we want to useGenerateDatasetsXml.sh
into an XML tree data structuredatasetID
dataset attribute valuefileNameRegex
dataset attribute value because it looses its \
characters during parsing(?)metadata
dicttitle
and summary
dataset attributes from the datasets
dictx
and y
axis variablesdataset_vars
dictparser = etree.XMLParser(remove_blank_text=True)
tree = etree.parse('/results/erddap/logs/GenerateDatasetsXml.out', parser)
root = tree.getroot()
datasetID = 'ubcSSg3DAuxiliaryFields1hV19-05'
update_xml(root, datasetID, metadata, datasets, dataset_vars)
Inspect the resulting dataset XML fragment below and edit the dicts and code cell above until it is what is required for the dataset:
print_tree(root)
<dataset type="EDDGridFromNcFiles" datasetID="ubcSSg3DAuxiliaryFields1hV19-05" active="true"> <reloadEveryNMinutes>10080</reloadEveryNMinutes> <updateEveryNMillis>10000</updateEveryNMillis> <fileDir>/results2/SalishSea/nowcast-green.201905/</fileDir> <fileNameRegex>.*SalishSea_1h_\d{8}_\d{8}_carp_T\.nc$</fileNameRegex> <recursive>true</recursive> <pathRegex>.*</pathRegex> <metadataFrom>last</metadataFrom> <matchAxisNDigits>20</matchAxisNDigits> <fileTableInMemory>false</fileTableInMemory> <accessibleViaFiles>false</accessibleViaFiles> <!-- sourceAttributes> <att name="Conventions">CF-1.6</att> <att name="description">auxilary variables</att> <att name="name">SalishSea_1h_20191026_20191031</att> <att name="timeStamp">2019-Dec-23 01:14:38 GMT</att> <att name="title">auxilary variables</att> <att name="uuid">90073893-253b-428b-9580-0d96b111ab45</att> </sourceAttributes --> <addAttributes> <att name="cdm_data_type">Grid</att> <att name="Conventions">CF-1.6, COARDS, ACDD-1.3</att> <att name="infoUrl">https://salishsea-meopar-docs.readthedocs.io/en/latest/results_server/index.html#salish-sea-model-results</att> <att name="institution">UBC EOAS</att> <att name="institution_fullname">Earth, Ocean & Atmospheric Sciences, University of British Columbia</att> <att name="keywords">auxilary, cell_thickness, density, deptht, downwelling_photosynthetic_photon_radiance_in_sea_water, e3t, Oceans > Ocean Chemistry > Inorganic Matter, Oceans > Ocean Optics > Photosynthetically Active Radiation, Oceans > Ocean Optics > Radiance, Oceans > Salinity/Density > Density, Oceans > Marine Sediments > Suspended Solids, Fraser_tracer, Fraser River, fraser_river_turbidity_tracer, ocean, oceans, optics, PAR, photon, photosynthetic, photosynthetically, radiance, radiation, river, sea, sea_water_sigma_theta, seawater, sediment, sediments, sigma, sigma0, sigma_theta, solids, suspended, t-cell, thickness, time_counter, tracer, turbidity, water </att> <att name="keywords_vocabulary">GCMD Science Keywords</att> <att name="license">The SalishSeaCast MEOPAR NEMO model results are copyright by the SalishSeaCast MEOPAR Project Contributors and The University of British Columbia. They are licensed under the Apache License, Version 2.0. https://www.apache.org/licenses/LICENSE-2.0</att> <att name="standard_name_vocabulary">CF Standard Name Table v29</att> <att name="summary">Green, Salish Sea, 3d Auxiliary Fields, Hourly, v19-05 3d auxiliary model field values averaged over 1 hour intervals from SalishSeaCast NEMO model runs with physics, biology, and chemistry. The values are calculated for the entire model grid that includes Juan de Fuca Strait, he Strait of Georgia, Puget Sound, and Johnstone Strait on the coasts of Washington State and British Columbia. The time values are the centre of the intervals over which the calculated model results are averaged. Geo-location and depth data for the Salish Sea NEMO model grid are available in the ubcSSnBathymetry2V17-02 dataset. v19-05: Photosynthetically available radiation (PAR), Potential density anomaly (sigma_theta), Time-varying z-layer thickness (NEMO e3t), Fraser River water turbidity. NEMO-3.6; ubcSSnBathymetryV17-02 bathymetry; see infoUrl link for full details. </att> <att name="title">Green, Salish Sea, 3d Auxiliary Fields, Hourly, v19-05</att> <att name="project">Salish Sea MEOPAR NEMO Model</att> <att name="creator_name">Salish Sea MEOPAR Project Contributors</att> <att name="creator_email">sallen@eoas.ubc.ca</att> <att name="creator_url">https://salishsea-meopar-docs.readthedocs.io/</att> <att name="acknowledgement">MEOPAR, ONC, Compute Canada</att> <att name="drawLandMask">over</att> <att name="uuid">null</att> <att name="NCO">null</att> <att name="history">null</att> <att name="name">null</att> </addAttributes> <axisVariable> <sourceName>time_counter</sourceName> <destinationName>time</destinationName> <!-- sourceAttributes> <att name="_ChunkSizes" type="int">1</att> <att name="axis">T</att> <att name="bounds">time_counter_bounds</att> <att name="calendar">gregorian</att> <att name="long_name">Time axis</att> <att name="standard_name">time</att> <att name="time_origin">1900-01-01 00:00:00</att> <att name="units">seconds since 1900-01-01 00:00:00</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSizes">null</att> <att name="bounds">null</att> <att name="source_name">time_counter</att> <att name="units">seconds since 1900-01-01T00:00:00Z</att> <att name="coverage_content_type">modelResult</att> <att name="comment">time values are UTC at the centre of the intervals over which the calculated model results are averaged</att> <att name="ioos_category">time</att> </addAttributes> </axisVariable> <axisVariable> <sourceName>deptht</sourceName> <destinationName>depth</destinationName> <!-- sourceAttributes> <att name="_ChunkSizes" type="int">40</att> <att name="axis">Z</att> <att name="bounds">deptht_bounds</att> <att name="long_name">Vertical T levels</att> <att name="name">deptht</att> <att name="positive">down</att> <att name="units">m</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSizes">null</att> <att name="bounds">null</att> <att name="source_name">deptht</att> <att name="standard_name">depth</att> <att name="coverage_content_type">modelResult</att> </addAttributes> </axisVariable> <axisVariable> <sourceName>y</sourceName> <destinationName>gridY</destinationName> <!-- sourceAttributes> </sourceAttributes --> <addAttributes> <att name="long_name">Y</att> <att name="coverage_content_type">modelResult</att> <att name="ioos_category">location</att> </addAttributes> </axisVariable> <axisVariable> <sourceName>x</sourceName> <destinationName>gridX</destinationName> <!-- sourceAttributes> </sourceAttributes --> <addAttributes> <att name="long_name">X</att> <att name="coverage_content_type">modelResult</att> <att name="ioos_category">location</att> </addAttributes> </axisVariable> <dataVariable> <sourceName>PAR</sourceName> <destinationName>PAR</destinationName> <dataType>float</dataType> <!-- sourceAttributes> <att name="_ChunkSizes" type="intList">1 40 898 398</att> <att name="_FillValue" type="float">1.0E20</att> <att name="cell_measures">area: area</att> <att name="cell_methods">time: mean (interval: 40 s)</att> <att name="coordinates">time_centered deptht nav_lat nav_lon</att> <att name="interval_operation">40 s</att> <att name="interval_write">1 h</att> <att name="long_name">Photosynthetically Available Radiation</att> <att name="missing_value" type="float">1.0E20</att> <att name="online_operation">average</att> <att name="units">W/m2</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSizes">null</att> <att name="colorBarMaximum" type="double">450.0</att> <att name="colorBarMinimum" type="double">0.0</att> <att name="coordinates">null</att> <att name="standard_name">downwelling_photosynthetic_photon_radiance_in_sea_water</att> <att name="coverage_content_type">modelResult</att> <att name="cell_measures">null</att> <att name="cell_methods">null</att> <att name="interval_operation">null</att> <att name="interval_write">null</att> <att name="online_operation">null</att> <att name="ioos_category">optical_properties</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>sigma_theta</sourceName> <destinationName>sigma_theta</destinationName> <dataType>float</dataType> <!-- sourceAttributes> <att name="_ChunkSizes" type="intList">1 40 898 398</att> <att name="_FillValue" type="float">1.0E20</att> <att name="cell_measures">area: area</att> <att name="cell_methods">time: mean (interval: 40 s)</att> <att name="coordinates">time_centered deptht nav_lat nav_lon</att> <att name="interval_operation">40 s</att> <att name="interval_write">1 h</att> <att name="long_name">potential density (sigma0)</att> <att name="missing_value" type="float">1.0E20</att> <att name="online_operation">average</att> <att name="standard_name">sea_water_sigma_theta</att> <att name="units">kg/m3</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSizes">null</att> <att name="colorBarMaximum" type="double">26.0</att> <att name="colorBarMinimum" type="double">0.0</att> <att name="coordinates">null</att> <att name="coverage_content_type">modelResult</att> <att name="cell_measures">null</att> <att name="cell_methods">null</att> <att name="interval_operation">null</att> <att name="interval_write">null</att> <att name="online_operation">null</att> <att name="ioos_category">physical_oceanography</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>e3t</sourceName> <destinationName>e3t</destinationName> <dataType>float</dataType> <!-- sourceAttributes> <att name="_ChunkSizes" type="intList">1 40 898 398</att> <att name="_FillValue" type="float">1.0E20</att> <att name="cell_measures">area: area</att> <att name="cell_methods">time: mean (interval: 40 s)</att> <att name="coordinates">time_centered deptht nav_lat nav_lon</att> <att name="interval_operation">40 s</att> <att name="interval_write">1 h</att> <att name="long_name">T-cell thickness</att> <att name="missing_value" type="float">1.0E20</att> <att name="online_operation">average</att> <att name="standard_name">cell_thickness</att> <att name="units">m</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSizes">null</att> <att name="coordinates">null</att> <att name="colorBarMinimum" type="double">0.0</att> <att name="colorBarMaximum" type="double">30.0</att> <att name="coverage_content_type">modelResult</att> <att name="cell_measures">null</att> <att name="cell_methods">null</att> <att name="interval_operation">null</att> <att name="interval_write">null</att> <att name="online_operation">null</att> <att name="ioos_category">numerics</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>Fraser_tracer</sourceName> <destinationName>fraserTurbidity</destinationName> <dataType>float</dataType> <!-- sourceAttributes> <att name="_ChunkSizes" type="intList">1 40 898 398</att> <att name="_FillValue" type="float">1.0E20</att> <att name="cell_measures">area: area</att> <att name="cell_methods">time: mean (interval: 40 s)</att> <att name="coordinates">time_centered deptht nav_lat nav_lon</att> <att name="interval_operation">40 s</att> <att name="interval_write">1 h</att> <att name="long_name">Fraser River Turbidity Tracer</att> <att name="missing_value" type="float">1.0E20</att> <att name="online_operation">average</att> <att name="standard_name">fraser_river_turbidity_tracer</att> <att name="units">NTU</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSizes">null</att> <att name="coordinates">null</att> <att name="colorBarMinimum" type="double">0.0</att> <att name="colorBarMaximum" type="double">450.0</att> <att name="coverage_content_type">modelResult</att> <att name="cell_measures">null</att> <att name="cell_methods">null</att> <att name="interval_operation">null</att> <att name="interval_write">null</att> <att name="online_operation">null</att> <att name="ioos_category">optical_properties</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>dissolved_inorganic_carbon</sourceName> <destinationName>dissolved_inorganic_carbon</destinationName> <dataType>float</dataType> <!-- sourceAttributes> <att name="_ChunkSizes" type="intList">1 40 898 398</att> <att name="_FillValue" type="float">1.0E20</att> <att name="cell_measures">area: area</att> <att name="cell_methods">time: mean (interval: 40 s)</att> <att name="coordinates">time_centered deptht nav_lat nav_lon</att> <att name="interval_operation">40 s</att> <att name="interval_write">1 h</att> <att name="long_name">Dissolved Inorganic C Concentration</att> <att name="missing_value" type="float">1.0E20</att> <att name="online_operation">average</att> <att name="standard_name">mole_concentration_of_dissolved_inorganic_carbon_in_sea_water</att> <att name="units">mmol m-3</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSizes">null</att> <att name="coordinates">null</att> <att name="coverage_content_type">modelResult</att> <att name="cell_measures">null</att> <att name="cell_methods">null</att> <att name="interval_operation">null</att> <att name="interval_write">null</att> <att name="online_operation">null</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>total_alkalinity</sourceName> <destinationName>total_alkalinity</destinationName> <dataType>float</dataType> <!-- sourceAttributes> <att name="_ChunkSizes" type="intList">1 40 898 398</att> <att name="_FillValue" type="float">1.0E20</att> <att name="cell_measures">area: area</att> <att name="cell_methods">time: mean (interval: 40 s)</att> <att name="coordinates">time_centered deptht nav_lat nav_lon</att> <att name="interval_operation">40 s</att> <att name="interval_write">1 h</att> <att name="long_name">Total Alkalinity Concentration</att> <att name="missing_value" type="float">1.0E20</att> <att name="online_operation">average</att> <att name="standard_name">sea_water_alkalinity_expressed_as_mole_equivalent</att> <att name="units">mmol m-3</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSizes">null</att> <att name="coordinates">null</att> <att name="coverage_content_type">modelResult</att> <att name="cell_measures">null</att> <att name="cell_methods">null</att> <att name="interval_operation">null</att> <att name="interval_write">null</att> <att name="online_operation">null</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>dissolved_oxygen</sourceName> <destinationName>dissolved_oxygen</destinationName> <dataType>float</dataType> <!-- sourceAttributes> <att name="_ChunkSizes" type="intList">1 40 898 398</att> <att name="_FillValue" type="float">1.0E20</att> <att name="cell_measures">area: area</att> <att name="cell_methods">time: mean (interval: 40 s)</att> <att name="coordinates">time_centered deptht nav_lat nav_lon</att> <att name="interval_operation">40 s</att> <att name="interval_write">1 h</att> <att name="long_name">Dissolved Oxygen Concentration</att> <att name="missing_value" type="float">1.0E20</att> <att name="online_operation">average</att> <att name="standard_name">dissolved_oxygen_expressed_as_mole_equivalent</att> <att name="units">mmol m-3</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSizes">null</att> <att name="coordinates">null</att> <att name="coverage_content_type">modelResult</att> <att name="cell_measures">null</att> <att name="cell_methods">null</att> <att name="interval_operation">null</att> <att name="interval_write">null</att> <att name="online_operation">null</att> </addAttributes> </dataVariable> </dataset>
Extra processing steps are required for some types of datasets. See:
Store the XML fragment for the dataset:
with open(f'/results/erddap-datasets/fragments/{datasetID}.xml', 'wb') as f:
f.write(etree.tostring(root, pretty_print=True))
Edit /results/erddap-datasets/datasets.xml
to include the
XML fragment for the dataset that was stored by the above cell.
That file is symlinked to /opt/tomcat/content/erddap/datasets.xml
.
Create a flag file to signal the ERDDAP server process to load the dataset:
$ cd /results/erddap/flag/
$ touch <datasetID>
If the dataset does not appear on https://salishsea.eos.ubc.ca/erddap/info/,
check /results/erddap/logs/log.txt
for error messages from the dataset load process
(they may not be at the end of the file because ERDDAP is pretty chatty).
Once the dataset has been successfully loaded and you are happy with the metadata
that ERDDAP is providing for it,
commit the changes in /results/erddap-datasets/
and push them to Bitbucket.
The /opt/tomcat/webapps/erddap/WEB-INF/GenerateDatasetsXml.sh
script produces an XML
fragment that uses all of the dimensions that it finds in the sample file it parses,
and includes only the variables that have all of those dimensions.
To produce an XML fragment for surface fields we need to do some additional work:
dataVariable
elementsdataVariable
elements for the surface variablesattrs = root.find('addAttributes')
etree.SubElement(attrs, 'att', name='description').text = 'ocean surface T grid variables'
for axis in root.findall('.//axisVariable'):
if axis.find('.//destinationName').text == 'depth':
axis.getparent().remove(axis)
break
for var in root.findall('.//dataVariable'):
var.getparent().remove(var)
var = etree.SubElement(root, 'dataVariable')
etree.SubElement(var, 'sourceName').text = 'sossheig'
etree.SubElement(var, 'destinationName').text = 'ssh'
etree.SubElement(var, 'dataType').text = 'float'
attrs = etree.SubElement(var, 'addAttributes')
etree.SubElement(attrs, 'att', name='_ChunkSize').text = 'null'
etree.SubElement(attrs, 'att', name='coordinates').text = 'null'
etree.SubElement(attrs, 'att', name='ioos_category').text = ioos_categories['ssh']
var = etree.SubElement(root, 'dataVariable')
etree.SubElement(var, 'sourceName').text = 'mixed_depth'
etree.SubElement(var, 'destinationName').text = 'mixed_layer_depth'
etree.SubElement(var, 'dataType').text = 'float'
attrs = etree.SubElement(var, 'addAttributes')
etree.SubElement(attrs, 'att', name='_ChunkSize').text = 'null'
etree.SubElement(attrs, 'att', name='coordinates').text = 'null'
etree.SubElement(attrs, 'att', name='ioos_category').text = ioos_categories['mixed_layer_depth']
for var_name in root.findall('.//dataVariable/destinationName'):
if var_name.text in dataset_vars:
var_name.text = dataset_vars[var_name.text]['destinationName']
if var_name.text in var_colour_ranges:
for att_name in ('colorBarMinimum', 'colorBarMaximum'):
cb_att = var_name.getparent().find(f'addAttributes/att[@name="{att_name}"]')
if cb_att is not None:
cb_att.text = var_colour_ranges[var_name.text][att_name]
else:
attrs = var_name.getparent().find('addAttributes')
etree.SubElement(attrs, 'att', name=att_name, type='double').text = (
var_colour_ranges[var_name.text][att_name])
attrs = var_name.getparent().find('addAttributes')
etree.SubElement(attrs, 'att', name='coverage_content_type').text = 'modelResult'
etree.SubElement(attrs, 'att', name='cell_measures').text = 'null'
etree.SubElement(attrs, 'att', name='cell_methods').text = 'null'
etree.SubElement(attrs, 'att', name='interval_operation').text = 'null'
etree.SubElement(attrs, 'att', name='interval_write').text = 'null'
etree.SubElement(attrs, 'att', name='online_operation').text = 'null'
if var_name.text in ioos_categories:
etree.SubElement(attrs, 'att', name='ioos_category').text = ioos_categories[var_name.text]
print_tree(root)
<dataset type="EDDGridFromNcFiles" datasetID="ubcSSgSurfaceTracerFields1hV17-02" active="true"> <reloadEveryNMinutes>10080</reloadEveryNMinutes> <updateEveryNMillis>10000</updateEveryNMillis> <fileDir>/results/SalishSea/hindcast/</fileDir> <recursive>true</recursive> <fileNameRegex>.*SalishSea_1h_\d{8}_\d{8}_grid_T\.nc$</fileNameRegex> <metadataFrom>last</metadataFrom> <matchAxisNDigits>20</matchAxisNDigits> <fileTableInMemory>false</fileTableInMemory> <accessibleViaFiles>false</accessibleViaFiles> <!-- sourceAttributes> <att name="Conventions">CF-1.6</att> <att name="description">ocean T grid variables</att> <att name="history">Wed Apr 26 21:34:53 2017: ncks -4 -L4 -O SalishSea_1h_20140912_20140912_grid_T.nc SalishSea_1h_20140912_20140912_grid_T.nc</att> <att name="name">SalishSea_1h_20140912_20140912</att> <att name="NCO">"4.5.2"</att> <att name="timeStamp">2017-Apr-27 03:53:38 GMT</att> <att name="title">ocean T grid variables</att> <att name="uuid">3d5c0584-cd03-4eb1-83b6-a5915ff08093</att> </sourceAttributes --> <addAttributes> <att name="cdm_data_type">Grid</att> <att name="Conventions">CF-1.6, COARDS, ACDD-1.3</att> <att name="infoUrl">https://salishsea-meopar-docs.readthedocs.io/en/latest/results_server/index.html#salish-sea-model-results</att> <att name="institution">UBC EOAS</att> <att name="institution_fullname">Earth, Ocean & Atmospheric Sciences, University of British Columbia</att> <att name="keywords">deptht, grid, ocean, oceans, Oceans > Ocean Circulation > Ocean Mixed Layer, Oceans > Sea Surface Topography > Sea Surface Height, mixed_depth, mixed_layer_depth, ocean_mixed_layer_thickness_defined_by_sigma_theta, mixed layer depth (dsigma = 0.01 wrt 10m), sea surface height, sea_surface_height_above_geoid, sea water, seawater, ssh, sossheig, time_counter, water</att> <att name="license">The Salish Sea MEOPAR NEMO model results are copyright by the Salish Sea MEOPAR Project Contributors and The University of British Columbia. They are licensed under the Apache License, Version 2.0. https://www.apache.org/licenses/LICENSE-2.0</att> <att name="standard_name_vocabulary">CF Standard Name Table v29</att> <att name="summary">Green, Salish Sea, Surface Tracer Fields, Hourly, v17-02 2d sea surface height and mixed layer depth field values averaged over 1 hour intervals from Salish Sea NEMO model runs with physics and biology. The values are calculated for the surface of the model grid that includes the Juan de Fuca Strait, the Strait of Georgia, Puget Sound, and Johnstone Strait on the coasts of Washington State and British Columbia. The time values are the centre of the intervals over which the calculated model results are averaged. Geo-location and depth data for the Salish Sea NEMO model grid are available in the ubcSSnBathymetry2V17-02 dataset. v1: sea surface height and rainfall rate variables v16-10: NEMO-3.6; ubcSSnBathymetry2V16-07 bathymetry; see infoUrl link for full details. Deleted rainfall rate variable. v17-02: NEMO-3.6; ubcSSnBathymetryV17-02 bathymetry; see infoUrl link for full details. Added mixed layer depth variable (dsigma = 0.01 wrt 10m)</att> <att name="title">Green, Salish Sea, Surface Tracer Fields, Hourly, v17-02</att> <att name="project">Salish Sea MEOPAR NEMO Model</att> <att name="creator_name">Salish Sea MEOPAR Project Contributors</att> <att name="creator_email">sallen@eoas.ubc.ca</att> <att name="creator_url">https://salishsea-meopar-docs.readthedocs.io/</att> <att name="acknowledgement">MEOPAR, ONC, Compute Canada</att> <att name="drawLandMask">over</att> <att name="history">null</att> <att name="NCO">null</att> <att name="name">null</att> <att name="description">ocean surface T grid variables</att> </addAttributes> <axisVariable> <sourceName>time_counter</sourceName> <destinationName>time</destinationName> <!-- sourceAttributes> <att name="_ChunkSize" type="int">1</att> <att name="axis">T</att> <att name="bounds">time_counter_bounds</att> <att name="calendar">gregorian</att> <att name="long_name">Time axis</att> <att name="standard_name">time</att> <att name="time_origin">1900-01-01 00:00:00</att> <att name="units">seconds since 1900-01-01 00:00:00</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSize">null</att> <att name="bounds">null</att> <att name="coverage_content_type">modelResult</att> <att name="comment">time values are the centre of the intervals over which the calculated model results are averaged</att> <att name="ioos_category">time</att> </addAttributes> </axisVariable> <axisVariable> <sourceName>y</sourceName> <destinationName>gridY</destinationName> <!-- sourceAttributes> </sourceAttributes --> <addAttributes> <att name="long_name">Y</att> <att name="coverage_content_type">modelResult</att> <att name="ioos_category">location</att> </addAttributes> </axisVariable> <axisVariable> <sourceName>x</sourceName> <destinationName>gridX</destinationName> <!-- sourceAttributes> </sourceAttributes --> <addAttributes> <att name="long_name">X</att> <att name="coverage_content_type">modelResult</att> <att name="ioos_category">location</att> </addAttributes> </axisVariable> <dataVariable> <sourceName>sossheig</sourceName> <destinationName>ssh</destinationName> <dataType>float</dataType> <addAttributes> <att name="_ChunkSize">null</att> <att name="coordinates">null</att> <att name="ioos_category">sea_level</att> <att name="colorBarMinimum" type="double">-4.0</att> <att name="colorBarMaximum" type="double">4.0</att> <att name="coverage_content_type">modelResult</att> <att name="cell_measures">null</att> <att name="cell_methods">null</att> <att name="interval_operation">null</att> <att name="interval_write">null</att> <att name="online_operation">null</att> <att name="ioos_category">sea_level</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>mixed_depth</sourceName> <destinationName>mixed_layer_depth</destinationName> <dataType>float</dataType> <addAttributes> <att name="_ChunkSize">null</att> <att name="coordinates">null</att> <att name="ioos_category">physical_oceanography</att> <att name="colorBarMinimum" type="double">0</att> <att name="colorBarMaximum" type="double">30.0</att> <att name="coverage_content_type">modelResult</att> <att name="cell_measures">null</att> <att name="cell_methods">null</att> <att name="interval_operation">null</att> <att name="interval_write">null</att> <att name="online_operation">null</att> <att name="ioos_category">physical_oceanography</att> </addAttributes> </dataVariable> </dataset>
with open('/results/erddap-datasets/fragments/{}.xml'.format(datasetID), 'wb') as f:
f.write(etree.tostring(root, pretty_print=True))
The /opt/tomcat/webapps/erddap/WEB-INF/GenerateDatasetsXml.sh
script produces an XML
fragment that uses all of the dimensions that it finds in the sample file it parses,
and includes only the variables that have all of those dimensions.
To produce an XML fragment for depth-averaged seasonal average fields we need to do some additional work:
dataVariable
elementsdataVariable
elements for the depth-averaged seasonal average variablesattrs = root.find('addAttributes')
etree.SubElement(attrs, 'att', name='description').text = 'depth-averaged seasonal average T grid variables'
for axis in root.findall('.//axisVariable'):
if axis.find('.//destinationName').text == 'depth':
axis.getparent().remove(axis)
break
for var in root.findall('.//dataVariable'):
var.getparent().remove(var)
var = etree.SubElement(root, 'dataVariable')
etree.SubElement(var, 'sourceName').text = 'vosalineoverdepth'
etree.SubElement(var, 'destinationName').text = 'salinity'
etree.SubElement(var, 'dataType').text = 'float'
attrs = etree.SubElement(var, 'addAttributes')
etree.SubElement(attrs, 'att', name='_ChunkSize').text = 'null'
etree.SubElement(attrs, 'att', name='coordinates').text = 'null'
etree.SubElement(attrs, 'att', name='ioos_category').text = ioos_categories['salinity']
var = etree.SubElement(root, 'dataVariable')
etree.SubElement(var, 'sourceName').text = 'votemperoverdepth'
etree.SubElement(var, 'destinationName').text = 'temperature'
etree.SubElement(var, 'dataType').text = 'float'
attrs = etree.SubElement(var, 'addAttributes')
etree.SubElement(attrs, 'att', name='_ChunkSize').text = 'null'
etree.SubElement(attrs, 'att', name='coordinates').text = 'null'
etree.SubElement(attrs, 'att', name='ioos_category').text = ioos_categories['temperature']
for var_name in root.findall('.//dataVariable/destinationName'):
if var_name.text in dataset_vars:
var_name.text = dataset_vars[var_name.text]['destinationName']
if var_name.text in var_colour_ranges:
for att_name in ('colorBarMinimum', 'colorBarMaximum'):
cb_att = var_name.getparent().find(f'addAttributes/att[@name="{att_name}"]')
if cb_att is not None:
cb_att.text = var_colour_ranges[var_name.text][att_name]
else:
attrs = var_name.getparent().find('addAttributes')
etree.SubElement(attrs, 'att', name=att_name, type='double').text = (
var_colour_ranges[var_name.text][att_name])
attrs = var_name.getparent().find('addAttributes')
etree.SubElement(attrs, 'att', name='coverage_content_type').text = 'modelResult'
etree.SubElement(attrs, 'att', name='cell_measures').text = 'null'
etree.SubElement(attrs, 'att', name='cell_methods').text = 'null'
etree.SubElement(attrs, 'att', name='interval_operation').text = 'null'
etree.SubElement(attrs, 'att', name='interval_write').text = 'null'
etree.SubElement(attrs, 'att', name='online_operation').text = 'null'
if var_name.text in ioos_categories:
etree.SubElement(attrs, 'att', name='ioos_category').text = ioos_categories[var_name.text]
print_tree(root)
<dataset type="EDDGridFromNcFiles" datasetID="ubcSSg2DTracerFieldsSeasonalV17-02" active="true"> <reloadEveryNMinutes>10080</reloadEveryNMinutes> <updateEveryNMillis>10000</updateEveryNMillis> <fileDir>/results/SalishSea/climatology/</fileDir> <fileNameRegex>.*seasonal-30_\d{4}\.nc$</fileNameRegex> <recursive>true</recursive> <pathRegex>.*</pathRegex> <metadataFrom>last</metadataFrom> <matchAxisNDigits>20</matchAxisNDigits> <fileTableInMemory>false</fileTableInMemory> <accessibleViaFiles>false</accessibleViaFiles> <!-- sourceAttributes> <att name="Conventions">CF-1.6</att> <att name="description">ocean T grid variables</att> <att name="history">Fri Feb 9 07:26:11 2018: ncrcat /data/vdo/MEOPAR/for-devin/meanDJF_0-30m_2017.nc /data/vdo/MEOPAR/for-devin/meanMAM_0-30m_2017.nc /data/vdo/MEOPAR/for-devin/meanJJA_0-30m_2017.nc /data/vdo/MEOPAR/for-devin/meanSON_0-30m_2017.nc /data/vdo/MEOPAR/for-devin/seasonal-30_2017.nc Fri Feb 9 07:20:47 2018: ncra -v votemper,vosaline -d deptht,,21,1 /results/SalishSea/nowcast-green/01dec16/SalishSea_1d_20161201_20161201_grid_T.nc /results/SalishSea/nowcast-green/12dec16/SalishSea_1d_20161212_20161212_grid_T.nc /results/SalishSea/nowcast-green/27dec16/SalishSea_1d_20161227_20161227_grid_T.nc /results/SalishSea/nowcast-green/30dec16/SalishSea_1d_20161230_20161230_grid_T.nc /results/SalishSea/nowcast-green/29dec16/SalishSea_1d_20161229_20161229_grid_T.nc /results/SalishSea/nowcast-green/02dec16/SalishSea_1d_20161202_20161202_grid_T.nc /results/SalishSea/nowcast-green/19dec16/SalishSea_1d_20161219_20161219_grid_T.nc /results/SalishSea/nowcast-green/26dec16/SalishSea_1d_20161226_20161226_grid_T.nc /results/SalishSea/nowcast-green/25dec16/SalishSea_1d_20161225_20161225_grid_T.nc /results/SalishSea/nowcast-green/09dec16/SalishSea_1d_20161209_20161209_grid_T.nc /results/SalishSea/nowcast-green/06dec16/SalishSea_1d_20161206_20161206_grid_T.nc /results/SalishSea/nowcast-green/28dec16/SalishSea_1d_20161228_20161228_grid_T.nc /results/SalishSea/nowcast-green/05dec16/SalishSea_1d_20161205_20161205_grid_T.nc /results/SalishSea/nowcast-green/07dec16/SalishSea_1d_20161207_20161207_grid_T.nc /results/SalishSea/nowcast-green/24dec16/SalishSea_1d_20161224_20161224_grid_T.nc /results/SalishSea/nowcast-green/20dec16/SalishSea_1d_20161220_20161220_grid_T.nc /results/SalishSea/nowcast-green/16dec16/SalishSea_1d_20161216_20161216_grid_T.nc /results/SalishSea/nowcast-green/31dec16/SalishSea_1d_20161231_20161231_grid_T.nc /results/SalishSea/nowcast-green/14dec16/SalishSea_1d_20161214_20161214_grid_T.nc /results/SalishSea/nowcast-green/03dec16/SalishSea_1d_20161203_20161203_grid_T.nc /results/SalishSea/nowcast-green/10dec16/SalishSea_1d_20161210_20161210_grid_T.nc /results/SalishSea/nowcast-green/17dec16/SalishSea_1d_20161217_20161217_grid_T.nc /results/SalishSea/nowcast-green/08dec16/SalishSea_1d_20161208_20161208_grid_T.nc /results/SalishSea/nowcast-green/18dec16/SalishSea_1d_20161218_20161218_grid_T.nc /results/SalishSea/nowcast-green/21dec16/SalishSea_1d_20161221_20161221_grid_T.nc /results/SalishSea/nowcast-green/23dec16/SalishSea_1d_20161223_20161223_grid_T.nc /results/SalishSea/nowcast-green/04dec16/SalishSea_1d_20161204_20161204_grid_T.nc /results/SalishSea/nowcast-green/15dec16/SalishSea_1d_20161215_20161215_grid_T.nc /results/SalishSea/nowcast-green/11dec16/SalishSea_1d_20161211_20161211_grid_T.nc /results/SalishSea/nowcast-green/22dec16/SalishSea_1d_20161222_20161222_grid_T.nc /results/SalishSea/nowcast-green/13dec16/SalishSea_1d_20161213_20161213_grid_T.nc /results/SalishSea/nowcast-green/29jan17/SalishSea_1d_20170129_20170129_grid_T.nc /results/SalishSea/nowcast-green/21jan17/SalishSea_1d_20170121_20170121_grid_T.nc /results/SalishSea/nowcast-green/12jan17/SalishSea_1d_20170112_20170112_grid_T.nc /results/SalishSea/nowcast-green/30jan17/SalishSea_1d_20170130_20170130_grid_T.nc /results/SalishSea/nowcast-green/10jan17/SalishSea_1d_20170110_20170110_grid_T.nc /results/SalishSea/nowcast-green/07jan17/SalishSea_1d_20170107_20170107_grid_T.nc /results/SalishSea/nowcast-green/23jan17/SalishSea_1d_20170123_20170123_grid_T.nc /results/SalishSea/nowcast-green/22jan17/SalishSea_1d_20170122_20170122_grid_T.nc /results/SalishSea/nowcast-green/31jan17/SalishSea_1d_20170131_20170131_grid_T.nc /results/SalishSea/nowcast-green/25jan17/SalishSea_1d_20170125_20170125_grid_T.nc /results/SalishSea/nowcast-green/06jan17/SalishSea_1d_20170106_20170106_grid_T.nc /results/SalishSea/nowcast-green/09jan17/SalishSea_1d_20170109_20170109_grid_T.nc /results/SalishSea/nowcast-green/13jan17/SalishSea_1d_20170113_20170113_grid_T.nc /results/SalishSea/nowcast-green/19jan17/SalishSea_1d_20170119_20170119_grid_T.nc /results/SalishSea/nowcast-green/05jan17/SalishSea_1d_20170105_20170105_grid_T.nc /results/SalishSea/nowcast-green/02jan17/SalishSea_1d_20170102_20170102_grid_T.nc /results/SalishSea/nowcast-green/26jan17/SalishSea_1d_20170126_20170126_grid_T.nc /results/SalishSea/nowcast-green/15jan17/SalishSea_1d_20170115_20170115_grid_T.nc /results/SalishSea/nowcast-green/17jan17/SalishSea_1d_20170117_20170117_grid_T.nc /results/SalishSea/nowcast-green/28jan17/SalishSea_1d_20170128_20170128_grid_T.nc /results/SalishSea/nowcast-green/20jan17/SalishSea_1d_20170120_20170120_grid_T.nc /results/SalishSea/nowcast-green/27jan17/SalishSea_1d_20170127_20170127_grid_T.nc /results/SalishSea/nowcast-green/01jan17/SalishSea_1d_20170101_20170101_grid_T.nc /results/SalishSea/nowcast-green/16jan17/SalishSea_1d_20170116_20170116_grid_T.nc /results/SalishSea/nowcast-green/14jan17/SalishSea_1d_20170114_20170114_grid_T.nc /results/SalishSea/nowcast-green/08jan17/SalishSea_1d_20170108_20170108_grid_T.nc /results/SalishSea/nowcast-green/03jan17/SalishSea_1d_20170103_20170103_grid_T.nc /results/SalishSea/nowcast-green/04jan17/SalishSea_1d_20170104_20170104_grid_T.nc /results/SalishSea/nowcast-green/24jan17/SalishSea_1d_20170124_20170124_grid_T.nc /results/SalishSea/nowcast-green/18jan17/SalishSea_1d_20170118_20170118_grid_T.nc /results/SalishSea/nowcast-green/11jan17/SalishSea_1d_20170111_20170111_grid_T.nc /results/SalishSea/nowcast-green/27feb17/SalishSea_1d_20170227_20170227_grid_T.nc /results/SalishSea/nowcast-green/03feb17/SalishSea_1d_20170203_20170203_grid_T.nc /results/SalishSea/nowcast-green/13feb17/SalishSea_1d_20170213_20170213_grid_T.nc /results/SalishSea/nowcast-green/09feb17/SalishSea_1d_20170209_20170209_grid_T.nc /results/SalishSea/nowcast-green/14feb17/SalishSea_1d_20170214_20170214_grid_T.nc /results/SalishSea/nowcast-green/04feb17/SalishSea_1d_20170204_20170204_grid_T.nc /results/SalishSea/nowcast-green/26feb17/SalishSea_1d_20170226_20170226_grid_T.nc /results/SalishSea/nowcast-green/24feb17/SalishSea_1d_20170224_20170224_grid_T.nc /results/SalishSea/nowcast-green/10feb17/SalishSea_1d_20170210_20170210_grid_T.nc /results/SalishSea/nowcast-green/05feb17/SalishSea_1d_20170205_20170205_grid_T.nc /results/SalishSea/nowcast-green/12feb17/SalishSea_1d_20170212_20170212_grid_T.nc /results/SalishSea/nowcast-green/23feb17/SalishSea_1d_20170223_20170223_grid_T.nc /results/SalishSea/nowcast-green/02feb17/SalishSea_1d_20170202_20170202_grid_T.nc /results/SalishSea/nowcast-green/20feb17/SalishSea_1d_20170220_20170220_grid_T.nc /results/SalishSea/nowcast-green/07feb17/SalishSea_1d_20170207_20170207_grid_T.nc /results/SalishSea/nowcast-green/22feb17/SalishSea_1d_20170222_20170222_grid_T.nc /results/SalishSea/nowcast-green/28feb17/SalishSea_1d_20170228_20170228_grid_T.nc /results/SalishSea/nowcast-green/08feb17/SalishSea_1d_20170208_20170208_grid_T.nc /results/SalishSea/nowcast-green/16feb17/SalishSea_1d_20170216_20170216_grid_T.nc /results/SalishSea/nowcast-green/01feb17/SalishSea_1d_20170201_20170201_grid_T.nc /results/SalishSea/nowcast-green/11feb17/SalishSea_1d_20170211_20170211_grid_T.nc /results/SalishSea/nowcast-green/17feb17/SalishSea_1d_20170217_20170217_grid_T.nc /results/SalishSea/nowcast-green/21feb17/SalishSea_1d_20170221_20170221_grid_T.nc /results/SalishSea/nowcast-green/18feb17/SalishSea_1d_20170218_20170218_grid_T.nc /results/SalishSea/nowcast-green/25feb17/SalishSea_1d_20170225_20170225_grid_T.nc /results/SalishSea/nowcast-green/15feb17/SalishSea_1d_20170215_20170215_grid_T.nc /results/SalishSea/nowcast-green/19feb17/SalishSea_1d_20170219_20170219_grid_T.nc /results/SalishSea/nowcast-green/06feb17/SalishSea_1d_20170206_20170206_grid_T.nc /data/vdo/MEOPAR/for-devin/meanDJF_0-30m_2017.nc Fri Jun 30 14:57:37 2017: ncks -4 -L4 -O SalishSea_1d_20161127_20161206_grid_T_20161201-20161201.nc SalishSea_1d_20161127_20161206_grid_T_20161201-20161201.nc</att> <att name="name">SalishSea_1d_20161127_20161206</att> <att name="NCO">4.3.9</att> <att name="nco_openmp_thread_number" type="int">1</att> <att name="timeStamp">2017-Jun-30 16:04:14 GMT</att> <att name="title">ocean T grid variables</att> <att name="uuid">16aadb59-5b6a-4927-b324-8cfb63f3d6e5</att> </sourceAttributes --> <addAttributes> <att name="cdm_data_type">Grid</att> <att name="Conventions">CF-1.6, COARDS, ACDD-1.3</att> <att name="infoUrl">https://salishsea-meopar-docs.readthedocs.io/en/latest/results_server/index.html#salish-sea-model-results</att> <att name="institution">UBC EOAS</att> <att name="institution_fullname">Earth, Ocean & Atmospheric Sciences, University of British Columbia</att> <att name="keywords">grid, ocean, oceans, Oceans > Ocean Temperature > Conservative Temperature, Oceans > Salinity/Density > Salinity, reference salinity, sea water, sea_water_conservative_temperature, sea_water_reference_salinity, seawater, conservative temperature, time_counter, vosaline, votemper, water</att> <att name="license">The Salish Sea MEOPAR NEMO model results are copyright by the Salish Sea MEOPAR Project Contributors and The University of British Columbia. They are licensed under the Apache License, Version 2.0. https://www.apache.org/licenses/LICENSE-2.0</att> <att name="standard_name_vocabulary">CF Standard Name Table v29</att> <att name="summary">Green, Salish Sea, 2d Depth-averaged Tracer Fields, Seasonal, v17-02 2d depth-averaged salinity and water temperature field values averaged over 3 month seasonal intervals from Salish Sea NEMO model nowcast runs. The values are calculated for the entire model grid that includes the Juan de Fuca Strait, the Strait of Georgia, Puget Sound, and Johnstone Strait on the coasts of Washington State and British Columbia. The time values are UTC. They are the centre of the intervals over which the calculated model results are averaged. The variable values are averaged over the upper 22 layers of the model grid, approximately 0 to 30 metres depth. Geo-location and depth data for the Salish Sea NEMO model grid are available in the ubcSSnBathymetry2V17-02 dataset. v17-02: NEMO-3.6; ubcSSnBathymetryV17-02 bathymetry; see infoUrl link for full details: reference salinity and conservative temperature variables </att> <att name="title">Green, Salish Sea, 2d Depth-averaged Tracer Fields, Seasonal, v17-02</att> <att name="project">Salish Sea MEOPAR NEMO Model</att> <att name="creator_name">Salish Sea MEOPAR Project Contributors</att> <att name="creator_email">sallen@eoas.ubc.ca</att> <att name="creator_url">https://salishsea-meopar-docs.readthedocs.io/</att> <att name="acknowledgement">MEOPAR, ONC, Compute Canada</att> <att name="drawLandMask">over</att> <att name="uuid">null</att> <att name="NCO">null</att> <att name="history">null</att> <att name="name">null</att> <att name="description">depth-averaged seasonal average T grid variables</att> </addAttributes> <axisVariable> <sourceName>time_counter</sourceName> <destinationName>time</destinationName> <!-- sourceAttributes> <att name="_ChunkSizes" type="int">1</att> <att name="axis">T</att> <att name="bounds">time_counter_bounds</att> <att name="calendar">gregorian</att> <att name="cell_methods">time_counter: mean</att> <att name="long_name">Time axis</att> <att name="standard_name">time</att> <att name="time_origin">1900-01-01 00:00:00</att> <att name="units">seconds since 1900-01-01 00:00:00</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSizes">null</att> <att name="bounds">null</att> <att name="source_name">time_counter</att> <att name="coverage_content_type">modelResult</att> <att name="comment">time values are UTC at the centre of the intervals over which the calculated model results are averaged</att> <att name="ioos_category">time</att> </addAttributes> </axisVariable> <axisVariable> <sourceName>y</sourceName> <destinationName>gridY</destinationName> <!-- sourceAttributes> </sourceAttributes --> <addAttributes> <att name="long_name">Y</att> <att name="coverage_content_type">modelResult</att> <att name="ioos_category">location</att> </addAttributes> </axisVariable> <axisVariable> <sourceName>x</sourceName> <destinationName>gridX</destinationName> <!-- sourceAttributes> </sourceAttributes --> <addAttributes> <att name="long_name">X</att> <att name="coverage_content_type">modelResult</att> <att name="ioos_category">location</att> </addAttributes> </axisVariable> <dataVariable> <sourceName>vosalineoverdepth</sourceName> <destinationName>salinity</destinationName> <dataType>float</dataType> <addAttributes> <att name="_ChunkSize">null</att> <att name="coordinates">null</att> <att name="ioos_category">salinity</att> <att name="colorBarMinimum" type="double">0.0</att> <att name="colorBarMaximum" type="double">34.0</att> <att name="coverage_content_type">modelResult</att> <att name="cell_measures">null</att> <att name="cell_methods">null</att> <att name="interval_operation">null</att> <att name="interval_write">null</att> <att name="online_operation">null</att> <att name="ioos_category">salinity</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>votemperoverdepth</sourceName> <destinationName>temperature</destinationName> <dataType>float</dataType> <addAttributes> <att name="_ChunkSize">null</att> <att name="coordinates">null</att> <att name="ioos_category">temperature</att> <att name="colorBarMinimum" type="double">4.0</att> <att name="colorBarMaximum" type="double">20.0</att> <att name="coverage_content_type">modelResult</att> <att name="cell_measures">null</att> <att name="cell_methods">null</att> <att name="interval_operation">null</att> <att name="interval_write">null</att> <att name="online_operation">null</att> <att name="ioos_category">temperature</att> </addAttributes> </dataVariable> </dataset>
with open('/results/erddap-datasets/fragments/{}.xml'.format(datasetID), 'wb') as f:
f.write(etree.tostring(root, pretty_print=True))
The /opt/tomcat/webapps/erddap/WEB-INF/GenerateDatasetsXml.sh
script produces an XML
fragment that includes:
nvertex
axis variablebound_lon
and bound_lat
data variblesthat are or not value in the ERDDAP dataset.
To produce a final XML fragment we need to delete those variables.
for attr in root.findall('.//addAttributes/att[@name="institution"]'):
if attr.text == '???':
attr.getparent().remove(attr)
for axis in root.findall('.//axisVariable'):
if axis.find('.//destinationName').text == 'nvertex':
axis.getparent().remove(axis)
break
attrs = etree.SubElement(axis, 'addAttributes')
axis_name = axis.find('.//destinationName').text
etree.SubElement(attrs, 'att', name='standard_name').text = axis_name
etree.SubElement(attrs, 'att', name='long_name').text = axis_name.title()
etree.SubElement(attrs, 'att', name='colorBarMinimum').text = var_colour_ranges[axis_name]['colorBarMinimum']
etree.SubElement(attrs, 'att', name='colorBarMaximum').text = var_colour_ranges[axis_name]['colorBarMaximum']
etree.SubElement(attrs, 'att', name='coverage_content_type').text = 'modelResult'
etree.SubElement(attrs, 'att', name='ioos_category').text = ioos_categories[axis_name]
first_axis = root.find('.//axisVariable')
time_axis = etree.Element('axisVariable')
first_axis.addprevious(time_axis)
etree.SubElement(time_axis, 'sourceName').text = 'time_counter'
etree.SubElement(time_axis, 'destinationName').text = 'time'
attrs = etree.SubElement(time_axis, 'addAttributes')
etree.SubElement(attrs, 'att', name='axis').text = 'T'
etree.SubElement(attrs, 'att', name='standard_name').text = 'time'
etree.SubElement(attrs, 'att', name='long_name').text = 'Time axis'
etree.SubElement(attrs, 'att', name='calendar').text = 'gregorian'
etree.SubElement(attrs, 'att', name='units').text = 'seconds since 1900-01-01 00:00:00'
etree.SubElement(attrs, 'att', name='time_origin').text = '1900-01-01 00:00:00'
etree.SubElement(attrs, 'att', name='comment').text = (
'time values are the centre of the intervals over which the calculated model results are averaged')
etree.SubElement(attrs, 'att', name='ioos_category').text = ioos_categories['time']
etree.SubElement(attrs, 'att', name='coverage_content_type').text = 'modelResult'
for var in root.findall('.//dataVariable'):
if var.find('.//destinationName').text in ('bounds_lon', 'bounds_lat'):
var.getparent().remove(var)
print_tree(root)
<dataset type="EDDGridFromNcFiles" datasetID="ubcSSgPointAtkinsonSSH10mV17-02" active="true"> <reloadEveryNMinutes>10080</reloadEveryNMinutes> <updateEveryNMillis>10000</updateEveryNMillis> <fileDir>/results/SalishSea/hindcast/</fileDir> <recursive>true</recursive> <fileNameRegex>.*PointAtkinson\.nc$</fileNameRegex> <metadataFrom>last</metadataFrom> <matchAxisNDigits>20</matchAxisNDigits> <fileTableInMemory>false</fileTableInMemory> <accessibleViaFiles>false</accessibleViaFiles> <!-- sourceAttributes> <att name="Conventions">CF-1.6</att> <att name="description">10min interval SSH for tides</att> <att name="name">PointAtkinson</att> <att name="timeStamp">2017-Apr-27 03:52:27 GMT</att> <att name="title">10min interval SSH for tides</att> <att name="uuid">54d933e2-680b-4e67-94ad-37eaa503175a</att> </sourceAttributes --> <addAttributes> <att name="cdm_data_type">Grid</att> <att name="Conventions">CF-1.6, COARDS, ACDD-1.3</att> <att name="infoUrl">https://salishsea-meopar-docs.readthedocs.io/en/latest/results_server/index.html#salish-sea-model-results</att> <att name="institution">UBC EOAS</att> <att name="institution_fullname">Earth, Ocean & Atmospheric Sciences, University of British Columbia</att> <att name="keywords">10min, earth, geodetics, sea surface height above geoid, geoid, ocean, oceans, Oceans > Sea Surface Topography > Sea Surface Height, sea, sea_surface_height_above_geoid, sossheig, ssh, surface, tides, time_counter, topography</att> <att name="keywords_vocabulary">GCMD Science Keywords</att> <att name="license">The Salish Sea MEOPAR NEMO model results are copyright by the Salish Sea MEOPAR Project Contributors and The University of British Columbia. They are licensed under the Apache License, Version 2.0. https://www.apache.org/licenses/LICENSE-2.0</att> <att name="standard_name_vocabulary">CF Standard Name Table v29</att> <att name="summary">Green, Point Atkinson, Sea Surface Height, 10min, v17-02 Sea surface height values averaged over 10 minute intervals from Salish Sea NEMO model runs with physics and biology. The values are calculated at the model grid point closest to the Point Atkinson tide gauge station on the north side of English Bay, near Vancouver, British Columbia. The time values are the centre of the intervals over which the calculated model results are averaged. Geo-location and depth data for the Salish Sea NEMO model grid are available in the ubcSSnBathymetry2V16-07 dataset. v1: ssh variable v16-10: NEMO-3.6; ubcSSnBathymetry2V16-07 bathymetry; see infoUrl link for full details. v17-02: NEMO-3.6; ubcSSnBathymetry2V17-02 bathymetry; see infoUrl link for full details.</att> <att name="title">Green, Point Atkinson, Sea Surface Height, 10min, v17-02</att> <att name="project">Salish Sea MEOPAR NEMO Model</att> <att name="creator_name">Salish Sea MEOPAR Project Contributors</att> <att name="creator_email">sallen@eoas.ubc.ca</att> <att name="creator_url">https://salishsea-meopar-docs.readthedocs.io/</att> <att name="acknowledgement">MEOPAR, ONC, Compute Canada</att> <att name="drawLandMask">over</att> <att name="NCO">null</att> <att name="history">null</att> <att name="name">null</att> </addAttributes> <axisVariable> <sourceName>time_counter</sourceName> <destinationName>time</destinationName> <addAttributes> <att name="axis">T</att> <att name="standard_name">time</att> <att name="long_name">Time axis</att> <att name="calendar">gregorian</att> <att name="units">seconds since 1900-01-01 00:00:00</att> <att name="time_origin">1900-01-01 00:00:00</att> <att name="comment">time values are the centre of the intervals over which the calculated model results are averaged</att> <att name="ioos_category">time</att> <att name="coverage_content_type">modelResult</att> </addAttributes> </axisVariable> <axisVariable> <sourceName>nav_lon</sourceName> <destinationName>longitude</destinationName> <addAttributes> <att name="standard_name">longitude</att> <att name="long_name">Longitude</att> <att name="colorBarMinimum">-127.0</att> <att name="colorBarMaximum">-121.0</att> <att name="coverage_content_type">modelResult</att> <att name="ioos_category">location</att> </addAttributes> </axisVariable> <axisVariable> <sourceName>nav_lat</sourceName> <destinationName>latitude</destinationName> <addAttributes> <att name="standard_name">latitude</att> <att name="long_name">Latitude</att> <att name="colorBarMinimum">46.0</att> <att name="colorBarMaximum">52.0</att> <att name="coverage_content_type">modelResult</att> <att name="ioos_category">location</att> </addAttributes> </axisVariable> <dataVariable> <sourceName>sossheig</sourceName> <destinationName>ssh</destinationName> <dataType>float</dataType> <!-- sourceAttributes> <att name="_ChunkSize" type="intList">1 1 1</att> <att name="_FillValue" type="float">1.0E20</att> <att name="cell_measures">area: area</att> <att name="cell_methods">time: mean (interval: 40 s)</att> <att name="coordinates">time_centered nav_lat nav_lon</att> <att name="interval_operation">40 s</att> <att name="interval_write">600 s</att> <att name="long_name">sea surface height</att> <att name="missing_value" type="float">1.0E20</att> <att name="online_operation">average</att> <att name="standard_name">sea_surface_height_above_geoid</att> <att name="units">m</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSize">null</att> <att name="colorBarMaximum" type="double">4.0</att> <att name="colorBarMinimum" type="double">-4.0</att> <att name="coordinates">null</att> <att name="coverage_content_type">modelResult</att> <att name="cell_measures">null</att> <att name="cell_methods">null</att> <att name="interval_operation">null</att> <att name="interval_write">null</att> <att name="online_operation">null</att> <att name="ioos_category">sea_level</att> </addAttributes> </dataVariable> </dataset>
with open('/results/erddap-datasets/fragments/{}.xml'.format(datasetID), 'wb') as f:
f.write(etree.tostring(root, pretty_print=True))
root.find('.//recursive').text = 'false'
root.find(f'addAttributes/att[@name="acknowledgement"]').text = '''MEOPAR, ONC, Compute Canada, CHS, NOAA, USGS
This product has been produced by the University of British Columbia based on Canadian Hydrographic Service charts
and/or data, pursuant to CHS Direct User Licence No. 2016-0504-1260-U
The incorporation of data sourced from CHS in this product shall not be construed as constituting an endorsement of
CHS of this product.
This product does not meet the requirements of Charts and Nautical Publications Regulations,
1995 under the Canadian Shipping Act, 2001. Official charts and publications, corrected and up-to-data,
must be used to meet the requirements of those regulations.'''
attrs = root.find('.//addAttributes')
etree.SubElement(attrs, 'att', name='references').text = 'https://bitbucket.org/salishsea/nemo-forcing/raw/tip/grid/bathymetry_201702.nc'
etree.SubElement(attrs, 'att', name='comment').text = 'null'
for var in root.findall('.//dataVariable'):
for var_name in ('latitude', 'longitude'):
if var.find('.//destinationName').text == var_name:
attrs = etree.SubElement(var, 'addAttributes')
etree.SubElement(attrs, 'att', name='standard_name').text = var_name
etree.SubElement(attrs, 'att', name='long_name').text = var_name.title()
print_tree(root)
<dataset type="EDDGridFromNcFiles" datasetID="ubcSSnBathymetryV17-02" active="true"> <reloadEveryNMinutes>10080</reloadEveryNMinutes> <updateEveryNMillis>10000</updateEveryNMillis> <fileDir>/results/nowcast-sys/NEMO-forcing/grid/</fileDir> <recursive>false</recursive> <fileNameRegex>.*bathymetry_201702\.nc$</fileNameRegex> <metadataFrom>last</metadataFrom> <matchAxisNDigits>20</matchAxisNDigits> <fileTableInMemory>false</fileTableInMemory> <accessibleViaFiles>false</accessibleViaFiles> <!-- sourceAttributes> <att name="_NCProperties">version=1|netcdflibversion=4.4.1|hdf5libversion=1.8.17</att> <att name="comment">Bathymetry processed from Michaels New Full River Bathymetry</att> <att name="Conventions">CF-1.6</att> <att name="history">[2017-02-28 18:55:52] Created netCDF4 zlib=True dataset.</att> <att name="institution">Dept of Earth, Ocean & Atmospheric Sciences, University of British Columbia</att> <att name="references">REQUIRED</att> <att name="source">https://bitbucket.org/salishsea/analysis-susan/src/tip/notebooks/bathymetry/ProcessNewRiverBathymetry.ipynb</att> <att name="title">Bathymetry 201702</att> </sourceAttributes --> <addAttributes> <att name="cdm_data_type">Grid</att> <att name="Conventions">CF-1.6, COARDS, ACDD-1.3</att> <att name="creator_name">Dept of Earth, Ocean & Atmospheric Sciences, University of British Columbia</att> <att name="creator_email">sallen@eoas.ubc.ca</att> <att name="creator_url">https://salishsea-meopar-docs.readthedocs.io/</att> <att name="acknowledgement">MEOPAR, ONC, Compute Canada, CHS, NOAA, USGS This product has been produced by the University of British Columbia based on Canadian Hydrographic Service charts and/or data, pursuant to CHS Direct User Licence No. 2016-0504-1260-U The incorporation of data sourced from CHS in this product shall not be construed as constituting an endorsement of CHS of this product. This product does not meet the requirements of Charts and Nautical Publications Regulations, 1995 under the Canadian Shipping Act, 2001. Official charts and publications, corrected and up-to-data, must be used to meet the requirements of those regulations.</att> <att name="drawLandMask">over</att> <att name="infoUrl">https://salishsea-meopar-docs.readthedocs.io/en/latest/results_server/index.html#salish-sea-model-results</att> <att name="institution">UBC EOAS</att> <att name="institution_fullname">Earth, Ocean & Atmospheric Sciences, University of British Columbia</att> <att name="keywords">bathymetry, depth, nav_lat, nav_lon, ocean, oceans, Oceans > Bathymetry/Seafloor Topography > Bathymetry, Salish Sea, sea floor, sea_floor_depth, seafloor, topography</att> <att name="keywords_vocabulary">GCMD Science Keywords</att> <att name="license">The Salish Sea MEOPAR NEMO model results are copyright by the Salish Sea MEOPAR Project Contributors and The University of British Columbia. They are licensed under the Apache License, Version 2.0. https://www.apache.org/licenses/LICENSE-2.0</att> <att name="standard_name_vocabulary">CF Standard Name Table v29</att> <att name="summary">Salish Sea NEMO Model Grid, Geo-location and Bathymetry, v17-02 Longitude, latitude, and bathymetry of the Salish Sea NEMO model grid. The bathymetry values are those calculated by NEMO from the input bathymetry file. NEMO modifies the input bathymetry to remove isolated holes, and too-small partial steps; See the ubcSSn2DMeshMaskV17-02 dataset for the complete details of the calculation grid. The model grid includes the Juan de Fuca Strait, the Strait of Georgia, Puget Sound, and Johnstone Strait on the coasts of Washington State and British Columbia. v1: longitude, latitude and bathymetry variables v16-07: same variables, bathymetry uniformly deepened by 1 grid level, smoothed at Juan de Fuca & Johnstone Strait open boundaries, Fraser River lengthened, bathymetry deepened near mouth of Fraser River v17-02: same variables, Bathymetry composed from 3 datasets: * USGS Digital elevation model (DEM) of Cascadia, latitude 39N-53N, longitude 116W-133W, Open-File Report 99-369, https://pubs.er.usgs.gov/publication/ofr99369 * NOAA British Columbia, 3 arc-second MSL DEM, https://www.ngdc.noaa.gov/dem/squareCellGrid/download/4956 * CHS Multibeam data and all point cloud data for the Salish Sea. Smoothed at Juan de Fuca & Johnstone Strait open boundaries. Proxy channel for Fraser River upstream of confluence with the Pitt River. Adjustments by Michael Dunphy to make increase resolution of Fraser River channels downstream of confluence with the Pitt River. </att> <att name="title">Salish Sea NEMO Model Grid, Geo-location and Bathymetry, v17-02</att> <att name="project">Salish Sea MEOPAR NEMO Model</att> <att name="creator_name">Salish Sea MEOPAR Project Contributors</att> <att name="NCO">null</att> <att name="references">https://bitbucket.org/salishsea/nemo-forcing/raw/tip/grid/bathymetry_201702.nc</att> <att name="comment">null</att> </addAttributes> <axisVariable> <sourceName>y</sourceName> <destinationName>gridY</destinationName> <!-- sourceAttributes> </sourceAttributes --> <addAttributes> <att name="long_name">Y</att> <att name="coverage_content_type">modelResult</att> <att name="ioos_category">location</att> </addAttributes> </axisVariable> <axisVariable> <sourceName>x</sourceName> <destinationName>gridX</destinationName> <!-- sourceAttributes> </sourceAttributes --> <addAttributes> <att name="long_name">X</att> <att name="coverage_content_type">modelResult</att> <att name="ioos_category">location</att> </addAttributes> </axisVariable> <dataVariable> <sourceName>Bathymetry</sourceName> <destinationName>bathymetry</destinationName> <dataType>double</dataType> <!-- sourceAttributes> <att name="_ChunkSize" type="intList">898 398</att> <att name="_FillValue" type="double">0.0</att> <att name="least_significant_digit" type="double">0.1</att> <att name="units">metres</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSize">null</att> <att name="colorBarMaximum" type="double">450.0</att> <att name="colorBarMinimum" type="double">0.0</att> <att name="colorBarPalette">OceanDepth</att> <att name="long_name">Sea Floor Depth</att> <att name="standard_name">sea_floor_depth</att> <att name="coverage_content_type">modelResult</att> <att name="cell_measures">null</att> <att name="cell_methods">null</att> <att name="interval_operation">null</att> <att name="interval_write">null</att> <att name="online_operation">null</att> <att name="ioos_category">bathymetry</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>nav_lat</sourceName> <destinationName>latitude</destinationName> <dataType>double</dataType> <!-- sourceAttributes> <att name="_ChunkSize" type="intList">898 398</att> <att name="units">degrees_north</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSize">null</att> <att name="colorBarMaximum" type="double">52.0</att> <att name="colorBarMinimum" type="double">46.0</att> <att name="long_name">Nav Lat</att> <att name="coverage_content_type">modelResult</att> <att name="cell_measures">null</att> <att name="cell_methods">null</att> <att name="interval_operation">null</att> <att name="interval_write">null</att> <att name="online_operation">null</att> <att name="ioos_category">location</att> </addAttributes> <addAttributes> <att name="standard_name">latitude</att> <att name="long_name">Latitude</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>nav_lon</sourceName> <destinationName>longitude</destinationName> <dataType>double</dataType> <!-- sourceAttributes> <att name="_ChunkSize" type="intList">898 398</att> <att name="units">degrees_east</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSize">null</att> <att name="colorBarMaximum" type="double">-121.0</att> <att name="colorBarMinimum" type="double">-127.0</att> <att name="long_name">Nav Lon</att> <att name="coverage_content_type">modelResult</att> <att name="cell_measures">null</att> <att name="cell_methods">null</att> <att name="interval_operation">null</att> <att name="interval_write">null</att> <att name="online_operation">null</att> <att name="ioos_category">location</att> </addAttributes> <addAttributes> <att name="standard_name">longitude</att> <att name="long_name">Longitude</att> </addAttributes> </dataVariable> </dataset>
with open('/results/erddap-datasets/fragments/{}.xml'.format(datasetID), 'wb') as f:
f.write(etree.tostring(root, pretty_print=True))
root.find('.//recursive').text = 'false'
for attr in root.findall('.//addAttributes/att[@name="institution"]'):
if attr.text == '???':
attr.getparent().remove(attr)
for axis in root.findall('.//axisVariable/destinationName'):
if axis.text == 't':
axis.text = 'time'
attrs = axis.getparent().find('addAttributes')
attrs.find('att[@name="long_name"]').text = 'Time'
etree.SubElement(attrs, 'att', name='standard_name').text = 'time'
etree.SubElement(attrs, 'att', name='calendar').text = 'gregorian'
etree.SubElement(attrs, 'att', name='time_origin').text = '2014-09-12 00:30:00'
etree.SubElement(attrs, 'att', name='units').text = 'seconds since 2014-09-12 00:30:00'
for attrs in root.findall('.//dataVariable/addAttributes'):
etree.SubElement(attrs, 'att', name='ioos_category').text = 'grid_parameter'
for attr in attrs.findall('att[@name="colorBarMaximum"]'):
attr.getparent().remove(attr)
for attr in attrs.findall('att[@name="colorBarMinimum"]'):
attr.getparent().remove(attr)
print_tree(root)
<dataset type="EDDGridFromNcFiles" datasetID="ubcSSn3DMeshMaskV17-02" active="true"> <reloadEveryNMinutes>10080</reloadEveryNMinutes> <updateEveryNMillis>10000</updateEveryNMillis> <fileDir>/results/nowcast-sys/NEMO-forcing/grid/</fileDir> <recursive>false</recursive> <fileNameRegex>.*mesh_mask201702\.nc$</fileNameRegex> <metadataFrom>last</metadataFrom> <matchAxisNDigits>20</matchAxisNDigits> <fileTableInMemory>false</fileTableInMemory> <accessibleViaFiles>false</accessibleViaFiles> <!-- sourceAttributes> <att name="Conventions">CF-1.6</att> <att name="file_name">NEMO-forcing/grid/mesh_mask201702.nc</att> <att name="history">[2017-04-13 22:37] ncks -4 -L4 -O mesh_mask.nc mesh_mask201702.nc [2017-05-15 12:41] Added metadata to variable in preparation for creation of ERDDAP datasets.</att> <att name="institution">Dept of Earth, Ocean & Atmospheric Sciences, University of British Columbia</att> <att name="references">https://salishsea.eos.ubc.ca/erddap/info/ https://bitbucket.org/salishsea/nemo-forcing/src/tip/grid/bathymetery_201702.nc </att> <att name="source">NEMO-3.6 Salish Sea configuration</att> <att name="TimeStamp">13/04/2017 22:37:31 -0700</att> <att name="title">Salish Sea NEMO bathymetry_201702 Bathymetry Mesh Mask</att> </sourceAttributes --> <addAttributes> <att name="cdm_data_type">Grid</att> <att name="Conventions">CF-1.6, COARDS, ACDD-1.3</att> <att name="creator_name">Dept of Earth, Ocean & Atmospheric Sciences, University of British Columbia</att> <att name="creator_email">sallen@eoas.ubc.ca</att> <att name="creator_url">https://salishsea-meopar-docs.readthedocs.io/</att> <att name="acknowledgement">MEOPAR, ONC, Compute Canada</att> <att name="drawLandMask">over</att> <att name="creator_url">https://salishsea.eos.ubc.ca/erddap/info/ https://bitbucket.org/salishsea/nemo-forcing/src/tip/grid/bathymetery_201702.nc </att> <att name="infoUrl">https://salishsea-meopar-docs.readthedocs.io/en/latest/results_server/index.html#salish-sea-model-results</att> <att name="institution">UBC EOAS</att> <att name="institution_fullname">Earth, Ocean & Atmospheric Sciences, University of British Columbia</att> <att name="keywords">bathymetry, coordinates, dept, depth, direction, e3t, e3t_0, e3u, e3u_0, e3v, e3v_0, e3w, e3w_0, f-grid, fmask, gdept, gdept_0, gdepu, gdepv, gdepw, gdepw_0, grid, grid parameters, mesh mask, NEMO, ocean, Salish Sea, sea, spacing, t-grid, tmask, u-grid, umask, v-grid, vmask, vorticity, vorticity-grid, w, w-grid</att> <att name="license">The Salish Sea MEOPAR NEMO model results are copyright by the Salish Sea MEOPAR Project Contributors and The University of British Columbia. They are licensed under the Apache License, Version 2.0. https://www.apache.org/licenses/LICENSE-2.0</att> <att name="standard_name_vocabulary">CF Standard Name Table v29</att> <att name="summary">Salish Sea NEMO Model Grid, 3D Mesh Mask, v17-02 NEMO grid variable value for the Salish Sea NEMO model Arakawa-C grid. The values are those calculated by NEMO from the input coordinates and bathymetry files. The variable names are those used by NEMO-3.6, see the NEMO-3.6 book (http://www.nemo-ocean.eu/Media/Files/NEMO_book_V3_6.pdf) for details, or the long_name attributes of the variables for succinct descriptions of the variables. The model grid includes the Juan de Fuca Strait, the Strait of Georgia, Puget Sound, and Johnstone Strait on the coasts of Washington State and British Columbia. v1: e3t_0, e3u_0, e3v_0, e3w_0, gdept_0, gdepu, gdepv, gdepw_0, tmask, umask, vmask, fmask variables v16-07: e3t, e3u, e3v, e3w, gdept, gdepu, gdepv, gdepw, tmask, umask, vmask, fmask variables v17-02: tmask, umask, vmask, fmask, e3t_0, e3u_0, e3v_0, e3w_0, gdept_0, gdepu, gdepv, gdepw_0 variables</att> <att name="title">Salish Sea NEMO Model Grid, 3D Mesh Mask, v17-02</att> <att name="project">Salish Sea MEOPAR NEMO Model</att> <att name="creator_name">Salish Sea MEOPAR Project Contributors</att> <att name="NCO">null</att> <att name="history">null</att> <att name="name">null</att> </addAttributes> <axisVariable> <sourceName>t</sourceName> <destinationName>time</destinationName> <!-- sourceAttributes> </sourceAttributes --> <addAttributes> <att name="long_name">Time</att> <att name="coverage_content_type">modelResult</att> <att name="standard_name">time</att> <att name="calendar">gregorian</att> <att name="time_origin">2014-09-12 00:30:00</att> <att name="units">seconds since 2014-09-12 00:30:00</att> </addAttributes> </axisVariable> <axisVariable> <sourceName>z</sourceName> <destinationName>gridZ</destinationName> <!-- sourceAttributes> </sourceAttributes --> <addAttributes> <att name="long_name">Z</att> <att name="coverage_content_type">modelResult</att> <att name="ioos_category">location</att> </addAttributes> </axisVariable> <axisVariable> <sourceName>y</sourceName> <destinationName>gridY</destinationName> <!-- sourceAttributes> </sourceAttributes --> <addAttributes> <att name="long_name">Y</att> <att name="coverage_content_type">modelResult</att> <att name="ioos_category">location</att> </addAttributes> </axisVariable> <axisVariable> <sourceName>x</sourceName> <destinationName>gridX</destinationName> <!-- sourceAttributes> </sourceAttributes --> <addAttributes> <att name="long_name">X</att> <att name="coverage_content_type">modelResult</att> <att name="ioos_category">location</att> </addAttributes> </axisVariable> <dataVariable> <sourceName>tmask</sourceName> <destinationName>tmask</destinationName> <dataType>byte</dataType> <!-- sourceAttributes> <att name="_ChunkSize" type="intList">1 20 449 199</att> <att name="flag_meanings">land, water</att> <att name="flag_values">0, 1</att> <att name="long_name">mask for T-grid and W-grid</att> <att name="standard_name">tmask</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSize">null</att> <att name="coverage_content_type">modelResult</att> <att name="cell_measures">null</att> <att name="cell_methods">null</att> <att name="interval_operation">null</att> <att name="interval_write">null</att> <att name="online_operation">null</att> <att name="ioos_category">grid_parameter</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>umask</sourceName> <destinationName>umask</destinationName> <dataType>byte</dataType> <!-- sourceAttributes> <att name="_ChunkSize" type="intList">1 20 449 199</att> <att name="flag_meanings">land, water</att> <att name="flag_values">0, 1</att> <att name="long_name">mask for U-grid</att> <att name="standard_name">umask</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSize">null</att> <att name="coverage_content_type">modelResult</att> <att name="cell_measures">null</att> <att name="cell_methods">null</att> <att name="interval_operation">null</att> <att name="interval_write">null</att> <att name="online_operation">null</att> <att name="ioos_category">grid_parameter</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>vmask</sourceName> <destinationName>vmask</destinationName> <dataType>byte</dataType> <!-- sourceAttributes> <att name="_ChunkSize" type="intList">1 20 449 199</att> <att name="flag_meanings">land, water</att> <att name="flag_values">0, 1</att> <att name="long_name">mask for V-grid</att> <att name="standard_name">vmask</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSize">null</att> <att name="coverage_content_type">modelResult</att> <att name="cell_measures">null</att> <att name="cell_methods">null</att> <att name="interval_operation">null</att> <att name="interval_write">null</att> <att name="online_operation">null</att> <att name="ioos_category">grid_parameter</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>fmask</sourceName> <destinationName>fmask</destinationName> <dataType>byte</dataType> <!-- sourceAttributes> <att name="_ChunkSize" type="intList">1 20 449 199</att> <att name="flag_meanings">land, water</att> <att name="flag_values">0, 1</att> <att name="long_name">mask for vorticity-grid</att> <att name="standard_name">fmask</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSize">null</att> <att name="coverage_content_type">modelResult</att> <att name="cell_measures">null</att> <att name="cell_methods">null</att> <att name="interval_operation">null</att> <att name="interval_write">null</att> <att name="online_operation">null</att> <att name="ioos_category">grid_parameter</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>e3t_0</sourceName> <destinationName>e3t_0</destinationName> <dataType>double</dataType> <!-- sourceAttributes> <att name="_ChunkSize" type="intList">1 10 225 100</att> <att name="_FillValue" type="double">NaN</att> <att name="long_name">grid spacing on T-grid in w direction</att> <att name="standard_name">e3t_0</att> <att name="units">m</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSize">null</att> <att name="coverage_content_type">modelResult</att> <att name="cell_measures">null</att> <att name="cell_methods">null</att> <att name="interval_operation">null</att> <att name="interval_write">null</att> <att name="online_operation">null</att> <att name="ioos_category">grid_parameter</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>e3u_0</sourceName> <destinationName>e3u_0</destinationName> <dataType>double</dataType> <!-- sourceAttributes> <att name="_ChunkSize" type="intList">1 10 225 100</att> <att name="_FillValue" type="double">NaN</att> <att name="long_name">grid spacing on U-grid in w direction</att> <att name="standard_name">e3u_0</att> <att name="units">m</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSize">null</att> <att name="coverage_content_type">modelResult</att> <att name="cell_measures">null</att> <att name="cell_methods">null</att> <att name="interval_operation">null</att> <att name="interval_write">null</att> <att name="online_operation">null</att> <att name="ioos_category">grid_parameter</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>e3v_0</sourceName> <destinationName>e3v_0</destinationName> <dataType>double</dataType> <!-- sourceAttributes> <att name="_ChunkSize" type="intList">1 10 225 100</att> <att name="_FillValue" type="double">NaN</att> <att name="long_name">grid spacing on V-grid in w direction</att> <att name="standard_name">e3v_0</att> <att name="units">m</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSize">null</att> <att name="coverage_content_type">modelResult</att> <att name="cell_measures">null</att> <att name="cell_methods">null</att> <att name="interval_operation">null</att> <att name="interval_write">null</att> <att name="online_operation">null</att> <att name="ioos_category">grid_parameter</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>e3w_0</sourceName> <destinationName>e3w_0</destinationName> <dataType>double</dataType> <!-- sourceAttributes> <att name="_ChunkSize" type="intList">1 10 225 100</att> <att name="_FillValue" type="double">NaN</att> <att name="long_name">grid spacing on W-grid in w direction</att> <att name="standard_name">e3w_0</att> <att name="units">m</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSize">null</att> <att name="coverage_content_type">modelResult</att> <att name="cell_measures">null</att> <att name="cell_methods">null</att> <att name="interval_operation">null</att> <att name="interval_write">null</att> <att name="online_operation">null</att> <att name="ioos_category">grid_parameter</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>gdept_0</sourceName> <destinationName>gdept_0</destinationName> <dataType>float</dataType> <!-- sourceAttributes> <att name="_ChunkSize" type="intList">1 14 300 133</att> <att name="_FillValue" type="float">NaN</att> <att name="long_name">depth of T-grid points</att> <att name="positive">down</att> <att name="standard_name">gdept_0</att> <att name="units">m</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSize">null</att> <att name="coverage_content_type">modelResult</att> <att name="cell_measures">null</att> <att name="cell_methods">null</att> <att name="interval_operation">null</att> <att name="interval_write">null</att> <att name="online_operation">null</att> <att name="ioos_category">grid_parameter</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>gdepu</sourceName> <destinationName>gdepu</destinationName> <dataType>float</dataType> <!-- sourceAttributes> <att name="_ChunkSize" type="intList">1 14 300 133</att> <att name="_FillValue" type="float">NaN</att> <att name="long_name">depth of U-grid points</att> <att name="positive">down</att> <att name="standard_name">gdepu</att> <att name="units">m</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSize">null</att> <att name="coverage_content_type">modelResult</att> <att name="cell_measures">null</att> <att name="cell_methods">null</att> <att name="interval_operation">null</att> <att name="interval_write">null</att> <att name="online_operation">null</att> <att name="ioos_category">grid_parameter</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>gdepv</sourceName> <destinationName>gdepv</destinationName> <dataType>float</dataType> <!-- sourceAttributes> <att name="_ChunkSize" type="intList">1 14 300 133</att> <att name="_FillValue" type="float">NaN</att> <att name="long_name">depth of V-grid points</att> <att name="positive">down</att> <att name="standard_name">gdepv</att> <att name="units">m</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSize">null</att> <att name="coverage_content_type">modelResult</att> <att name="cell_measures">null</att> <att name="cell_methods">null</att> <att name="interval_operation">null</att> <att name="interval_write">null</att> <att name="online_operation">null</att> <att name="ioos_category">grid_parameter</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>gdepw_0</sourceName> <destinationName>gdepw_0</destinationName> <dataType>float</dataType> <!-- sourceAttributes> <att name="_ChunkSize" type="intList">1 14 300 133</att> <att name="_FillValue" type="float">NaN</att> <att name="long_name">depth of W-grid points</att> <att name="positive">down</att> <att name="standard_name">gdepw_0</att> <att name="units">m</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSize">null</att> <att name="coverage_content_type">modelResult</att> <att name="cell_measures">null</att> <att name="cell_methods">null</att> <att name="interval_operation">null</att> <att name="interval_write">null</att> <att name="online_operation">null</att> <att name="ioos_category">grid_parameter</att> </addAttributes> </dataVariable> </dataset>
with open('/results/erddap-datasets/fragments/{}.xml'.format(datasetID), 'wb') as f:
f.write(etree.tostring(root, pretty_print=True))
The /opt/tomcat/webapps/erddap/WEB-INF/GenerateDatasetsXml.sh
script produces an XML fragment
that contains only the variables with the greatest number of dimensions
((t, z, y, x) variables in the case of the mesh mask).
We have to remove those variables,
and the z axis variable,
and add the (t, y, x) variables with code:
tzyx_vars = 'tmask umask vmask fmask e3t_0 e3u_0 e3v_0 e3w_0 gdept_0 gdepu gdepv gdepw_0'.split()
for var in root.findall('.//dataVariable/sourceName'):
if var.text in tzyx_vars:
root.remove(var.getparent())
for axis in root.findall('.//axisVariable/sourceName'):
if axis.text == 'z':
root.remove(axis.getparent())
mask_vars = {
'tmaskutil': 'dry land mask for T-grid and W-grid',
'umaskutil': 'dry land mask for U-grid',
'vmaskutil': 'dry land mask for V-grid',
'fmaskutil': 'dry land mask for vorticity-grid',
}
float_vars = {
'glamt': 'longitude of T-grid points',
'glamu': 'longitude of U-grid points',
'glamv': 'longitude of V-grid points',
'glamf': 'longitude of vorticity-grid points',
'gphit': 'latitude of T-grid points',
'gphiu': 'latitude of U-grid points',
'gphiv': 'latitude of V-grid points',
'gphif': 'latitude of vorticity-grid points',
}
double_vars = {
'e1t': 'grid spacing on T-grid in u direction',
'e1u': 'grid spacing on U-grid in u direction',
'e1v': 'grid spacing on V-grid in u direction',
'e1f': 'grid spacing on vorticity-grid in u direction',
'e2t': 'grid spacing on T-grid in v direction',
'e2u': 'grid spacing on U-grid in v direction',
'e2v': 'grid spacing on V-grid in v direction',
'e2f': 'grid spacing on vorticity-grid in v direction',
'ff': 'Coriolis parameter on vorticity-grid',
}
root.find('.//recursive').text = 'false'
for attr in root.findall('.//addAttributes/att[@name="institution"]'):
if attr.text == '???':
attr.getparent().remove(attr)
for axis in root.findall('.//axisVariable/destinationName'):
if axis.text == 't':
axis.text = 'time'
attrs = axis.getparent().find('addAttributes')
attrs.find('att[@name="long_name"]').text = 'Time'
etree.SubElement(attrs, 'att', name='standard_name').text = 'time'
etree.SubElement(attrs, 'att', name='calendar').text = 'gregorian'
etree.SubElement(attrs, 'att', name='time_origin').text = '2014-09-12 00:30:00'
etree.SubElement(attrs, 'att', name='units').text = 'seconds since 2014-09-12 00:30:00'
def add_dataVariable(std_name, long_name, data_type):
data_var = etree.SubElement(root, 'dataVariable')
etree.SubElement(data_var, 'sourceName').text = std_name
etree.SubElement(data_var, 'destinationName').text = std_name
etree.SubElement(data_var, 'dataType').text = data_type
attrs = etree.SubElement(data_var, 'addAttributes')
etree.SubElement(attrs, 'att', name='standard_name').text = std_name
etree.SubElement(attrs, 'att', name='long_name').text = long_name
etree.SubElement(attrs, 'att', name='ioos_category').text = 'grid_parameter'
etree.SubElement(attrs, 'att', name='content_coverage_type').text = 'modelResult'
return attrs
for std_name, long_name in mask_vars.items():
attrs = add_dataVariable(std_name, long_name, 'byte')
etree.SubElement(attrs, 'att', name='flag_meanings').text = 'land, water'
etree.SubElement(attrs, 'att', name='flag_values').text = '0, 1'
for std_name, long_name in float_vars.items():
attrs = add_dataVariable(std_name, long_name, 'float')
if long_name.startswith('longitude'):
etree.SubElement(attrs, 'att', name='units').text = 'degrees_east'
else:
etree.SubElement(attrs, 'att', name='units').text = 'degrees_north'
for std_name, long_name in double_vars.items():
attrs = add_dataVariable(std_name, long_name, 'double')
if std_name == 'ff':
etree.SubElement(attrs, 'att', name='units').text = 's-1'
else:
etree.SubElement(attrs, 'att', name='units').text = 'm'
attrs = add_dataVariable('mbathy', 'fortran index of deepest water cell, T-grid', 'short')
etree.SubElement(attrs, 'att', name='units').text = 'count'
print_tree(root)
<dataset type="EDDGridFromNcFiles" datasetID="ubcSSn2DMeshMaskV17-02" active="true"> <reloadEveryNMinutes>10080</reloadEveryNMinutes> <updateEveryNMillis>10000</updateEveryNMillis> <fileDir>/results/nowcast-sys/NEMO-forcing/grid/</fileDir> <recursive>false</recursive> <fileNameRegex>.*mesh_mask201702\.nc$</fileNameRegex> <metadataFrom>last</metadataFrom> <matchAxisNDigits>20</matchAxisNDigits> <fileTableInMemory>false</fileTableInMemory> <accessibleViaFiles>false</accessibleViaFiles> <!-- sourceAttributes> <att name="Conventions">CF-1.6</att> <att name="file_name">NEMO-forcing/grid/mesh_mask201702.nc</att> <att name="history">[2017-04-13 22:37] ncks -4 -L4 -O mesh_mask.nc mesh_mask201702.nc [2017-05-15 12:41] Added metadata to variable in preparation for creation of ERDDAP datasets.</att> <att name="institution">Dept of Earth, Ocean & Atmospheric Sciences, University of British Columbia</att> <att name="references">https://salishsea.eos.ubc.ca/erddap/info/ https://bitbucket.org/salishsea/nemo-forcing/src/tip/grid/bathymetery_201702.nc </att> <att name="source">NEMO-3.6 Salish Sea configuration</att> <att name="TimeStamp">13/04/2017 22:37:31 -0700</att> <att name="title">Salish Sea NEMO bathymetry_201702 Bathymetry Mesh Mask</att> </sourceAttributes --> <addAttributes> <att name="cdm_data_type">Grid</att> <att name="Conventions">CF-1.6, COARDS, ACDD-1.3</att> <att name="creator_name">Dept of Earth, Ocean & Atmospheric Sciences, University of British Columbia</att> <att name="creator_email">sallen@eoas.ubc.ca</att> <att name="creator_url">https://salishsea-meopar-docs.readthedocs.io/</att> <att name="acknowledgement">MEOPAR, ONC, Compute Canada</att> <att name="drawLandMask">over</att> <att name="creator_url">https://salishsea.eos.ubc.ca/erddap/info/ https://bitbucket.org/salishsea/nemo-forcing/src/tip/grid/bathymetery_201702.nc </att> <att name="infoUrl">https://salishsea-meopar-docs.readthedocs.io/en/latest/results_server/index.html#salish-sea-model-results</att> <att name="institution">UBC EOAS</att> <att name="institution_fullname">Earth, Ocean & Atmospheric Sciences, University of British Columbia</att> <att name="keywords">bathymetry, coordinates, depth, e1t, e1u, e1v, e1f, e2t, e2u, e2v, e2f, ff, f-grid, fmaskutil, glamt, glamu, glamv, glamf, gphit, gphiu, gphiv, gphif, grid, grid parameters, mbathy, mesh mask, NEMO, ocean, Salish Sea, sea, spacing, t-grid, tmaskutil, u-grid, umaskutil, v-grid, vmaskutil, vorticity-grid</att> <att name="license">The Salish Sea MEOPAR NEMO model results are copyright by the Salish Sea MEOPAR Project Contributors and The University of British Columbia. They are licensed under the Apache License, Version 2.0. https://www.apache.org/licenses/LICENSE-2.0</att> <att name="standard_name_vocabulary">CF Standard Name Table v29</att> <att name="summary">Salish Sea NEMO Model Grid, 2D Mesh Mask, v17-02 NEMO grid variable value for the u-v plane of the Salish Sea NEMO model Arakawa-C grid. The values are those calculated by NEMO from the input coordinates and bathymetry files. The variable names are those used by NEMO-3.6, see the NEMO-3.6 book (http://www.nemo-ocean.eu/Media/Files/NEMO_book_V3_6.pdf) for details, or the long_name attributes of the variables for succinct descriptions of the variables. The model grid includes the Juan de Fuca Strait, the Strait of Georgia, Puget Sound, and Johnstone Strait on the coasts of Washington State and British Columbia. v1: e1t, e2t, e1u, e2u, e1v, e2v, e1f, e2f, glamt, gphit, glamu, gphiu, glamv, gphiv, tmaskutil, umaskutil, vmaskutil, fmaskutil, ff, mbathy variables v16-07: e1t, e2t, e1u, e2u, e1v, e2v, e1f, e2f, glamt, gphit, glamu, gphiu, glamv, gphiv, glamf, gphif, tmaskutil, umaskutil, vmaskutil, fmaskutil, ff, mbathy variables v17-02: tmaskutil, umaskutil, vmaskutil, fmaskutil, glamt, glamu, glamv, glamf, gphit, gphiu, gphiv, gphif, e1t, e1u, e1v, e1f, e2t, e2u, e2v, e2f, ff, mbathy variables</att> <att name="title">Salish Sea NEMO Model Grid, 2D Mesh Mask, v17-02</att> <att name="project">Salish Sea MEOPAR NEMO Model</att> <att name="creator_name">Salish Sea MEOPAR Project Contributors</att> <att name="NCO">null</att> <att name="history">null</att> <att name="name">null</att> </addAttributes> <axisVariable> <sourceName>t</sourceName> <destinationName>time</destinationName> <!-- sourceAttributes> </sourceAttributes --> <addAttributes> <att name="long_name">Time</att> <att name="coverage_content_type">modelResult</att> <att name="standard_name">time</att> <att name="calendar">gregorian</att> <att name="time_origin">2014-09-12 00:30:00</att> <att name="units">seconds since 2014-09-12 00:30:00</att> </addAttributes> </axisVariable> <axisVariable> <sourceName>y</sourceName> <destinationName>gridY</destinationName> <!-- sourceAttributes> </sourceAttributes --> <addAttributes> <att name="long_name">Y</att> <att name="coverage_content_type">modelResult</att> <att name="ioos_category">location</att> </addAttributes> </axisVariable> <axisVariable> <sourceName>x</sourceName> <destinationName>gridX</destinationName> <!-- sourceAttributes> </sourceAttributes --> <addAttributes> <att name="long_name">X</att> <att name="coverage_content_type">modelResult</att> <att name="ioos_category">location</att> </addAttributes> </axisVariable> <dataVariable> <sourceName>tmaskutil</sourceName> <destinationName>tmaskutil</destinationName> <dataType>byte</dataType> <addAttributes> <att name="standard_name">tmaskutil</att> <att name="long_name">dry land mask for T-grid and W-grid</att> <att name="ioos_category">grid_parameter</att> <att name="content_coverage_type">modelResult</att> <att name="flag_meanings">land, water</att> <att name="flag_values">0, 1</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>umaskutil</sourceName> <destinationName>umaskutil</destinationName> <dataType>byte</dataType> <addAttributes> <att name="standard_name">umaskutil</att> <att name="long_name">dry land mask for U-grid</att> <att name="ioos_category">grid_parameter</att> <att name="content_coverage_type">modelResult</att> <att name="flag_meanings">land, water</att> <att name="flag_values">0, 1</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>vmaskutil</sourceName> <destinationName>vmaskutil</destinationName> <dataType>byte</dataType> <addAttributes> <att name="standard_name">vmaskutil</att> <att name="long_name">dry land mask for V-grid</att> <att name="ioos_category">grid_parameter</att> <att name="content_coverage_type">modelResult</att> <att name="flag_meanings">land, water</att> <att name="flag_values">0, 1</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>fmaskutil</sourceName> <destinationName>fmaskutil</destinationName> <dataType>byte</dataType> <addAttributes> <att name="standard_name">fmaskutil</att> <att name="long_name">dry land mask for vorticity-grid</att> <att name="ioos_category">grid_parameter</att> <att name="content_coverage_type">modelResult</att> <att name="flag_meanings">land, water</att> <att name="flag_values">0, 1</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>glamt</sourceName> <destinationName>glamt</destinationName> <dataType>float</dataType> <addAttributes> <att name="standard_name">glamt</att> <att name="long_name">longitude of T-grid points</att> <att name="ioos_category">grid_parameter</att> <att name="content_coverage_type">modelResult</att> <att name="units">degrees_east</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>glamu</sourceName> <destinationName>glamu</destinationName> <dataType>float</dataType> <addAttributes> <att name="standard_name">glamu</att> <att name="long_name">longitude of U-grid points</att> <att name="ioos_category">grid_parameter</att> <att name="content_coverage_type">modelResult</att> <att name="units">degrees_east</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>glamv</sourceName> <destinationName>glamv</destinationName> <dataType>float</dataType> <addAttributes> <att name="standard_name">glamv</att> <att name="long_name">longitude of V-grid points</att> <att name="ioos_category">grid_parameter</att> <att name="content_coverage_type">modelResult</att> <att name="units">degrees_east</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>glamf</sourceName> <destinationName>glamf</destinationName> <dataType>float</dataType> <addAttributes> <att name="standard_name">glamf</att> <att name="long_name">longitude of vorticity-grid points</att> <att name="ioos_category">grid_parameter</att> <att name="content_coverage_type">modelResult</att> <att name="units">degrees_east</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>gphit</sourceName> <destinationName>gphit</destinationName> <dataType>float</dataType> <addAttributes> <att name="standard_name">gphit</att> <att name="long_name">latitude of T-grid points</att> <att name="ioos_category">grid_parameter</att> <att name="content_coverage_type">modelResult</att> <att name="units">degrees_north</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>gphiu</sourceName> <destinationName>gphiu</destinationName> <dataType>float</dataType> <addAttributes> <att name="standard_name">gphiu</att> <att name="long_name">latitude of U-grid points</att> <att name="ioos_category">grid_parameter</att> <att name="content_coverage_type">modelResult</att> <att name="units">degrees_north</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>gphiv</sourceName> <destinationName>gphiv</destinationName> <dataType>float</dataType> <addAttributes> <att name="standard_name">gphiv</att> <att name="long_name">latitude of V-grid points</att> <att name="ioos_category">grid_parameter</att> <att name="content_coverage_type">modelResult</att> <att name="units">degrees_north</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>gphif</sourceName> <destinationName>gphif</destinationName> <dataType>float</dataType> <addAttributes> <att name="standard_name">gphif</att> <att name="long_name">latitude of vorticity-grid points</att> <att name="ioos_category">grid_parameter</att> <att name="content_coverage_type">modelResult</att> <att name="units">degrees_north</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>e1t</sourceName> <destinationName>e1t</destinationName> <dataType>double</dataType> <addAttributes> <att name="standard_name">e1t</att> <att name="long_name">grid spacing on T-grid in u direction</att> <att name="ioos_category">grid_parameter</att> <att name="content_coverage_type">modelResult</att> <att name="units">m</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>e1u</sourceName> <destinationName>e1u</destinationName> <dataType>double</dataType> <addAttributes> <att name="standard_name">e1u</att> <att name="long_name">grid spacing on U-grid in u direction</att> <att name="ioos_category">grid_parameter</att> <att name="content_coverage_type">modelResult</att> <att name="units">m</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>e1v</sourceName> <destinationName>e1v</destinationName> <dataType>double</dataType> <addAttributes> <att name="standard_name">e1v</att> <att name="long_name">grid spacing on V-grid in u direction</att> <att name="ioos_category">grid_parameter</att> <att name="content_coverage_type">modelResult</att> <att name="units">m</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>e1f</sourceName> <destinationName>e1f</destinationName> <dataType>double</dataType> <addAttributes> <att name="standard_name">e1f</att> <att name="long_name">grid spacing on vorticity-grid in u direction</att> <att name="ioos_category">grid_parameter</att> <att name="content_coverage_type">modelResult</att> <att name="units">m</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>e2t</sourceName> <destinationName>e2t</destinationName> <dataType>double</dataType> <addAttributes> <att name="standard_name">e2t</att> <att name="long_name">grid spacing on T-grid in v direction</att> <att name="ioos_category">grid_parameter</att> <att name="content_coverage_type">modelResult</att> <att name="units">m</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>e2u</sourceName> <destinationName>e2u</destinationName> <dataType>double</dataType> <addAttributes> <att name="standard_name">e2u</att> <att name="long_name">grid spacing on U-grid in v direction</att> <att name="ioos_category">grid_parameter</att> <att name="content_coverage_type">modelResult</att> <att name="units">m</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>e2v</sourceName> <destinationName>e2v</destinationName> <dataType>double</dataType> <addAttributes> <att name="standard_name">e2v</att> <att name="long_name">grid spacing on V-grid in v direction</att> <att name="ioos_category">grid_parameter</att> <att name="content_coverage_type">modelResult</att> <att name="units">m</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>e2f</sourceName> <destinationName>e2f</destinationName> <dataType>double</dataType> <addAttributes> <att name="standard_name">e2f</att> <att name="long_name">grid spacing on vorticity-grid in v direction</att> <att name="ioos_category">grid_parameter</att> <att name="content_coverage_type">modelResult</att> <att name="units">m</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>ff</sourceName> <destinationName>ff</destinationName> <dataType>double</dataType> <addAttributes> <att name="standard_name">ff</att> <att name="long_name">Coriolis parameter on vorticity-grid</att> <att name="ioos_category">grid_parameter</att> <att name="content_coverage_type">modelResult</att> <att name="units">s-1</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>mbathy</sourceName> <destinationName>mbathy</destinationName> <dataType>short</dataType> <addAttributes> <att name="standard_name">mbathy</att> <att name="long_name">fortran index of deepest water cell, T-grid</att> <att name="ioos_category">grid_parameter</att> <att name="content_coverage_type">modelResult</att> <att name="units">count</att> </addAttributes> </dataVariable> </dataset>
with open('/results/erddap-datasets/fragments/{}.xml'.format(datasetID), 'wb') as f:
f.write(etree.tostring(root, pretty_print=True))
Use the /opt/tomcat/webapps/erddap/WEB-INF/GenerateDatasetsXml.sh
script
generate the initial version of an XML fragment for the dataset:
$ cd /opt/tomcat/webapps/erddap/WEB-INF/
$ bash GenerateDatasetsXml.sh EDDGridFromNcFiles /results/forcing/atmospheric/GEM2.5/operational/ ops_y\d{4}m\d{2}d\d{2}.nc$ /results/forcing/atmospheric/GEM2.5/operational/ops_y2016m03d07.nc 10080
Like the model grid geo-location and bathymetry dataset, the atmospheric forcing grid dataset requires a lot of hand editing. Here is the finished dataset:
parser = etree.XMLParser(remove_blank_text=True)
tree = etree.parse('/results/erddap-datasets/fragments/ubcSSaAtmosphereGridV1.xml', parser)
root = tree.getroot()
print_tree(root)
<dataset type="EDDGridFromNcFiles" datasetID="ubcSSaAtmosphereGridV1" active="true"> <reloadEveryNMinutes>10080</reloadEveryNMinutes> <updateEveryNMillis>10000</updateEveryNMillis> <fileDir>/results/forcing/atmospheric/GEM2.5/operational/</fileDir> <recursive>false</recursive> <fileNameRegex>ops_y2016m03d07.nc$</fileNameRegex> <metadataFrom>last</metadataFrom> <matchAxisNDigits>20</matchAxisNDigits> <fileTableInMemory>false</fileTableInMemory> <accessibleViaFiles>false</accessibleViaFiles> <!-- sourceAttributes> <att name="Conventions">CF-1.0</att> <att name="GRIB2_grid_template" type="int">20</att> <att name="History">Mon Mar 7 10:07:34 2016: ncks -4 -L4 -O /results/forcing/atmospheric/GEM2.5/operational/ops_y2016m03d07.nc /results/forcing/atmospheric/GEM2.5/operational/ops_y2016m03d07.nc created by wgrib2</att> <att name="NCO">4.4.2</att> </sourceAttributes --> <addAttributes> <att name="cdm_data_type">Grid</att> <att name="coverage_content_type">modelResult</att> <att name="Conventions">CF-1.6, COARDS, ACDD-1.3</att> <att name="History">null</att> <att name="history">Mon Mar 7 10:07:34 2016: ncks -4 -L4 -O /results/forcing/atmospheric/GEM2.5/operational/ops_y2016m03d07.nc /results/forcing/atmospheric/GEM2.5/operational/ops_y2016m03d07.nc created by wgrib2</att> <att name="infoUrl">https://salishsea-meopar-tools.readthedocs.org/en/latest/results_server/index.html#salish-sea-model-results</att> <att name="institution">UBC EOAS</att> <att name="institution_fullname">Earth, Ocean & Atmospheric Sciences, University of British Columbia</att> <att name="creator_name">Dept of Earth, Ocean & Atmospheric Sciences, University of British Columbia</att> <att name="keywords">atmosphere, model results, HRDPS, latitude, longitude, salishsea</att> <att name="keywords_vocabulary">GCMD Science Keywords</att> <att name="license">The Salish Sea MEOPAR NEMO model results are copyright 2013-2016 by the Salish Sea MEOPAR Project Contributors and The University of British Columbia. They are licensed under the Apache License, Version 2.0. http://www.apache.org/licenses/LICENSE-2.0 This dataset is derived from a product of the Environment Canada HRDPS (High Resolution Deterministic Prediction System) model. The Terms and conditions of use of Meteorological Data from Environment Canada are available at http://dd.weather.gc.ca/doc/LICENCE_GENERAL.txt.</att> <att name="standard_name_vocabulary">CF Standard Name Table v29</att> <att name="summary">HRDPS, Salish Sea, Atmospheric Forcing Grid, Geo-location, v1 Longitude and latitude of the Environment Canada HRDPS atmospheric forcing model grid that is used to for the Salish Sea NEMO model. The model grid includes the Juan de Fuca Strait, the Strait of Georgia, Puget Sound, and Johnstone Strait on the coasts of Washington State and British Columbia. v1: longitude and latitude</att> <att name="title">HRDPS, Salish Sea, Atmospheric Forcing Grid, Geo-location, v1</att> <att name="project">Salish Sea MEOPAR NEMO Model</att> <att name="creator_name">Salish Sea MEOPAR Project Contributors</att> <att name="creator_email">sallen@eos.ubc.ca</att> <att name="creator_url">https://salishsea-meopar-docs.readthedocs.org/</att> <att name="acknowledgement">Environment Canada, MEOPAR, ONC, Compute Canada</att> <att name="drawLandMask">over</att> </addAttributes> <axisVariable> <sourceName>y</sourceName> <destinationName>gridY</destinationName> <addAttributes> <att name="long_name">Y</att> </addAttributes> </axisVariable> <axisVariable> <sourceName>x</sourceName> <destinationName>gridX</destinationName> <addAttributes> <att name="long_name">X</att> </addAttributes> </axisVariable> <dataVariable> <sourceName>nav_lon</sourceName> <destinationName>longitude</destinationName> <dataType>float</dataType> <addAttributes> <att name="standard_name">longitude</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>nav_lat</sourceName> <destinationName>latitude</destinationName> <dataType>float</dataType> <addAttributes> <att name="standard_name">latitude</att> </addAttributes> </dataVariable> </dataset>
recursive
element to false
so that the /results/forcing/atmospheric/GEM2.5/operational/fcst/
directory is excludedlicense
elementacknowledgement
elementroot.find('.//recursive').text = 'false'
find_att(root, 'license').text += '''
This dataset is derived from a product of the Environment Canada HRDPS (High Resolution Deterministic Prediction System)
model. The Terms and conditions of use of Meteorological Data from Environment Canada are available at
http://dd.weather.gc.ca/doc/LICENCE_GENERAL.txt.</att>'''
find_att(root, 'acknowledgement').text += ', Environment Canada'
for axis in root.findall('.//axisVariable'):
axis_name = axis.find('.//sourceName').text
if 'time' not in axis_name:
attrs = axis.find('.//addAttributes')
etree.SubElement(attrs, 'att', name='grid_spacing').text = 'null'
etree.SubElement(attrs, 'att', name='units').text = 'null'
etree.SubElement(attrs, 'att', name='long_name').text = axis_name.upper()
etree.SubElement(attrs, 'att', name='standard_name').text = axis_name
print_tree(root)
<dataset type="EDDGridFromNcFiles" datasetID="ubcSSaSurfaceAtmosphereFieldsV1" active="true"> <reloadEveryNMinutes>10080</reloadEveryNMinutes> <updateEveryNMillis>10000</updateEveryNMillis> <fileDir>/results/forcing/atmospheric/GEM2.5/operational/</fileDir> <recursive>false</recursive> <fileNameRegex>.*ops_y\d{4}m\d{2}d\d{2}\.nc$</fileNameRegex> <metadataFrom>last</metadataFrom> <matchAxisNDigits>20</matchAxisNDigits> <fileTableInMemory>false</fileTableInMemory> <accessibleViaFiles>false</accessibleViaFiles> <!-- sourceAttributes> <att name="Conventions">CF-1.0</att> <att name="GRIB2_grid_template" type="int">20</att> <att name="History">Thu Mar 10 10:11:37 2016: ncks -4 -L4 -O /results/forcing/atmospheric/GEM2.5/operational/ops_y2016m03d10.nc /results/forcing/atmospheric/GEM2.5/operational/ops_y2016m03d10.nc created by wgrib2</att> <att name="NCO">4.4.2</att> </sourceAttributes --> <addAttributes> <att name="cdm_data_type">Grid</att> <att name="coverage_content_type">modelResult</att> <att name="Conventions">CF-1.6, COARDS, ACDD-1.3</att> <att name="History">null</att> <att name="history">Thu Mar 10 10:11:37 2016: ncks -4 -L4 -O /results/forcing/atmospheric/GEM2.5/operational/ops_y2016m03d10.nc /results/forcing/atmospheric/GEM2.5/operational/ops_y2016m03d10.nc created by wgrib2</att> <att name="infoUrl">https://salishsea-meopar-tools.readthedocs.org/en/latest/results_server/index.html#salish-sea-model-results</att> <att name="institution">UBC EOAS</att> <att name="institution_fullname">Earth, Ocean & Atmospheric Sciences, University of British Columbia</att> <att name="keywords">atmosphere, Atmosphere > Atmospheric Water Vapor > Humidity, atmospheric, atmpres, component, data, downward, flux, humidity, level, local, long, long-wave, mean, msl, precipitation, pressure, qair, rad, radiation, rain, rainfall, reduced, sea, seawater, short, short-wave, solar, source, specific, specific_humidity, tair, temperature, therm_rad, time_counter, total, u-component, u_wind, v-component, v_wind, vapor, water, wave, wind</att> <att name="keywords_vocabulary">GCMD Science Keywords</att> <att name="license">The Salish Sea MEOPAR NEMO model results are copyright 2013-2016 by the Salish Sea MEOPAR Project Contributors and The University of British Columbia. They are licensed under the Apache License, Version 2.0. http://www.apache.org/licenses/LICENSE-2.0 This dataset is derived from a product of the Environment Canada HRDPS (High Resolution Deterministic Prediction System) model. The Terms and conditions of use of Meteorological Data from Environment Canada are available at http://dd.weather.gc.ca/doc/LICENCE_GENERAL.txt.</att></att> <att name="standard_name_vocabulary">CF Standard Name Table v29</att> <att name="summary">HRDPS, Salish Sea, Atmospheric Forcing Fields, Hourly, v1 2d hourly atmospheric field values from the Environment Canada HRDPS atmospheric forcing model that are used to force the Salish Sea NEMO model. The model grid includes the Juan de Fuca Strait, the Strait of Georgia, Puget Sound, and Johnstone Strait on the coasts of Washington State and British Columbia. Geo-location data for the atmospheric forcing grid are available in the ubcSSaAtmosphereGridV1 dataset. Atmospheric field values are interpolated on to the Salish Sea NEMO model grid (ubcSSnBathymetry2V1 dataset) on-the-fly by NEMO. v1: atmospheric pressure, precipitation rate, 2m specific humidity, 2m air temperature, short-wave radiation flux, long-wave radiation flux, 10m u wind component, 10m v wind component variables</att> <att name="title">HRDPS, Salish Sea, Atmospheric Forcing Fields, Hourly, v1</att> <att name="project">Salish Sea MEOPAR NEMO Model</att> <att name="creator_name">Salish Sea MEOPAR Project Contributors</att> <att name="creator_email">sallen@eos.ubc.ca</att> <att name="creator_url">https://salishsea-meopar-docs.readthedocs.org/</att> <att name="acknowledgement">MEOPAR, ONC, Compute Canada, Environment Canada</att> <att name="drawLandMask">over</att> </addAttributes> <axisVariable> <sourceName>time_counter</sourceName> <destinationName>time</destinationName> <!-- sourceAttributes> <att name="_ChunkSize" type="int">1</att> <att name="long_name">verification time generated by wgrib2 function verftime()</att> <att name="reference_date">2016.03.09 18:00:00 UTC</att> <att name="reference_time" type="double">1.4575464E9</att> <att name="reference_time_description">kind of product unclear, reference date is variable, min found reference date is given</att> <att name="reference_time_type" type="int">0</att> <att name="time_origin">1970-Jan-01 00:00:00</att> <att name="time_step" type="double">3600.0</att> <att name="time_step_setting">auto</att> <att name="units">seconds since 1970-01-01 00:00:00.0 0:00</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSize">null</att> <att name="standard_name">time</att> </addAttributes> </axisVariable> <axisVariable> <sourceName>y</sourceName> <destinationName>gridY</destinationName> <!-- sourceAttributes> <att name="_ChunkSize" type="int">266</att> <att name="grid_spacing" type="double">2500.0</att> <att name="long_name">y coordinate of projection</att> <att name="standard_name">projection_y_coordinate</att> <att name="units">m</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSize">null</att> <att name="grid_spacing">null</att> <att name="units">null</att> <att name="long_name">Y</att> <att name="standard_name">y</att> </addAttributes> </axisVariable> <axisVariable> <sourceName>x</sourceName> <destinationName>gridX</destinationName> <!-- sourceAttributes> <att name="_ChunkSize" type="int">256</att> <att name="grid_spacing" type="double">2500.0</att> <att name="long_name">x coordinate of projection</att> <att name="standard_name">projection_x_coordinate</att> <att name="units">m</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSize">null</att> <att name="grid_spacing">null</att> <att name="units">null</att> <att name="long_name">X</att> <att name="standard_name">x</att> </addAttributes> </axisVariable> <dataVariable> <sourceName>atmpres</sourceName> <destinationName>atmpres</destinationName> <dataType>float</dataType> <!-- sourceAttributes> <att name="_ChunkSize" type="intList">1 266 256</att> <att name="_FillValue" type="float">9.999E20</att> <att name="coordinates">longitude latitude</att> <att name="level">mean sea level</att> <att name="long_name">Pressure Reduced to MSL</att> <att name="short_name">PRMSL_meansealevel</att> <att name="units">Pa</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSize">null</att> <att name="coordinates">null</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>precip</sourceName> <destinationName>precip</destinationName> <dataType>float</dataType> <!-- sourceAttributes> <att name="_ChunkSize" type="intList">1 266 256</att> <att name="_FillValue" type="float">9.999E20</att> <att name="coordinates">longitude latitude</att> <att name="level">surface</att> <att name="long_name">Total Precipitation</att> <att name="short_name">APCP_surface</att> <att name="units">kg/m^2</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSize">null</att> <att name="colorBarMaximum" type="double">200.0</att> <att name="colorBarMinimum" type="double">0.0</att> <att name="coordinates">null</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>qair</sourceName> <destinationName>qair</destinationName> <dataType>float</dataType> <!-- sourceAttributes> <att name="_ChunkSize" type="intList">1 266 256</att> <att name="_FillValue" type="float">9.999E20</att> <att name="coordinates">longitude latitude</att> <att name="level">2 m above ground</att> <att name="long_name">Specific Humidity</att> <att name="short_name">SPFH_2maboveground</att> <att name="units">kg/kg</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSize">null</att> <att name="colorBarMaximum" type="double">128.0</att> <att name="colorBarMinimum" type="double">0.0</att> <att name="coordinates">null</att> <att name="standard_name">specific_humidity</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>solar</sourceName> <destinationName>solar</destinationName> <dataType>float</dataType> <!-- sourceAttributes> <att name="_ChunkSize" type="intList">1 266 256</att> <att name="_FillValue" type="float">9.999E20</att> <att name="coordinates">longitude latitude</att> <att name="level">surface</att> <att name="long_name">Downward Short-Wave Radiation Flux</att> <att name="short_name">DSWRF_surface</att> <att name="units">W/m^2</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSize">null</att> <att name="colorBarMaximum" type="double">500.0</att> <att name="colorBarMinimum" type="double">-500.0</att> <att name="coordinates">null</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>tair</sourceName> <destinationName>tair</destinationName> <dataType>float</dataType> <!-- sourceAttributes> <att name="_ChunkSize" type="intList">1 266 256</att> <att name="_FillValue" type="float">9.999E20</att> <att name="coordinates">longitude latitude</att> <att name="level">2 m above ground</att> <att name="long_name">Temperature</att> <att name="short_name">TMP_2maboveground</att> <att name="units">K</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSize">null</att> <att name="colorBarMaximum" type="double">313.0</att> <att name="colorBarMinimum" type="double">263.0</att> <att name="coordinates">null</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>therm_rad</sourceName> <destinationName>therm_rad</destinationName> <dataType>float</dataType> <!-- sourceAttributes> <att name="_ChunkSize" type="intList">1 266 256</att> <att name="_FillValue" type="float">9.999E20</att> <att name="coordinates">longitude latitude</att> <att name="level">surface</att> <att name="long_name">Downward Long-Wave Rad. Flux</att> <att name="short_name">DLWRF_surface</att> <att name="units">W/m^2</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSize">null</att> <att name="coordinates">null</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>u_wind</sourceName> <destinationName>u_wind</destinationName> <dataType>float</dataType> <!-- sourceAttributes> <att name="_ChunkSize" type="intList">1 266 256</att> <att name="_FillValue" type="float">9.999E20</att> <att name="coordinates">longitude latitude</att> <att name="level">10 m above ground</att> <att name="long_name">U-Component of Wind</att> <att name="short_name">UGRD_10maboveground</att> <att name="units">m/s</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSize">null</att> <att name="coordinates">null</att> </addAttributes> </dataVariable> <dataVariable> <sourceName>v_wind</sourceName> <destinationName>v_wind</destinationName> <dataType>float</dataType> <!-- sourceAttributes> <att name="_ChunkSize" type="intList">1 266 256</att> <att name="_FillValue" type="float">9.999E20</att> <att name="coordinates">longitude latitude</att> <att name="level">10 m above ground</att> <att name="long_name">V-Component of Wind</att> <att name="short_name">VGRD_10maboveground</att> <att name="units">m/s</att> </sourceAttributes --> <addAttributes> <att name="_ChunkSize">null</att> <att name="coordinates">null</att> </addAttributes> </dataVariable> </dataset>
with open('/results/erddap-datasets/fragments/{}.xml'.format(datasetID), 'wb') as f:
f.write(etree.tostring(root, pretty_print=True))