Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Include Page
menu
menu

...

Please

...

find

...

on

...

this

...

page

...

a

...

deprecated proposal

...

for

...

netCDF output

...

from

...

the

...

spectral

...

wave

...

model

...

SWAN. In the mean time netCDF has been implemented in the SWAN trunk, in a collaboration between Deltares (on behalf or Rijkswaterstaat), BMT Argoss, and TU Delft using somewhat different names (see routine agioncmd.f90). We adopted this page a bit to match the final implementation. There is also a Matlab routine in OpenEarthTools to convert ASCII spectral files into netCDF. Elements from the SWAN input file are here refered to by INPUT*, whereas elements from the SWAN Fortran code swanmain.for are referred to by OV*IVTYPE.

Table of Contents

SWAN netCDF-CF CDL scheme

Code Block
 |http://swan.tudelft.nl].
Elements from the SWAN input file are refered to by INPUT*, elements from the SWAN Fortran code swanmain.for are referred to by OV*IVTYPE.

{toc}

h3. SWAN netCDF-CF CDL scheme 

{code}
// A working draft proposal for CF compliance for netCDF output for SWAN
NetCDF SWAN.nc {

// proposal for CF and SWAN meta data in SWAN

dimensions:
	time      = 1; // time:		also put time in for single times
	mx        = 2; // yx:		(mxc+1) for 2D grids
	my        = 3; // xc:		(myc+1) for 2D grids
	md direction  = 4; // nd: (mdc+1) directions, now called nf90_def_dim
	ms frequency  = 5; // ms: (msc+1) frequencies
	locpoints    = 6; // points:	for 1D grids, for UNSTRUC and for squeezed [mx by my] grids

variables:
// dimensions consistent with ncBrowse, not with native MATLAB netcdf package.
// ----------------- COORDINATES -----------------
// Options:
// * like SWAN use same variable for CARTESIAN and SPHERICAL, but change attributes
// * use different variables for CARTESIAN and SPHERICAL, but change attributes
// if INPUT.CGRID.REGular
	double mx(mx), shape        = [2]
		 ;
		mx(mx):swan_xpc     = // INPUT value: optional for input, implemented in output
		mx(mx):swan_xlenc   = // INPUT value: optional for input, implemented in output
		mx(mx):swan_alpc    = // INPUT value: optional for input, implemented in output
		mx(mx):swan_comment = "mxc+1"
		mx(mx):_FillValue   = // INPUT.CGRID.xexc or OVEXCV{IVTYPE}
		mx:actual_range     = [~ ~]
		// if INPUT.CGRID.CARTESIAN
		mx:standard_name    = "projected_x_coordinate"
		mx:units            = "m"
		mx(mx):grid_mapping = "projected_coordinate_system"
		// elseif INPUT.CGRID.SPHERICAL
		mx:standard_name    = "longitude"
		mx:units            = "degrees_east"
		mx(mx):grid_mapping = "wgs84"
		// end
		...
	double my(my), shape        = [3] ;
		my(my):swan_ypc     = // INPUT value: optional for input, implemented in output
		my(my):swan_ylenc   = // INPUT value: optional for input, implemented in output
		my(my):swan_alpc    = // INPUT value: optional for input, implemented in output
		my(my):swan_comment = "myc+1"
		my(my):_FillValue   = // INPUT.CGRID.yexc or OVEXCV{IVTYPE}
		my:actual_range     = [~ ~]
		// if INPUT.CGRID.CARTESIAN
		my:standard_name    = "projected_y_coordinate"
		my:units            = "m"
		my(my):grid_mapping = "projected_coordinate_system"
		// elseif INPUT.CGRID.SPHERICAL
		my:standard_name    = "latitude"
		my:units            = "degrees_north"
		my(my):grid_mapping = "wgs84"
		// end
		...
// - - - - - - - - - - - - - - - - - - - - - - - - - - -
// elseif INPUT.CGRID.CURVilinear
	double XP(mxxc,myyc), shape = [2] ;
		// idem
		...
	double YP(mxxc,myyc), shape = [3] ;
		// idem
		...
// - - - - - - - - - - - - - - - - - - - - - - - - - - -
// elseif INPUT.CGRID.UNSTRUCtured
	double XPx(locpoints), shape = [6] ;
		// idem
		...
	double YPYyP(locpoints), shape = [6] ;
		// idem
		...
// end
// ----------------- DIRECTIONS -----------------
	double CDIRspread_1d(md), shape = [4] ;
		CDIRspread_1d:standard_name    = ""
		CDIRspread_1d:units            = "degrees_true"
		CDIRspread_1d:longstandard_name        = "spectral Cartesian direction"
		CDIR.dir1sea_surface_wave_from_direction" // sea_surface_wave_to_direction
		spread_1d:nautical         =    =1 // INPUTor value:0
 optional for input, implemented in output
		CDIR.dir2  spread_1d.dir1             = // INPUT value: optional for input, implemented in output
		CDIR:swan_commentspread_1d.dir2      = "mdc+1"
		...
	double NDIR(), shape = [4]
		NDIR:standard_name  = // = ""
		NDIR:units      INPUT value: optional for input, implemented in output
		spread_1d:swan_comment      = "degrees_truemdc+1"
		CDIR:long_name        = "spectral nautical direction"
		NDIR.dir1...
// ----------------- FREQUENCY -----------------
	double frequency(ms) ;
		frequency:standard_name    = "wave_frequency"
		frequency:long_name        = "frequencies" // absolute vs relative, see attribute 'relative_to_current' of energy
		frequency:units            = "s-1"
		frequency.swan_flow        = // INPUT value: optional for input, implemented in output
		NDIR.dir2  frequency.swan_fhigh           = // INPUT value: optional for input, implemented in output
		NDIRfrequency:swan_comment     = "mdcmsc+1"
		...
// ----------------- FREQUENCYCOORDINATE SYSTEMS -----------------
	double AFREQ(), shape = [5]
		AFREQ:standard_name    = ""
		AFREQ:long_name        = "absolute frequencies"
		AFREQ:units            = "degrees_true"
		AFREQ.swan_flow        = // INPUT value: optional for input, implemented in output
		AFREQ.swan_fhigh       = // INPUT value: optional for input, implemented in output
		AFREQ:swan_comment     = "msc+1"
		...
	double NFREQ(), shape = [5]
		NFREQ:standard_name    = ""
		NFREQ:long_name        = "relative frequencies"
		NFREQ:units            = "degrees_true"
		NFREQ.swan_flow        = // INPUT value: optional for input, implemented in output
		NFREQ.swan_fhigh// The projected_coordinate_system information could optionally be added to
// either SWAN input or in a post-processing step.
// if INPUT.CGRID.CARTESIAN
//	int32 projected_coordinate_system() ;
//		projected_coordinate_system:name = "Amersfoort / RD New"
//		projected_coordinate_system:epsg = 28992
//		projected_coordinate_system:epsg_name = "Oblique Stereographic"
//		projected_coordinate_system:grid_mapping_name = " "
//		projected_coordinate_system:semi_major_axis = 6.3774e+006
//		projected_coordinate_system:semi_minor_axis = 6.35608e+006
//		projected_coordinate_system:inverse_flattening = 299.153
//		projected_coordinate_system:latitude_of_projection_origin = 52.0922
//		projected_coordinate_system:longitude_of_projection_origin = 5.23155
//		projected_coordinate_system:false_easting = 155000
//		projected_coordinate_system:false_northing = 463000
//		projected_coordinate_system:scale_factor_at_projection_origin = 0.999908
//               = // INPUToptional value:PROJ4 optionalREQUIRED for input, implemented in output
		NFREQ:swan_comment     = "msc+1"
		...
// ----------------- COORDINATE SYSTEMS -----------------
// The projected_coordinate_system information could optionally be added to
// either SWAN input or in a post-processing step.
// if INPUT.CGRID.CARTESIAN
//	int32 projected_coordinate_system([]), shape = [1]
//		epsg:name = "Amersfoort / RD New"
//		epsg:epsg = 28992
//		epsg:epsg_name = "Oblique Stereographic"
//		epsg:grid_mapping_name = " "
//		epsg:semi_major_axis = 6.3774e+006
//		epsg:semi_minor_axis = 6.35608e+006
//		epsg:inverse_flattening = 299.153
//		epsg:latitude_of_projection_origin = 52.0922
//		epsg:longitude_of_projection_origin = 5.23155
//		epsg:false_easting = 155000
//		epsg:false_northing = 463000
//		epsg:scale_factor_at_projection_origin = 0.999908
//FOR ADAGUC.KNMI.NL
//		projected_coordinate_system:proj4_params = "+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.999908 +x_0=155000 +y_0=463000 +ellps=bessel +units=m +towgs84=565.4174,50.3319,465.5542,-0.398957388243134,0.343987817378283,-1.87740163998045,4.0725 +no_defs"
//		projected_coordinate_system:EPSG_code = "EPSG:28992"
//		projected_coordinate_system:projection_name = "Dutch rijksdriekhoek system"
// - - - - - - - - - - - - - - - - - - - - - - - - - - -
// elseif INPUT.CGRID.SPHERICAL
// The (lat,lon) coordinates information could be hard-coded into SWAN
// with each of the options: CCM, QC or REPEATING
		int32 wgs84() ;
		wgs84:name = "WGS 84"
		wgs84:epsg = 4326
		wgs84:grid_mapping_name = "latitude_longitude"
		wgs84:semi_major_axis = 6.37814e+006
		wgs84:semi_minor_axis = 6.35675e+006
		wgs84:inverse_flattening = 298.257
                // optional PROJ4 REQUIRED FOR ADAGUC.KNMI.NL
//			epsgwgs84:proj4_params = "+proj=sterealonglat +lat_0=52.15616055555555ellps=WGS84 +lon_0=5.38763888888889 +k=0.999908 +x_0=155000 +y_0=463000 +ellps=bessel +units=m +towgs84=565.4174,50.3319,465.5542,-0.398957388243134,0.343987817378283,-1.87740163998045,4.0725 +no_defs"
//		epsg:EPSG_code = "EPSG:28992"
//		epsg:projection_name = "Dutch rijksdriekhoek system"
// - - - - - - - - - - - - - - - - - - - - - - - - - - -
// elseif INPUT.CGRID.SPHERICAL
// The (lat,lon) coordinates information could be hard-coded into SWAN
// with each of the options: CCM, QC or REPEATING
		int32 wgs84([]), shape = [1]
		wgs84:name = "WGS 84"
		wgs84:epsg = 4326
		wgs84:grid_mapping_name = "latitude_longitude"
		wgs84:semi_major_axis = 6.37814e+006
		wgs84:semi_minor_axis = 6.35675e+006
		wgs84:inverse_flattening = 298.257
    datum=WGS84 +no_defs "
		wgs84:EPSG_code = "EPSG:4326"
		wgs84:projection_name = "Latitude Longitude"
		wgs84:wkt = "GEOGCS["WGS 84",...
// end
// ----------------- PRIMARY VARIABLES -----------------
	single density(), shape = [~ ~] // density_1d for 1D, density for 2D
		density:relative_to_current   = 0 // or 1, depending on respectively. AFREQ vs RFREQ
		density:swan_code             =            // OVKEYW{IVTYPE} = 'VaDens';
		density:swan_name             =            // optional PROJ4 REQUIRED FOR ADAGUC.KNMI.NLOVSNAM{IVTYPE} = 'VaDens';
		wgs84density:proj4_params = "+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs "
		wgs84:EPSG_code = "EPSG:4326"
		wgs84:projection_name = "Latitude Longitude"
		wgs84:wkt = "GEOGCS["WGS 84",
// end
// ----------------- PRIMARY VARIABLES -----------------
	single VaDens(), shape = [~ ~]
		VaDens:swan_codelong_name             =            // OVLNAM{IVTYPE} = 'spectral variance density';
		density:swan_units            =            // OVUNIT{IVTYPE} =            // OVKEYW{IVTYPE} = 'VaDens''m2/Hz';
		VaDensdensity:swan_namevalid_range(1)             =            // OVSNAMOVLEXP{IVTYPE} = 'VaDens'0.;
		VaDensdensity:long_namevalid_range(2)             =            // OVLNAMOVHEXP{IVTYPE} = 'spectral variance density'100.;
		VaDensdensity:swan_unitsFillValue            =            // OVUNITOVEXCV{IVTYPE} = 'm2/Hz';
		VaDens:valid_range(1)        =            // OVLEXP{IVTYPE} = 0.;
		VaDens:valid_range(2)-99.;
// - - - - - - - - - - - - - - - - - - - - - - - - - - -
		density:units                 =            // OVHEXPOVCFUD{IVTYPE} = 100.;
		VaDens:_FillValue    ''; NEW TABLE NEEDED INSIDE SWAN
		density:standard_name         =            // OVEXCVOVCFSN{IVTYPE} = -99.;
''; NEW TABLE NEEDED INSIDE SWAN
		// -these do -not -need -to -be -mapped - - - - - - - - - - - - - - - - - - - - -
		VaDens:units            // OVSVTY{IVTYPE} = 5;     // means vector, scalar etc.
		// these do not need to be mapped     =            // OVCFUDOVLLIM{IVTYPE} = ''0.; NEW TABLE NEEDED INSIDE SWAN
		VaDens:standard_name         =   // print width for ascii output
		// these do not need to be mapped         // OVCFSNOVULIM{IVTYPE} = ''1000.; NEW TABLE NEEDED INSIDE SWAN
		// print width for ascii output
// these- do- not- need- to- be- mapped- - - - - - - - - // OVSVTY{IVTYPE} = 5;     // means vector, scalar etc.
		// these do not need to be mapped   - - - - - - - - - - - -
		density:actual_range          = [~ ~]      // OVLLIM{IVTYPE} = 0.;    // print width for ascii output
		// these do not need to be mappedadd optionally as extra service to user
		density:coordinates           = "XP YP"   // OVULIM{IVTYPE} = 1000.; // print width for ascii output

		// - - - - - - - - - - - - - - - - - - - - - - - - - - -
		VaDens:actual_rangeif INPUT.CGRID.CARTESIAN
		density():grid_mapping        = "projected_coordinate_system"
		// elseif INPUT.CGRID.SPHERICAL
		density():grid_mapping          = [~ ~]      // add optionally as extra service to user
		VaDens:coordinates           = "XP YP"    //
		// if INPUT.CGRID.CARTESIAN
		VaDens():grid_mapping        = "projected_coordinate_system"
		// elseif INPUT.CGRID.SPHERICAL
		VaDens():grid_mapping        = "wgs84"
		// end
// ----------------- GLOBAL META_DATA -----------------
//global Attributes:
		:title = "INPUT.PROJECT.name,INPUT.PROJECT.nr"
		:institution"wgs84"
		// end
// ----------------- GLOBAL META_DATA -----------------
//global Attributes:
		:title = "INPUT.PROJECT.name,INPUT.PROJECT.nr"
		:institution = ""
		:source = ""
		:history = "Data produced by SWAN version 40.72AB"
		:references = ""
		:email = ""
		:comment = "INPUT.PROJECT.title1,INPUT.PROJECT.title2,INPUT.PROJECT.title3"
		:version = ""
		:sourceConventions = "CF-1.5"
		:historyCF:featureType = "Data produced by SWAN version 40.72AB"
		:references = ""
		:email = ""
		:comment = "INPUT.PROJECT.title1,INPUT.PROJECT.title2,INPUT.PROJECT.title3"
		:version = "Grid"
		:terms_of_use = "These data can be used freely for research purposes provided that the following source is acknowledged: institution"
		:Conventionsdisclaimer = "CF-1.5"
		:CF:featureType = "Grid"
		:terms_for_use = "These data can be used freely for research purposes provided that the following source is acknowledged: institution"
		:disclaimer = "This data This data is made available in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
}
{code}

h3. Mapping of SWAN names to CF standard names 

For the complete list where we have to get names from, or have them added to is: [http://cf-pcmdi.llnl.gov/documents/cf-standard-names/]
This table is under construction, please fill in any missing UD units or CF standard names.

|| OVKEYW || OVSNAM || OVLNAM                        || OVUNIT || OVLLIM    || OVULIM   ||    OVEXCV || new: OVCFUD (UD units)||new: OVCFSN (standard name)||
|XP    |Xp      |X user coordinate                        |UL   |-10000000000|10000000000|-10000000000| m| projection_x_coordinate,longitude|
|YP    |Yp      |Y user coordinate                        |UL   |-10000000000|10000000000|-10000000000| m| projection_y_coordinate,latitude|
|DIST  |Dist    |distance along output curve              |UL   |           0|10000000000|         -99| m| |
|DEP   |Depth   |Depth                                    |UH   |        -100|        100|         -99| m| |
|VEL   |Vel     |Current velocity                         |UV   |          -2|          2|           0| m/s| |
|UBOT  |Ubot    |Orbital velocity at the bottom           |UV   |           0|          1|         -10| | |
|DISS  |Dissip  |Energy dissipation                       |m2/s |           0|        0.1|          -9| | |
|QB    |Qb      |Fraction breaking waves                  |     |           0|          1|          -1| | |
|LEA   |Leak    |Energy leak over spectral boundaries     |m2/s |           0|        100|          -9| | |
|HS    |Hsig    |Significant wave height                  |UH   |           0|         10|          -9| | sea_surface_wave_significant_height|
|TM01  |Tm01    |Average absolute wave period             |UT   |           0|        100|          -9| | |
|RTP   |RTpeak  |Relative peak period                     |UT   |           0|        100|          -9| | |
|DIR   |Dir     |Average wave direction                   | UDI |           0|        360|        -999| degrees_true _if nautical_| sea_surface_wave_from_direction|
|PDI   |PkDir   |direction of the peak of the spectrum    | UDI |           0|        360|        -999| | |
|TDI   |TDir    |direction of the energy transport        | UDI |           0|        360|        -999| | |
|DSPR  |Dspr    |directional spreading                    | UDI |           0|         60|          -9| | |
|WLEN  |Wlen    |Average wave length                      |UL   |           0|        200|          -9| | |
|STEE  |Steepn  |Wave steepness                           |     |           0|        0.1|          -9| | |
|TRA   |Transp  |Wave energy transport                    |m3/s |         -10|         10|           0| | |
|FOR   |WForce  |Wave driven force per unit surface       |UF   |         -10|         10|           0| | |
|AAAA  |AcDens  |spectral action density                  |m2s  |           0|        100|         -99| | |
|EEEE  |EnDens  |spectral energy density                  |m2   |           0|        100|         -99| | |
|AAAA  |Aux     |auxiliary variable                       |     |-10000000000|10000000000|-10000000000| | |
|XC    |Xc      |X computational grid coordinate          |     |           0|        100|          -9| | |
|YC    |Yc      |Y computational grid coordinate          |     |           0|        100|          -9| | |
|WIND  |Windv   |Wind velocity at 10 m above sea level    |UV   |         -50|         50|           0| | |
|FRC   |FrCoef  |Bottom friction coefficient              |     |           0|          1|          -9| | |
|RTM01 |RTm01   |Average relative wave period             |UT   |           0|        100|          -9| | |
|EEEE  |EnDens  |energy density integrated over direction |m2   |           0|        100|         -99| | |
|DHS   |dHs     |difference in Hs between iterations      |UH   |           0|          1|          -9| | |
|DRTM01|dTm     |difference in Tm between iterations      |UT   |           0|          2|          -9| | |
|TM02  |Tm02    |Zero-crossing period                     |UT   |           0|        100|          -9| | |
|FSPR  |FSpr    |Frequency spectral width {Kappa}         |     |           0|          1|          -9| | |
|URMS  |Urms    |RMS of orbital velocity at the bottom    |UV   |           0|          1|          -9| | |
|UFRI  |Ufric   |Friction velocity                        |UV   |           0|          1|          -9| | |
|ZLEN  |Zlen    |Zero velocity thickness of boundary layer|UL   |           0|          1|          -9| | |
|TAUW  |TauW    |                                         |     |           0|          1|          -9| | |
|CDRAG |Cdrag   |Drag coefficient                         |     |           0|          1|          -9| | |
|SETUP |Setup   |Setup due to waves                       |m    |          -1|          1|          -9| | |
|TIME  |Time    |Date-time                                |     |           0|          1|      -99999| | |
|TSEC  |Tsec    |Time in seconds from reference time      |s    |     -100000|    1000000|      -99999| | |
|PER   |Period  |Average absolute wave period             |UT   |           0|        100|          -9| | |
|RPER  |RPeriod |Average relative wave period             |UT   |           0|        100|          -9| | |
|HSWE  |Hswell  |Wave height of swell part                |UH   |           0|         10|          -9| | |
|URSELL|Ursell  |Ursell number                            |     |           0|          1|          -9| | |
|ASTD  |ASTD    |Air-Sea temperature difference           |K    |         -10|         10|         -99| | |
|TMM10 |Tm_10   |Average absolute wave period             |UT   |           0|        100|          -9| | |
|RTMM10|RTm_10  |Average relative wave period             |UT   |           0|        100|          -9| | |
|DIFPAR|DifPar  |Diffraction parameter                    |     |         -10|         10|         -99| | |
|TMBOT |TmBot   |Bottom wave period                       |UT   |           0|        100|          -9| | |
|WATL  |Watlev  |Water level                              |UH   |        -100|        100|         -99| | |
|BOTL  |Botlev  |Bottom level                             |UH   |        -100|        100|         -99| | |
|TPS   |TPsmoo  |Relative peak period {smooth}            |UT   |           0|        100|          -9| | |
|DISB  |Disbot  |Bottom friction dissipation              |m2/s |           0|        0.1|          -9| | |
|DISSU |Dissrf  |Wave breaking dissipation                |m2/s |           0|        0.1|          -9| | |
|DISW  |Diswcp  |Whitecapping dissipation                 |m2/s |           0|        0.1|          -9| | |
|DISM  |Dismud  |Fluid mud dissipation                    |m2/s |           0|        0.1|          -9| | |
|WLENMR|Wlenmr  |Average wave length with mud real part   |UL   |           0|        200|          -9| | |
|KI    |ki      |Average wave number with mud imag part   |rad/m|           0|          1|          -9| | |
|MUDL  |Mudlayer|Mudlayer thickness                       |UH   |           0|        100|         -99| | |
|VaDens|VaDens  |spectral variance density                |m2/Hz|           0|        100|         -99| m2s| sea_surface_wave_variance_spectral_density|
|Swind |Swind   |wind source term                         |m2   |           0|        100|         -99| | |
|Swcap |Swcap   |whitecapping dissipation                 |m2   |           0|        100|         -99| | |
|Sfric |Sfric   |bottom friction dissipation              |m2   |           0|        100|         -99| | |
|Smud  |Smud    |fluid mud dissipation                    |m2   |           0|        100|         -99| | |
|Ssurf |Ssurf   |surf breaking dissipation                |m2   |           0|        100|         -99| | |
|Snl3  |Snl3    |triad interactions                       |m2   |           0|        100|         -99| | |
|Snl4  |Snl4    |quadruplet interactions                  |m2   |           0|        100|         -99| | |
|KIMAG |KIMAG   |Wave number with mud imag part           |rad/m|         NaN|        NaN|         NaN| | |
|KREAL |KREAL   |Wave number with mud real part           |rad/m|         NaN|        NaN|         NaN| | |

This table was generated with the Matlab code

{code}
[D,D0] = swan_quantity % part of Openearth.eu[addrowcol(char(D0.OVKEYW),0,[-1 1],'|') char(D0.OVSNAM) addrowcol(char(D0.OVLNAM),0,[-1 1],'|') char(D0.OVUNIT) addrowcol(num2str(cell2mat(D0.OVLEXP')),0,[-1 1],'|') addrowcol(num2str(cell2mat(D0.OVHEXP')),0,[1],'|') addrowcol(num2str(cell2mat(D0.OVEXCV')),0,[1],'| | |')]
{code}

using 

  

Mapping of SWAN names to CF standard names

SWAN Standard names