WAVEWATCH III  beta 0.0.1
w3ounfmetamd Module Reference

Manages user configurable netCDF meta-data for ww3_ounf program. More...

Data Types

type  field_t
 Type for storage of meta data aggregated by component (NFIELD) More...
 
type  group_t
 Type for storage of meta data aggregated by field (IFI) More...
 
type  meta_t
 Type for storing WW3 netCDF metadata for a variable. More...
 
type  part_tmpl_t
 Type for storing partitioned parameter template strings. More...
 

Functions/Subroutines

subroutine init_meta (VEC)
 Allocates space for the META_T arrays and sets some defaults. More...
 
subroutine teardown_meta ()
 De-allocates memory used for the META_T arrays. More...
 
subroutine next_line (NDMI, BUF, ILINE, EOF, NEW_SECTION)
 Reads the next valid line from the user meta input file. More...
 
subroutine notabs (STR)
 Replaces tab characters in a string with a space. More...
 
character(len(str)) function replace_char (STR, C, REP)
 Replaces single characters in a string. More...
 
subroutine read_meta ()
 Reads meta data entries from the ountmeta.inp file. More...
 
subroutine decode_header (BUF, ILINE, IFI, IFJ, IFC)
 Decode the META header line. More...
 
subroutine read_meta_pairs (NDMI, META, ILINE)
 Reads in attribute name/value pairs and updates the relevant values in the META type. More...
 
subroutine get_attval_type (BUF, ILINE, ATTV, ATT_TYPE)
 Gets the attribute value and optional variable type from the passed in string. More...
 
subroutine read_freeform_meta_list (NDMI, ILINE, METALIST)
 Reads in freeform attribute name/value pairs. More...
 
subroutine read_crs_meta (NDMI, ILINE)
 Reads in metadata for the coordinate reference system (CRS). More...
 
subroutine default_crs_meta ()
 Set up a default coordinate reference system for the grid. More...
 
type(meta_t) function getmeta (IFI, IFJ, ICOMP, IPART)
 Get the meta data for a particular field. More...
 
subroutine read_part_tmpl (NDMI, ILINE)
 Reads in a TEMPLATE section from file. More...
 
subroutine print_part_tmpl ()
 Prints the patition templates to screen (for debug use). More...
 
subroutine add_partno (META, IPART)
 Adds partition number to meta-data. More...
 
subroutine partno_string_sub (INSTR, IPART)
 Performs string substition of placeholder strings with partition number specfic values. More...
 
subroutine write_meta (NCID, VARID, META, ERR)
 Writes the meta-data entries for a variable. More...
 
subroutine write_global_meta (NCID, ERR)
 Writes the user meta-data entries for the global attributes. More...
 
subroutine write_freeform_meta_list (NCID, VARID, METALIST, ERR)
 Writes the freeform user meta-data entries for a NetCDF variable. More...
 
subroutine print_meta (META)
 Writes meta-data to the screen - for debugging purposes. More...
 
type(meta_t) function meta_deep_copy (META)
 Performs "deep" copy of a META_T type. More...
 
subroutine default_meta ()
 Populates the default meta data for ww3_ounf output fields. More...
 

Variables

character(len= *), parameter fn_meta = "ounfmeta.inp"
 Meta-data input filename. More...
 
character(len= *), parameter ipart_token = "<IPART>"
 String token for integer partition number. More...
 
character(len= *), parameter spart_token = "<SPART>"
 String token for partition descriptive string (space separated) More...
 
character(len= *), parameter spart_token_ = "<SPART_>"
 String token for partition descriptive string (underscore separated) More...
 
type(group_t), dimension(:), allocatable group
 Storage for meta data aggregated by group (IFJ) More...
 
type(meta_list_t) global_meta
 Storage for the Global meta data (free form) More...
 
logical fl_default_gbl_meta = .TRUE.
 Flag for using default (true) or user-defined (false) global meta data. More...
 
character(len=128) crs_name = ''
 Coordinate reference system (CRS) name. More...
 
type(meta_list_t) crs_meta
 Meta data list for CRS. More...
 
logical crs_is_default = .FALSE.
 True if CRS set by this module. More...
 
character(len=256) coords_attr = ''
 "coordinates" attribute - for defining auxiliary coordinates (for all variables) More...
 
type(part_tmpl_t), pointer part_tmpl
 User-defined partitionted paratmeters template strings. More...
 
integer ncvartype
 NetCDF variable type (2=int, 3=real, 4=depends) More...
 
character(len=30) dircom
 Directional convention comment. More...
 
character(len=128) partcom
 Partitioning method comment. More...
 
character(len=15), dimension(5) snamep
 Part. More...
 
logical flrtd = .FALSE.
 Flag for rototed pole grid. More...
 

Detailed Description

Manages user configurable netCDF meta-data for ww3_ounf program.

Default netCDF meta data is provided for each WW3 output variable and is stored intentally via the META_T type. The meta values are grouped by component (max 3), field (IFI) and group (IFJ).

The user can override this meta data via an input text file with the filename ounfmeta.inp.

Entries in the file are formatted as follows:

    META [ IFI [ IFJ ]  |  FLDID ]   [ IFC ]
      attr_name = attr_value
      attr_name = attr_value
      extra_attr = extra_value [type]
    ... repeated as many times as required.

An output field is selected using the META keyword followed by either an [IFI, IFJ] integer pair or a FieldID string. Optionally, either form may be followed by an integer value to select the component in multi-component fields (such as wind).

Blank lines and comments lines (starting with $) are ignored.

attr_name is the netCDF attribute name that you wish to override. This can be one of the following:

  • "varnm"
  • "ename"
  • "standard_name", or "varns"
  • "long_name" or "varnl"
  • "globwave_name" or "varng"
  • "direction_reference", "dir_ref" or "varnd"
  • "comment" or "varnc"
  • "units"
  • "valid_min" or "vmin"
  • "valid_max" or "vmax"
  • "scale_factor" or "fsc"

Any other attribute name is assumed to be an optional "extra" attribute. This extra attribute can take an optional "type" keyworkd to specify the variable tpye of the metadata. If no type is supplied, it defaults to a characer type. Valid types are one of ["c", "r", "i"] for character/string, real/float or integer values respectively.

Global meta data can be specified with a special "META global" line:

    META global
      extra_attr = extra_value [type]
      extra_attr = extra_value [type]

A "coordinate reference system" (CRS) can be specified for all output fields using the "CRS" keyword. As a minimum, the "grid_mapping_name" attribute must be specified. If the CRS section is defined, all output fields will have a "grid_mapping" attribute added referencing the CRS variable. "crs_vaname" will be created as a scalar NF90_CHAR variable in the output file.

    CRS <crs_varname>
      grid_mapping_name = <mapping name>
      attr = value
      attr = value

Note: ALL keywords and "Field Name ID" strings (e.g. HS) are case insensitive. All netCDF attribute names are case sensitive.

Partitioned outputs are handles slightly differently; one meta data entry is used for all partitions of a field. The metadata is made specific to a particular partition via template strings. There are two built-in template strings: SPART and IPART. These provide a "string" description (e.g. "wind sea", "primary swell", etc) or an integer partition number. These can be references in the meta data using the template name surrounded by < .. >, e.g. <SPART>

It is also possible to supply user defined partitioned parameter template strings in the ounfmeta.inp file using the TEMPLATE keyword, as below:

    TEMPLATE <template-name>
      String for partition 0
      String for partition 1
      String for partition 2
      String for partition 3
      ... etc

Specifying the <template-name> with a trailing underscore will provide an underscore seperated (_) string, rather than space seperated.

Example ounfmeta.inp file:

    $ Lines starting with dollars are comments.
    $ The line starts a meta-data section for the depth field
    META DPT
      standard_name = depth
      long_name = "can be quoted string"
      comment = or an unquoted string
      vmax = 999.9

    $ Next one is HSig (group 2, field 1)
    META 2 1
      varns = "sig. wave height"
      varnl = "this is long name"

    $ Next one is second component of wind. It also sets an
    $ "extra" meta data value (height - a float)
    META WND 2
      standard_name = "v-wind"
      height = 10.0 "r"

    $ User defined partitioned parameters template strings:
    TEMPLATE PARTSTR
      wind wave
      primary swell
      secondary swell

    $ Use partition templates in partitioned Hs field:
    $ (SPART and IPART are built-in)
    META PHS
      standard_name = "<SPART_>_sigificant_wave_height"
      long_name = "<PARTSTR>"
      partition_number = "<IPART>"

    $ Coordinate reference system:
    CRS crs
      grid_mapping_name = "latitude_longitude"
      semi_major_axis = 6371000.0 f
      inverse_flattening = 0 f

    $ Global metadata:
    META global
      institution = UKMO
      comment "space seperated strings should be quoted" c
      version = 1.0 r
Author
Chris Bunney
Date
02-Nov-2020

Change log

Date Ver Comments
02-Nov-2020 7.12 Creation
26-Jan-2021 7.12 Added Tp and alternative dir/mag metadata for directional fields.
16-Dec-2020 7.12 Added user partition templates and coordinate reference system.
02-Feb-2021 7.12 Improved partitioned parameter template string implementation.
22-Mar-2021 7.12 Add extra coupling fields
02-Sep-2021 7.12 Add coordinates attribute

Function/Subroutine Documentation

◆ add_partno()

subroutine w3ounfmetamd::add_partno ( type(meta_t), intent(inout)  META,
integer, intent(in)  IPART 
)

Adds partition number to meta-data.

Replaces all instances of "<IPART>" in the provided meta data with the partition number IPART.

Parameters
[in]METAMeta data type
[in]IPARTPartition number
Author
Chris Bunney
Date
02-Nov-2020

Definition at line 1898 of file w3ounfmetamd.F90.

1898  !/
1899  !/ +-----------------------------------+
1900  !/ | WAVEWATCH III NOAA/NCEP |
1901  !/ | C. Bunney |
1902  !/ | |
1903  !/ | FORTRAN 90 |
1904  !/ | Last update : 02-Nov-2020 |
1905  !/ +-----------------------------------+
1906  !/
1907  !/ 09-Nov-2020 : Creation ( version 7.12 )
1908  !/
1909  !
1910  ! 1. Purpose :
1911  !
1912  ! Adds partition number to meta-data.
1913  !
1914  ! 2. Method :
1915  !
1916  ! Replaces all instances of "<IPART>" in the provided meta data with
1917  ! the partition number IPART.
1918  !
1919  ! 3. Parameters :
1920  !
1921  ! Parameter list
1922  ! ----------------------------------------------------------------
1923  ! META META_T I Meta data type
1924  ! IPART Int. I Partition number
1925  ! ----------------------------------------------------------------
1926  !
1927  !/ ------------------------------------------------------------------- /
1928  IMPLICIT NONE
1929 
1930  TYPE(META_T), INTENT(INOUT) :: META
1931  INTEGER, INTENT(IN) :: IPART
1932  !/
1933  !/ ------------------------------------------------------------------- /
1934  !/ Local parameters
1935  !/
1936  CHARACTER(LEN=80) :: TMP
1937  INTEGER :: I, J
1938  TYPE(META_PAIR_T), POINTER :: P
1939 
1940  CALL partno_string_sub(meta%ENAME, ipart)
1941  CALL partno_string_sub(meta%VARNM, ipart)
1942  CALL partno_string_sub(meta%VARNL, ipart)
1943  CALL partno_string_sub(meta%VARNS, ipart)
1944  CALL partno_string_sub(meta%VARNG, ipart)
1945  CALL partno_string_sub(meta%VARNC, ipart)
1946  CALL partno_string_sub(meta%VARND, ipart)
1947  IF(meta%EXTRA%N .GT. 0) THEN
1948  p => meta%EXTRA%HEAD
1949  DO
1950  CALL partno_string_sub(p%ATTNAME, ipart)
1951  IF(p%TYPE .EQ. "c") THEN
1952  CALL partno_string_sub(p%ATTVAL, ipart)
1953  ENDIF
1954  IF(.NOT. ASSOCIATED(p%NEXT)) EXIT
1955  p => p%NEXT
1956  ENDDO
1957  ENDIF
1958 

References partno_string_sub().

Referenced by getmeta().

◆ decode_header()

subroutine w3ounfmetamd::decode_header ( character(*), intent(in)  BUF,
integer, intent(in)  ILINE,
integer, intent(out)  IFI,
integer, intent(out)  IFJ,
integer, intent(out)  IFC 
)

Decode the META header line.

The internal WW3 field can be specified either as an [IFI, IFJ] integer combination, or a field ID tag (such as "HS").

Both forms can also specify an optional component (IFC) integer value for multi-component fields (defaults to 1).

Field name ID tags are case-insensitive, HS == hs == Hs.

Parameters
[in]BUFInput header string (without leading META tag)
[in]ILINELine number (for error reporting)
[out]IFIOutput group number
[out]IFJOutput field number
[out]IFCComponent number (defaults to 1)
Author
Chris Bunney
Date
02-Feb-2021

Definition at line 906 of file w3ounfmetamd.F90.

906  !/
907  !/ +-----------------------------------+
908  !/ | WAVEWATCH III NOAA/NCEP |
909  !/ | C. Bunney |
910  !/ | |
911  !/ | FORTRAN 90 |
912  !/ | Last update : 02-Feb-2021 |
913  !/ +-----------------------------------+
914  !/
915  !/ 09-Nov-2020 : Creation ( version 7.12 )
916  !/ 02-Feb-2021 : NODEFAULT option for Global meta ( version 7.12 )
917  !/
918  !
919  ! 1. Purpose :
920  !
921  ! Decode the META header line.
922  !
923  ! 2. Method:
924  !
925  ! The internal WW3 field can be specified either as an [IFI, IFJ]
926  ! integer combination, or a field ID tag (such as "HS").
927  !
928  ! Both forms can also specify an optional component (IFC) integer
929  ! value for multi-component fields (defaults to 1).
930  !
931  ! Field name ID tags are case-insensitive, HS == hs == Hs.
932  !
933  ! 3. Parameters :
934  !
935  ! Parameter list
936  ! ----------------------------------------------------------------
937  ! BUF Char. I Input header string (without leading META tag)
938  ! ILINE Int. I Line number (for error reporting)
939  ! IFI Int. O Output group number
940  ! IFJ Int. O Output field number
941  ! IFC Int. O Component number (defaults to 1)
942  ! ----------------------------------------------------------------
943  !
944  !/ ------------------------------------------------------------------- /
945  USE w3iogomd, ONLY: w3fldtoij
946 
947  IMPLICIT NONE
948 
949  CHARACTER(*), INTENT(IN) :: BUF
950  INTEGER, INTENT(IN) :: ILINE
951  INTEGER, INTENT(OUT) :: IFI, IFJ, IFC
952  !/ ------------------------------------------------------------------- /
953  !/ Local parameters
954  !/
955  INTEGER :: IERR, I
956  CHARACTER(LEN=10) :: FLD, OFLD, OPT
957 
958  ifi = 0
959  ifj = 1
960  ifc = 1
961  fld = ''
962 
963  ! Is first value an int?
964  READ(buf, *, iostat=ierr) ifi
965  IF(ierr .EQ. 0) THEN
966  ! Try reading 3 values:
967  READ(buf, *, iostat=ierr) ifi, ifj, ifc
968  IF(ierr .NE. 0) THEN
969  ! Try just two values:
970  READ(buf, *, iostat=ierr) ifi, ifj
971  ENDIF
972  ELSE
973  ! Try reading field ID plus component
974  READ(buf, *, iostat=ierr) fld, ifc
975 
976  IF(ierr .NE. 0) THEN
977  ! Try just fldid
978  READ(buf, *, iostat=ierr) fld
979  ENDIF
980  ENDIF
981 
982  IF(ierr .NE. 0) THEN
983  WRITE(ndse, 6000) trim(fn_meta), iline, trim(buf)
984  CALL extcde(10)
985  ENDIf
986 
987  ofld = fld
988  CALL str_to_upper(fld) ! field names are case insensitive
989 
990  ! If string value (FLDID), then decode into IFI,IFJ value:
991  IF(fld /= '') THEN
992  ! Special case for "global" attributes
993  IF(trim(fld) == "GLOBAL") THEN
994  IF(debug) WRITE(*,'(6X,A20,1X,A)') '[GLOBAL meta sec.]', trim(buf)
995  ifi = 999 ! Marker for global section
996 
997  ! check for any options:
998  i = index(buf, trim(ofld)) + len_trim(ofld)
999  opt = adjustl(buf(i:))
1000  CALL str_to_upper(opt)
1001  SELECT CASE(trim(opt))
1002  CASE("")
1003  CONTINUE ! no option
1004  CASE("NODEFAULT")
1005  fl_default_gbl_meta = .false.
1006  IF(debug) WRITE(*,'(6X,A20,1X,A)') '[GLOBAL meta]', 'Defaults disabled'
1007  CASE DEFAULT
1008  WRITE(ndse, *) "Unknown GLOBAL extra option: [", trim(opt), "]"
1009  END SELECT
1010  ELSE
1011  IF(debug) WRITE(*,'(6X,A20,1X,A)') '[Decoding field ID]', trim(buf)
1012  CALL w3fldtoij(fld, ifi, ifj, 1, 1, 1)
1013  ENDIF
1014  ENDIF
1015 
1016  IF(debug) WRITE(*,'(6X,A20,1X,I4,2I2)') '[IFI, IFJ, IFC]', ifi,ifj,ifc
1017  !
1018 6000 FORMAT (/' *** WAVEWATCH III ERROR IN W3OUNFMETA : '/ &
1019  ' SYNTAX ERROR IN SECTION HEADER. ' / &
1020  ' FILENAME = ', a / &
1021  ' LINE NO =', i5 / &
1022  ' => ', a /)
1023  !

References fl_default_gbl_meta, fn_meta, and w3iogomd::w3fldtoij().

Referenced by read_meta().

◆ default_crs_meta()

subroutine w3ounfmetamd::default_crs_meta

Set up a default coordinate reference system for the grid.

The default coordinate reference system (CRS) will be defined based on the type of grid the model is formulated on, e.g. regular lat-lon, rotated pole, etc.

Remarks
See "Grid Mappings" section of CF conventions:
Author
Chris Bunney
Date
25-May-2021

Definition at line 1558 of file w3ounfmetamd.F90.

1558  IMPLICIT NONE
1559 
1560  TYPE(META_PAIR_T) :: META
1561 
1562  IF(flrtd) THEN
1563 #ifdef W3_RTD
1564  ! Rotated pole location
1565  crs_name = 'rotated_pole'
1566  CALL meta_list_append(crs_meta, &
1567  'grid_mapping_name', 'rotated_latitude_longitude')
1568  CALL meta_list_append(crs_meta, &
1569  'grid_north_pole_latitude', polat)
1570  CALL meta_list_append(crs_meta, &
1571  'grid_north_pole_longitude', polon)
1572  crs_is_default = .true.
1573 #endif
1574  ELSE IF(gtype .EQ. ungtype) THEN
1575  ! ! What do we want for unstructure grids?
1576  ELSE
1577  ! Lat/lon grid
1578  crs_name = 'crs'
1579  CALL meta_list_append(crs_meta, &
1580  'grid_mapping_name', 'latitude_longitude')
1581  ! TODO: Default to a spherical Earth?
1582  CALL meta_list_append(crs_meta, &
1583  'semi_major_axis', 6371000.0)
1584  CALL meta_list_append(crs_meta, &
1585  'inverse_flattening', 0.0)
1586  ENDIF
1587 

References crs_is_default, crs_meta, crs_name, and flrtd.

Referenced by init_meta().

◆ default_meta()

subroutine w3ounfmetamd::default_meta

Populates the default meta data for ww3_ounf output fields.

Remarks
VMIN and VMAX are now set in the units of the output field. Previously, they were set with scaled values based on the scaling factor FSC. The scaling is now performed (if necessary) in the WRITE_META subroutine.
FSC (scale factor) is only applied to data and valid_min/max if the netCDF variable type is NF90_SHORT.
Author
Chris Bunney
Date
22-Mar-2021

Definition at line 2499 of file w3ounfmetamd.F90.

2499  !/
2500  !/ +-----------------------------------+
2501  !/ | WAVEWATCH III NOAA/NCEP |
2502  !/ | C. Bunney |
2503  !/ | |
2504  !/ | FORTRAN 90 |
2505  !/ | Last update : 22-Mar-2021 |
2506  !/ +-----------------------------------+
2507  !/
2508  !/ 02-Nov-2020 : Creation ( version 7.12 )
2509  !/ 22-Mar-2021 : Adds extra coupling fields ( version 7.13 )
2510  !/
2511  !
2512  ! 1. Purpose :
2513  !
2514  ! Populates the default meta data for ww3_ounf.
2515  !
2516  ! 2. Remarks :
2517  !
2518  ! VMIN and VMAX are now set in the units of the output field.
2519  ! Previously, they were set with scaled values based on the scaling
2520  ! factor FSC. The scaling is now performed (if necessary) in the
2521  ! WRITE_META subroutine.
2522  !
2523  ! FSC (scale factor) is only applied to data and valid_min/max if
2524  ! the netCDF variable type is NF90_SHORT.
2525  !
2526  !/ ------------------------------------------------------------------- /
2527  IMPLICIT NONE
2528  TYPE(META_T), POINTER :: META(:)
2529  !
2530  !----------GROUP 1 ----------------
2531  !
2532  ! IFI=1, IFJ=1, DPT
2533  meta => group(1)%FIELD(1)%META
2534  meta(1)%FSC = 0.5
2535  meta(1)%UNITS = 'm'
2536  meta(1)%ENAME = '.dpt'
2537  meta(1)%VARNM = 'dpt'
2538  meta(1)%VARNL ='depth'
2539  meta(1)%VARNS ='depth'
2540  meta(1)%VARNG ='depth'
2541  meta(1)%VARNC =''
2542  meta(1)%VARND =''
2543  meta(1)%VMIN = -45000
2544  meta(1)%VMAX = 70000
2545  ! IFI=1, IFJ=2, CUR
2546  meta => group(1)%FIELD(2)%META
2547  meta(1)%ENAME = '.cur'
2548  meta(1)%VARND = dircom
2549  IF(vector) THEN
2550  meta(1)%FSC = 0.01
2551  meta(1)%UNITS = 'm s-1'
2552  meta(1)%VMIN = -9.9
2553  meta(1)%VMAX = 9.9
2554  meta(1)%VARNM='ucur'
2555  meta(1)%VARNL='eastward current'
2556  meta(1)%VARNS='eastward_sea_water_velocity'
2557  meta(1)%VARNG='eastward_sea_water_velocity'
2558  meta(1)%VARNC='cur=sqrt(U**2+V**2)'
2559 
2560  ! Second component
2561  meta(2) = meta(1)
2562  meta(2)%VARNM='vcur'
2563  meta(2)%VARNL='northward current'
2564  meta(2)%VARNS='northward_sea_water_velocity'
2565  meta(2)%VARNG='northward_sea_water_velocity'
2566  meta(2)%VARNC='cur=sqrt(U**2+V**2)'
2567  ELSE
2568  meta(1)%FSC = 0.01
2569  meta(1)%UNITS = 'm s-1'
2570  meta(1)%VMIN = 0
2571  meta(1)%VMAX = 10.0
2572  meta(1)%VARNM='cspd'
2573  meta(1)%VARNL='current speed'
2574  meta(1)%VARNS='sea_water_speed'
2575  meta(1)%VARNG='sea_water_speed'
2576 
2577  ! Second component
2578  meta(2) = meta(1)
2579  meta(2)%FSC = 0.1
2580  meta(2)%VARNM='cdir'
2581  meta(2)%UNITS= 'degrees'
2582  meta(2)%VARNL='current direction (toward)'
2583  meta(2)%VARNS='direction_of_sea_water_velocity'
2584  meta(2)%VARNG='direction_of_sea_water_velocity'
2585  meta(2)%VMIN = 0
2586  meta(2)%VMAX = 360.0
2587  ENDIF ! VECTOR
2588  ! IFI=1, IFJ=3
2589  meta => group(1)%FIELD(3)%META
2590  meta(1)%ENAME = '.wnd'
2591  meta(1)%VARND = dircom
2592  IF(vector) THEN
2593  meta(1)%FSC = 0.1
2594  meta(1)%UNITS = 'm s-1'
2595  meta(1)%VARNM='uwnd'
2596  meta(1)%VARNL='eastward_wind'
2597  meta(1)%VARNS='eastward_wind'
2598  meta(1)%VARNG='eastward_wind'
2599  meta(1)%VARNC='wind=sqrt(U10**2+V10**2)'
2600  meta(1)%VMIN = -99.0
2601  meta(1)%VMAX = 99.0
2602 
2603  ! Second component
2604  meta(2) = meta(1)
2605  meta(2)%VARNM='vwnd'
2606  meta(2)%VARNL='northward_wind'
2607  meta(2)%VARNS='northward_wind'
2608  meta(2)%VARNG='northward_wind'
2609  meta(2)%VARNC='wind=sqrt(U10**2+V10**2)'
2610  ELSE
2611  meta(1)%FSC = 0.01
2612  meta(1)%UNITS= 'm s-1'
2613  meta(1)%VARNM='wspd'
2614  meta(1)%VARNL='wind speed'
2615  meta(1)%VARNS='wind_speed'
2616  meta(1)%VARNG='wind_speed'
2617  meta(1)%VMIN = 0.0
2618  meta(1)%VMAX = 100.0
2619 
2620  ! Second component
2621  meta(2) = meta(1)
2622  meta(2)%FSC = 0.1
2623  meta(2)%VARNM='wdir'
2624  meta(2)%UNITS='degrees'
2625  meta(2)%VARNL='wind direction (from)'
2626  meta(2)%VARNS='wind_from_direction'
2627  meta(2)%VARNG='wind_from_direction'
2628  meta(2)%VMIN = 0.0
2629  meta(2)%VMAX = 360.0
2630  ENDIF ! VECTOR
2631  ! IFI=1, IFJ=4, AST
2632  meta => group(1)%FIELD(4)%META
2633  meta(1)%FSC = 0.1
2634  meta(1)%ENAME = '.ast'
2635  meta(1)%UNITS = 'K'
2636  meta(1)%VARNM='ast'
2637  meta(1)%VARNL='air sea temperature difference'
2638  !META(1)%VARNS='air_sea_temperature_difference'
2639  meta(1)%VARNS=''
2640  meta(1)%VARNG='air_sea_temperature_difference'
2641  meta(1)%VMIN = -200.0
2642  meta(1)%VMAX = 200.0
2643  ! IFI=1, IFJ=5, WLV
2644  meta => group(1)%FIELD(5)%META
2645  meta(1)%FSC = 0.01
2646  meta(1)%UNITS = 'm'
2647  meta(1)%ENAME = '.wlv'
2648  meta(1)%VARNM='wlv'
2649  meta(1)%VARNL='sea surface height above sea level'
2650  meta(1)%VARNS='sea_surface_height_above_mean_sea_level'
2651  meta(1)%VARNG='sea_surface_height_above_sea_level'
2652  meta(1)%VMIN = 0
2653  meta(1)%VMAX = 100
2654  ! IFI=1, IFJ=6, ICE
2655  meta => group(1)%FIELD(6)%META
2656  meta(1)%FSC = 0.001
2657  meta(1)%UNITS = '1'
2658  meta(1)%ENAME = '.ice'
2659  meta(1)%VARNM='ice'
2660  meta(1)%VARNL='sea ice area fraction'
2661  meta(1)%VARNS='sea_ice_area_fraction'
2662  meta(1)%VARNG='sea_ice_area_fraction'
2663  meta(1)%VMIN = 0
2664  meta(1)%VMAX = 1
2665  ! IFI=1, IFJ=7, IBG
2666  meta => group(1)%FIELD(7)%META
2667  meta(1)%FSC = 0.0001
2668  meta(1)%UNITS = 'km-1'
2669  meta(1)%ENAME = '.ibg'
2670  meta(1)%VARNM='ibg'
2671  meta(1)%VARNL='icebergs_damping'
2672  !META(1)%VARNS='icebergs_induced_attenuation_scale_for_waves'
2673  meta(1)%VARNS=''
2674  meta(1)%VARNG='icebergs_damping'
2675  meta(1)%VMIN = 0
2676  meta(1)%VMAX = 3.2
2677  ! IFI=1, IFJ=8, TAUA
2678  meta => group(1)%FIELD(8)%META
2679  meta(1)%FSC = 0.01
2680  meta(1)%UNITS = 'Pa'
2681  meta(1)%ENAME = '.taua'
2682  meta(1)%VARNM='utaua'
2683  meta(1)%VARNL='surface_downward_eastward_stress'
2684  meta(1)%VARNS='surface_downward_eastward_stress'
2685  meta(1)%VARNG='surface_downward_eastward_stress'
2686  meta(2)%VARNC='taua=sqrt(utaua**2+vtaua**2)'
2687  meta(1)%VMIN = -320
2688  meta(1)%VMAX = 320
2689  meta(1)%VARND = dircom
2690 
2691  ! Second component
2692  meta(2) = meta(1)
2693  meta(2)%VARNM='vtaua'
2694  meta(2)%VARNL='surface_downward_northward_stress'
2695  meta(2)%VARNS='surface_downward_northward_stress'
2696  meta(2)%VARNG='surface_downward_northward_stress'
2697  meta(2)%VARNC='taua=sqrt(utaua**2+vtaua**2)'
2698  ! IFI=1, IFJ=9, RHO
2699  meta => group(1)%FIELD(9)%META
2700  meta(1)%FSC = 0.0001
2701  meta(1)%UNITS = 'kg m-3'
2702  meta(1)%ENAME = '.rhoa'
2703  meta(1)%VARNM='rhoa'
2704  meta(1)%VARNL='air_density'
2705  meta(1)%VARNS='air_density'
2706  meta(1)%VARNG='air_density'
2707  meta(1)%VMIN = 0
2708  meta(1)%VMAX = 2
2709  ! IFI=1, IFJ=10, D50
2710 #ifdef W3_BT4
2711  meta => group(1)%FIELD(10)%META
2712  meta(1)%FSC = 0.001
2713  meta(1)%UNITS = 'Krumbein phi scale'
2714  meta(1)%ENAME = '.d50'
2715  meta(1)%VARNM='d50'
2716  meta(1)%VARNL='grain_size'
2717  !META(1)%VARNS='sediment_grain_size'
2718  meta(1)%VARNS=''
2719  meta(1)%VARNG='sediment_grain_size'
2720  meta(1)%VMIN = -10.0
2721  meta(1)%VMAX = 32.0
2722 #endif
2723  ! IFI=1, IFJ=11, IC1
2724 #ifdef W3_IS2
2725  meta => group(1)%FIELD(11)%META
2726  meta(1)%FSC = 0.001
2727  meta(1)%UNITS = 'm'
2728  meta(1)%ENAME = '.ic1'
2729  meta(1)%VARNM='ic1'
2730  meta(1)%VARNL='ice thickness'
2731  meta(1)%VARNS='sea_ice_thickness'
2732  meta(1)%VARNG='ice_thickness'
2733  meta(1)%VMIN = 0
2734  meta(1)%VMAX = 30
2735  ! IFI=1, IFJ=12, IC5
2736  meta => group(1)%FIELD(12)%META
2737  meta(1)%FSC = 0.05
2738  meta(1)%UNITS = 'm'
2739  meta(1)%ENAME = '.ic5'
2740  meta(1)%VARNM='ic5'
2741  meta(1)%VARNL='maximum floe diameter'
2742  !META(1)%VARNS='maximum_ice_floe_diameter'
2743  meta(1)%VARNS=''
2744  meta(1)%VARNG='maximum_ice_floe_diameter'
2745  meta(1)%VMIN = 0
2746  meta(1)%VMAX = 1500
2747 #endif
2748  !
2749  !----------GROUP 2 ----------------
2750  !
2751  ! IFI=2, IFJ=1, HS
2752  meta => group(2)%FIELD(1)%META
2753  meta(1)%FSC = 0.002
2754  meta(1)%UNITS = 'm'
2755  meta(1)%ENAME = '.hs'
2756  meta(1)%VARNM='hs'
2757  meta(1)%VARNL='significant height of wind and swell waves'
2758  meta(1)%VARNS='sea_surface_wave_significant_height'
2759  meta(1)%VARNG='significant_wave_height'
2760  meta(1)%VMIN = 0
2761  meta(1)%VMAX = 64
2762  ! IFI=2, IFJ=2, LM
2763  meta => group(2)%FIELD(2)%META
2764  meta(1)%FSC = 1.
2765  meta(1)%UNITS = 'm'
2766  meta(1)%ENAME = '.lm'
2767  meta(1)%VARNM='lm'
2768  meta(1)%VARNL='mean wave length'
2769  !META(1)%VARNS='mean_wave_length'
2770  meta(1)%VARNS=''
2771  meta(1)%VARNG='mean_wave_length'
2772  meta(1)%VMIN = 0
2773  meta(1)%VMAX = 3200
2774  ! IFI=2, IFJ=3, T02
2775  meta => group(2)%FIELD(3)%META
2776  meta(1)%FSC = 0.01
2777  meta(1)%UNITS = 's'
2778  meta(1)%ENAME = '.t02'
2779  meta(1)%VARNM='t02'
2780  meta(1)%VARNL='mean period T02'
2781  meta(1)%VARNS='sea_surface_wind_wave_mean_period' // &
2782  '_from_variance_spectral_density_second_frequency_moment'
2783  meta(1)%VARNG='mean_period_t02'
2784  meta(1)%VMIN = 0
2785  meta(1)%VMAX = 50
2786  ! IFI=2, IFJ=4, T0M1
2787  meta => group(2)%FIELD(4)%META
2788  meta(1)%FSC = 0.01
2789  meta(1)%UNITS = 's'
2790  meta(1)%ENAME = '.t0m1'
2791  meta(1)%VARNM='t0m1'
2792  meta(1)%VARNL='mean period T0m1'
2793  meta(1)%VARNS='sea_surface_wind_wave_mean_period_from_variance' // &
2794  '_spectral_density_inverse_frequency_moment'
2795  meta(1)%VARNG='mean_period_t0m1'
2796  meta(1)%VMIN = 0
2797  meta(1)%VMAX = 50
2798  ! IFI=2, IFJ=5, T01
2799  meta => group(2)%FIELD(5)%META
2800  meta(1)%FSC = 0.01
2801  meta(1)%UNITS = 's'
2802  meta(1)%ENAME = '.t01'
2803  meta(1)%VARNM='t01'
2804  meta(1)%VARNL='mean period T01'
2805  meta(1)%VARNS='sea_surface_wind_wave_mean_period_from_variance' // &
2806  '_spectral_density_first_frequency_moment'
2807  meta(1)%VARNG='mean_period_t01'
2808  meta(1)%VMIN = 0
2809  meta(1)%VMAX = 50
2810  ! IFI=2, IFJ=6, FP
2811  meta => group(2)%FIELD(6)%META
2812  meta(1)%FSC = 0.001
2813  meta(1)%UNITS = 's-1'
2814  meta(1)%ENAME = '.fp'
2815  meta(1)%VARNM='fp'
2816  meta(1)%VARNL='wave peak frequency'
2817  !META(1)%VARNS='sea_surface_wave_peak_frequency'
2818  meta(1)%VARNS=''
2819  meta(1)%VARNG='dominant_wave_frequency'
2820  meta(1)%VMIN = 0
2821  meta(1)%VMAX = 10
2822  ! IFI=2, IFJ=7, DIR
2823  meta => group(2)%FIELD(7)%META
2824  meta(1)%FSC = 0.1
2825  meta(1)%UNITS = 'degree'
2826  meta(1)%ENAME = '.dir'
2827  meta(1)%VARNM='dir'
2828  meta(1)%VARNL='wave mean direction'
2829  meta(1)%VARNS='sea_surface_wave_from_direction'
2830  meta(1)%VARNG='wave_from_direction'
2831  meta(1)%VARND=dircom
2832  meta(1)%VMIN = 0
2833  meta(1)%VMAX = 360
2834  ! IFI=2, IFJ=8, SPR
2835  meta => group(2)%FIELD(8)%META
2836  meta(1)%FSC = 0.1
2837  meta(1)%UNITS = 'degree'
2838  meta(1)%ENAME = '.spr'
2839  meta(1)%VARNM='spr'
2840  meta(1)%VARNL='directional spread'
2841  meta(1)%VARNS='sea_surface_wave_directional_spread'
2842  meta(1)%VARNG='directional_spread'
2843  meta(1)%VMIN = 0
2844  meta(1)%VMAX = 90
2845  ! IFI=2, IFJ=9, DP
2846  meta => group(2)%FIELD(9)%META
2847  meta(1)%FSC = 1.
2848  meta(1)%UNITS = 'degree'
2849  meta(1)%ENAME = '.dp'
2850  meta(1)%VARNM='dp'
2851  meta(1)%VARNL='peak direction'
2852  meta(1)%VARNS='sea_surface_wave_peak_direction'
2853  meta(1)%VARNG='dominant_wave_direction'
2854  meta(1)%VARND=dircom
2855  meta(1)%VMIN = 0
2856  meta(1)%VMAX = 360
2857  ! IFI=2, IFJ=10, HIG
2858  meta => group(2)%FIELD(10)%META
2859  meta(1)%FSC = 0.0002
2860  meta(1)%UNITS = 'm'
2861  meta(1)%ENAME = '.hig'
2862  meta(1)%VARNM='hig'
2863  meta(1)%VARNL='infragravity_wave_height'
2864  !META(1)%VARNS='sea_surface_wave_infragravity_significant_height'
2865  meta(1)%VARNS=''
2866  meta(1)%VARNG='infragravity_significant_wave_height'
2867  meta(1)%VMIN = 0
2868  meta(1)%VMAX = 1.0
2869  ! IFI=2, IFJ=11, MXE
2870  meta => group(2)%FIELD(11)%META
2871  meta(1)%FSC = 0.002
2872  meta(1)%UNITS = 'm'
2873  meta(1)%ENAME = '.mxe'
2874  meta(1)%VARNM='stmaxe'
2875  meta(1)%VARNL='expected maximum sea surface elevation (nonlinear,2nd order)'
2876  !META(1)%VARNS='expected maximum sea surface elevation (nonlinear,2nd order)'
2877  meta(1)%VARNS=''
2878  meta(1)%VARNG='expected maximum sea surface elevation (nonlinear,2nd order)'
2879  meta(1)%VMIN = 0
2880  meta(1)%VMAX = 64
2881  ! IFI=2, IFJ=12, MXES
2882  meta => group(2)%FIELD(12)%META
2883  meta(1)%FSC = 0.002
2884  meta(1)%UNITS = 'm'
2885  meta(1)%ENAME = '.mxes'
2886  meta(1)%VARNM='stmaxd'
2887  meta(1)%VARNL='standard deviation of maximum sea surface elevation (nonlinear,2nd order)'
2888  !META(1)%VARNS='std of expected maximum sea surface elevation (nonlinear,2nd order)'
2889  meta(1)%VARNS=''
2890  meta(1)%VARNG='standard deviation of maximum sea surface elevation (nonlinear,2nd order)'
2891  meta(1)%VMIN = 0
2892  meta(1)%VMAX = 64
2893  ! IFI=2, IFJ=13, MXH
2894  meta => group(2)%FIELD(13)%META
2895  meta(1)%FSC = 0.002
2896  meta(1)%UNITS = 'm'
2897  meta(1)%ENAME = '.mxh'
2898  meta(1)%VARNM='hmaxe'
2899  meta(1)%VARNL='expected maximum wave height (linear, 1st order)'
2900  !META(1)%VARNS='expected maximum wave height (linear, 1st order)'
2901  meta(1)%VARNS=''
2902  meta(1)%VARNG='expected maximum wave height (linear, 1st order)'
2903  meta(1)%VMIN = 0
2904  meta(1)%VMAX = 64
2905  ! IFI=2, IFJ=14, MXHC
2906  meta => group(2)%FIELD(14)%META
2907  meta(1)%FSC = 0.002
2908  meta(1)%UNITS = 'm'
2909  meta(1)%ENAME = '.mxhc'
2910  meta(1)%VARNM='hcmaxe'
2911  meta(1)%VARNL='expected maximum wave height from crest (linear, 1st order)'
2912  !META(1)%VARNS='expected maximum wave height from crest (linear, 1st order)'
2913  meta(1)%VARNS=''
2914  meta(1)%VARNG='expected maximum wave height from crest (linear, 1st order)'
2915  meta(1)%VMIN = 0
2916  meta(1)%VMAX = 64
2917  ! IFI=2, IFJ=15, SDMH
2918  meta => group(2)%FIELD(15)%META
2919  meta(1)%FSC = 0.002
2920  meta(1)%UNITS = 'm'
2921  meta(1)%ENAME = '.sdmh'
2922  meta(1)%VARNM='hmaxd'
2923  meta(1)%VARNL='STD of maximum wave height (linear, 1st order)'
2924  !META(1)%VARNS='STD of maximum wave height (linear, 1st order)'
2925  meta(1)%VARNS=''
2926  meta(1)%VARNG='STD of maximum wave height (linear, 1st order)'
2927  meta(1)%VMIN = 0
2928  meta(1)%VMAX = 64
2929  ! IFI=2, IFJ=16, SDMHC
2930  meta => group(2)%FIELD(16)%META
2931  meta(1)%FSC = 0.002
2932  meta(1)%UNITS = 'm'
2933  meta(1)%ENAME = '.sdmhc'
2934  meta(1)%VARNM='hcmaxd'
2935  meta(1)%VARNL='STD of maximum wave height from crest (linear, 1st order)'
2936  !META(1)%VARNS='STD of maximum wave height from crest (linear, 1st order)'
2937  meta(1)%VARNS=''
2938  meta(1)%VARNG='STD of maximum wave height from crest (linear, 1st order)'
2939  meta(1)%VMIN = 0
2940  meta(1)%VMAX = 64
2941  ! IFI=2, IFJ=17, WBT
2942  meta => group(2)%FIELD(17)%META
2943  meta(1)%FSC = 0.001
2944  meta(1)%UNITS = '1'
2945  meta(1)%ENAME = '.wbt'
2946  meta(1)%VARNM='wbt'
2947  meta(1)%VARNL='dominant wave breaking probability'
2948  !META(1)%VARNS='dominant_wave_breaking_probability'
2949  meta(1)%VARNS=''
2950  meta(1)%VARNG='dominant_wave_breaking_probability'
2951  meta(1)%VMIN = 0
2952  meta(1)%VMAX = 1
2953  ! IFI=2, IFJ=18, TP
2954  meta => group(2)%FIELD(18)%META
2955  meta(1)%FSC = 0.01
2956  meta(1)%UNITS = 's'
2957  meta(1)%ENAME = '.tp'
2958  meta(1)%VARNM='tp'
2959  meta(1)%VARNL='wave peak period'
2960  meta(1)%VARNS='sea_surface_wave_peak_period'
2961  meta(1)%VARNG='dominant_wave_period'
2962  meta(1)%VMIN = 0
2963  meta(1)%VMAX = 50
2964  ! IFI=2, IFJ=19
2965  meta => group(2)%FIELD(19)%META
2966  meta(1)%FSC = 0.001
2967  meta(1)%UNITS = 'm-1'
2968  meta(1)%ENAME = '.wnm'
2969  meta(1)%VARNM='wnm'
2970  meta(1)%VARNL='mean wave number'
2971  meta(1)%VARNS=''
2972  meta(1)%VARNG=''
2973  meta(1)%VMIN = 0
2974  meta(1)%VMAX = 32
2975  !
2976  !---------- GROUP 3 ----------------
2977  !
2978  ! IFI=3, IFJ=1, EF
2979  meta => group(3)%FIELD(1)%META
2980  meta(1)%VARNM='ef'
2981  meta(1)%VARNL='wave_elevation_spectrum'
2982  meta(1)%VARNS='sea_surface_wave_variance_spectral_density'
2983  IF (ncvartype.LE.3) THEN
2984  meta(1)%UNITS = 'log10(m2 s+1E-12)'
2985  !META(1)%VARNS='base_ten_logarithm_of_power_spectral_density_of_surface_elevation'
2986  meta(1)%VARNC='base_ten_logarithm'
2987  meta(1)%FSC = 0.0004
2988  meta(1)%VMIN = -12.
2989  meta(1)%VMAX = 12.
2990  ELSE
2991  meta(1)%UNITS = 'm2 s'
2992  meta(1)%FSC = 1.
2993  meta(1)%VMIN = 0.
2994  meta(1)%VMAX = 1.e12
2995  END IF
2996  meta(1)%ENAME = '.ef'
2997  meta(1)%VARNG = meta(1)%VARNS
2998  ! IFI=3, IFJ=2, TH1M
2999  meta => group(3)%FIELD(2)%META
3000  ! Information for spectral
3001  meta(1)%FSC = 0.1
3002  meta(1)%VARNM='th1m'
3003  meta(1)%VARNL='mean wave direction frequency spectrum'
3004  !META(1)%VARNS='sea_surface_wave_from_direction_frequency_spectrum'
3005  meta(1)%VARNS=''
3006  meta(1)%VARNG = meta(1)%VARNS
3007  meta(1)%VARND=dircom
3008  meta(1)%UNITS = 'degree'
3009  meta(1)%ENAME = '.th1m'
3010  meta(1)%VMIN = 0
3011  meta(1)%VMAX = 360
3012  ! IFI=3, IFJ=3, STH1M
3013  meta => group(3)%FIELD(3)%META
3014  ! Information for spectral
3015  meta(1)%FSC = 0.01
3016  meta(1)%VARNM='sth1m'
3017  meta(1)%VARNL='spreading frequency spectrum'
3018  !META(1)%VARNS='sea_surface_wave_spreading_spectrum'
3019  meta(1)%VARNS=''
3020  meta(1)%VARNG = meta(1)%VARNS
3021  meta(1)%UNITS = 'degree'
3022  meta(1)%ENAME = '.sth1m'
3023  meta(1)%VMIN = 0
3024  meta(1)%VMAX = 90
3025  ! IFI=3, IFJ=4, TH2M
3026  meta => group(3)%FIELD(4)%META
3027  meta(1)%FSC = 0.1
3028  meta(1)%VARNM='th2m'
3029  meta(1)%VARNL='second mean wave direction frequency spectrum'
3030  !META(1)%VARNS='sea_surface_wave_from_direction_frequency_spectrum_from_second_moments'
3031  meta(1)%VARNS=''
3032  meta(1)%VARNG = meta(1)%VARNS
3033  meta(1)%VARND=dircom
3034  meta(1)%UNITS = 'degree'
3035  meta(1)%ENAME = '.th2m'
3036  meta(1)%VMIN = 0
3037  meta(1)%VMAX = 360
3038  ! IFI=3, IFJ=5, STH2M
3039  meta => group(3)%FIELD(5)%META
3040  meta(1)%FSC = 0.01
3041  meta(1)%VARNM='sth2m'
3042  meta(1)%VARNL='second spreading frequency spectrum'
3043  !META(1)%VARNS='sea_surface_wave_spreading_spectrum_from_second_moments'
3044  meta(1)%VARNS=''
3045  meta(1)%VARNG = meta(1)%VARNS
3046  meta(1)%UNITS = 'degree'
3047  meta(1)%ENAME = '.sth2m'
3048  meta(1)%VMIN = 0
3049  meta(1)%VMAX = 90
3050  ! IFI=3, IFJ=6, WN
3051  meta => group(3)%FIELD(6)%META
3052  ! Information for spectral
3053  meta(1)%FSC = 0.001
3054  meta(1)%UNITS = 'm-1'
3055  meta(1)%ENAME = '.wn'
3056  meta(1)%VARNM='wn'
3057  meta(1)%VARNL='wave numbers'
3058  !META(1)%VARNS='wave_numbers'
3059  meta(1)%VARNS=''
3060  meta(1)%VARNG='wave_numbers'
3061  meta(1)%VMIN = 0
3062  meta(1)%VMAX = 32
3063  !
3064  !---------- GROUP 4 ----------------
3065  !
3066  ! IFI=4, IFJ=1, PHS
3067  meta => group(4)%FIELD(1)%META
3068  meta(1)%FSC = 0.002
3069  meta(1)%UNITS = 'm'
3070  meta(1)%ENAME = '.phs'// ipart_token
3071  meta(1)%VARNM = 'phs'// ipart_token
3072  meta(1)%VARNL = 'wave significant height partition '// ipart_token
3073  meta(1)%VARNS = 'sea_surface_'// spart_token_ //'_wave_significant_height'
3074  meta(1)%VARNG = 'significant_wave_height_partition_'// ipart_token
3075  meta(1)%VARNC = partcom
3076  meta(1)%VMIN = 0
3077  meta(1)%VMAX = 64
3078  ! IFI=4, IFJ=2, PTP
3079  meta => group(4)%FIELD(2)%META
3080  meta(1)%FSC = 0.01
3081  meta(1)%UNITS = 's'
3082  meta(1)%ENAME = '.ptp'// ipart_token
3083  meta(1)%VARNM = 'ptp'// ipart_token
3084  meta(1)%VARNL = 'peak period partition '// ipart_token
3085  meta(1)%VARNS = 'sea_surface_'// spart_token_ //'_wave_period_at_variance' // &
3086  '_spectral_density_maximum'
3087  meta(1)%VARNG = 'dominant_wave_period_partition_'// ipart_token
3088  meta(1)%VARNC = partcom
3089  meta(1)%VMIN = 0
3090  meta(1)%VMAX = 100
3091  ! IFI=4, IFJ=3, PLP
3092  meta => group(4)%FIELD(3)%META
3093  meta(1)%FSC = 1.
3094  meta(1)%UNITS = 'm'
3095  meta(1)%ENAME = '.plp'// ipart_token
3096  meta(1)%VARNM = 'plp'// ipart_token
3097  meta(1)%VARNL = 'peak wave length partition '// ipart_token
3098  !META(1)%VARNS = 'peak_wave_length_partition_'// SPART_TOKEN_
3099  meta(1)%VARNS = ''
3100  meta(1)%VARNG = 'peak_wave_length_partition_'// ipart_token
3101  meta(1)%VARNC = partcom
3102  meta(1)%VMIN = 0
3103  meta(1)%VMAX = 10000
3104  ! IFI=4, IFJ=4, PDIR
3105  meta => group(4)%FIELD(4)%META
3106  meta(1)%FSC = 0.1
3107  meta(1)%UNITS = 'degree'
3108  meta(1)%ENAME = '.pdir'// ipart_token
3109  meta(1)%VARNM = 'pdir'// ipart_token
3110  meta(1)%VARNL = 'wave mean direction partition '// ipart_token
3111  meta(1)%VARNS = 'sea_surface_'// spart_token_ //'_wave_from_direction'
3112  meta(1)%VARNG = 'wave_from_direction_partition_'// ipart_token
3113  meta(1)%VARNC = partcom
3114  meta(1)%VARND = dircom
3115  meta(1)%VMIN = 0
3116  meta(1)%VMAX = 360
3117  ! IFI=4, IFJ=5, PSPR
3118  meta => group(4)%FIELD(5)%META
3119  meta(1)%FSC = 0.1
3120  meta(1)%UNITS = 'degree'
3121  meta(1)%ENAME = '.pspr'// ipart_token
3122  meta(1)%VARNM = 'pspr'// ipart_token
3123  meta(1)%VARNL = 'directional spread partition '// ipart_token
3124  meta(1)%VARNS = 'sea_surface_'// spart_token_ //'_wave_diectional_spread'
3125  meta(1)%VARNG = 'directional_spread_partition_'// ipart_token
3126  meta(1)%VARNC = partcom
3127  meta(1)%VMIN = 0
3128  meta(1)%VMAX = 90
3129  ! IFI=4, IFJ=6, PWS
3130  meta => group(4)%FIELD(6)%META
3131  meta(1)%FSC = 0.001
3132  meta(1)%UNITS = '1'
3133  meta(1)%ENAME = '.pws'// ipart_token
3134  meta(1)%VARNM = 'pws'// ipart_token
3135  meta(1)%VARNL = 'wind sea fraction in partition '// ipart_token
3136  !META(1)%VARNS = 'wind_sea_fraction_in_partition_'// IPART_TOKEN
3137  meta(1)%VARNS = ''
3138  meta(1)%VARNG = 'wind_sea_fraction_in_partition_'// ipart_token
3139  meta(1)%VARNC = partcom
3140  meta(1)%VMIN = 0
3141  meta(1)%VMAX = 1
3142  ! IFI=4, IFJ=7, PDP
3143  meta => group(4)%FIELD(7)%META
3144  meta(1)%FSC = 0.1
3145  meta(1)%UNITS = 'degree'
3146  meta(1)%ENAME = '.pdp'// ipart_token
3147  meta(1)%VARNM = 'pdp'// ipart_token
3148  meta(1)%VARNL = 'peak direction partition '// ipart_token
3149  meta(1)%VARNS = 'sea_surface_'// spart_token_ //'_wave_from_direction_at_variance' // &
3150  '_spectral_density_maximum'
3151  meta(1)%VARNG = 'dominant_wave_from_direction_partition_'// ipart_token
3152  meta(1)%VARNC = partcom
3153  meta(1)%VARND = dircom
3154  meta(1)%VMIN = 0
3155  meta(1)%VMAX = 360
3156  ! IFI=4, IFJ=8, PQP
3157  meta => group(4)%FIELD(8)%META
3158  meta(1)%FSC = 0.01
3159  meta(1)%UNITS = '1'
3160  meta(1)%ENAME = '.pqp'// ipart_token
3161  meta(1)%VARNM = 'pqp'// ipart_token
3162  meta(1)%VARNL = 'peakedness partition '// ipart_token
3163  !META(1)%VARNS = 'sea_surface_wave_peakedness_partition_'// IPART_TOKEN
3164  meta(1)%VARNS = ''
3165  meta(1)%VARNG = 'wave_peakedness_partition_'// ipart_token
3166  meta(1)%VARNC = partcom
3167  meta(1)%VMIN = 0
3168  meta(1)%VMAX = 320
3169  ! IFI=4, IFJ=9, PPE
3170  meta => group(4)%FIELD(9)%META
3171  meta(1)%FSC = 0.01
3172  meta(1)%UNITS = '1'
3173  meta(1)%ENAME = '.ppe'// ipart_token
3174  meta(1)%VARNM = 'ppe'// ipart_token
3175  meta(1)%VARNL = 'peak enhancement factor partition '// ipart_token
3176  !META(1)%VARNS = 'wave_peak_enhancement_factor_partition_'// IPART_TOKEN
3177  meta(1)%VARNS = ''
3178  meta(1)%VARNG = 'wave_peak_enhancement_factor_partition_'// ipart_token
3179  meta(1)%VARNC = 'JONSWAP peak enhancement factor; ' // partcom
3180  meta(1)%VARND = ''
3181  meta(1)%VMIN = 0
3182  meta(1)%VMAX = 320
3183  ! IFI=4, IFJ=10, PGW
3184  meta => group(4)%FIELD(10)%META
3185  meta(1)%FSC = 0.0001
3186  meta(1)%UNITS = 's-1'
3187  meta(1)%ENAME = '.pgw'// ipart_token
3188  meta(1)%VARNM = 'pgw'// ipart_token
3189  meta(1)%VARNL = 'frequency width partition '// ipart_token
3190  !META(1)%VARNS = 'Gaussian_frequency_spread_partition_'// IPART_TOKEN
3191  meta(1)%VARNS = ''
3192  meta(1)%VARNG = 'Gaussian_frequency_spread_partition_'// ipart_token
3193  meta(1)%VARNC = 'Gaussian least-square fit to ' // &
3194  'omni-directional spectral partition; ' // partcom
3195  meta(1)%VMIN = 0
3196  meta(1)%VMAX = 3.2
3197  ! IFI=4, IFJ=11, PSW
3198  meta => group(4)%FIELD(11)%META
3199  meta(1)%FSC = 0.0001
3200  meta(1)%UNITS = '1'
3201  meta(1)%ENAME = '.psw'// ipart_token
3202  meta(1)%VARNM = 'psw'// ipart_token
3203  meta(1)%VARNL = 'spectral width partition '// ipart_token
3204  !META(1)%VARNS = 'sea_surface_wave_spectral_width_partition_'// IPART_TOKEN
3205  meta(1)%VARNS = ''
3206  meta(1)%VARNG = 'wave_spectral_width_partition_'// ipart_token
3207  meta(1)%VARNC = partcom
3208  meta(1)%VMIN = 0
3209  meta(1)%VMAX = 3.2
3210  ! IFI=4, IFJ=12, PTM10
3211  meta => group(4)%FIELD(12)%META
3212  meta(1)%FSC = 0.01
3213  meta(1)%UNITS = 's'
3214  meta(1)%ENAME = '.ptm10c'// ipart_token
3215  meta(1)%VARNM = 'ptm10c'// ipart_token
3216  meta(1)%VARNL = 'mean period Tm10 partition '// ipart_token
3217  meta(1)%VARNS = 'sea_surface_'// spart_token_ //'_wave_mean_period_from_variance' // &
3218  '_spectral_density_inverse_frequency_moment'
3219  meta(1)%VARNG = 'mean_wave_period_Tm10_partition_'// ipart_token
3220  meta(1)%VARNC = partcom
3221  meta(1)%VMIN = 0
3222  meta(1)%VMAX = 100
3223  ! IFI=4, IFJ=13, PT01
3224  meta => group(4)%FIELD(13)%META
3225  meta(1)%FSC = 0.01
3226  meta(1)%UNITS = 's'
3227  meta(1)%ENAME = '.pt01c'// ipart_token
3228  meta(1)%VARNM = 'pt01c'// ipart_token
3229  meta(1)%VARNL = 'mean period T01 partition '// ipart_token
3230  meta(1)%VARNS = 'sea_surface_'// spart_token_ //'_wave_mean_period_from_variance' // &
3231  '_spectral_density_first_frequency_moment'
3232  meta(1)%VARNG = 'mean_wave_period_T01_partition_'// ipart_token
3233  meta(1)%VARNC = partcom
3234  meta(1)%VMIN = 0
3235  meta(1)%VMAX = 100
3236  ! IFI=4, IFJ=14, PT02
3237  meta => group(4)%FIELD(14)%META
3238  meta(1)%FSC = 0.01
3239  meta(1)%UNITS = 's'
3240  meta(1)%ENAME = '.pt02c'// ipart_token
3241  meta(1)%VARNM = 'pt02c'// ipart_token
3242  meta(1)%VARNL = 'mean period T02 partition '// ipart_token
3243  meta(1)%VARNS = 'sea_surface_'// spart_token_ //'_wave_mean_period_from_variance' // &
3244  '_spectral_density_second_frequency_moment'
3245  meta(1)%VARNG = 'mean_wave_period_T02_partition_'// ipart_token
3246  meta(1)%VARNC = partcom
3247  meta(1)%VMIN = 0
3248  meta(1)%VMAX = 100
3249  ! IFI=4, IFJ=15, PEP
3250  meta => group(4)%FIELD(15)%META
3251  meta(1)%FSC = 0.02
3252  meta(1)%UNITS = 'm2 s rad-1'
3253  meta(1)%ENAME = '.pep'// ipart_token
3254  meta(1)%VARNM = 'pep'// ipart_token
3255  meta(1)%VARNL = 'energy at peak frequency partition '// ipart_token
3256  !META(1)%VARNS = 'sea_surface_wave_energy_at_variance_spectral_density_maximum_partition_'// IPART_TOKEN
3257  meta(1)%VARNS = ''
3258  meta(1)%VARNG = 'wave_energy_at_variance_spectral_density_maximum_partition_'// ipart_token
3259  meta(1)%VARNC = partcom
3260  meta(1)%VMIN = 0
3261  meta(1)%VMAX = 200
3262  ! IFI=4, IFJ=16, TWS
3263  meta => group(4)%FIELD(16)%META
3264  meta(1)%FSC = 0.001
3265  meta(1)%UNITS = '1'
3266  meta(1)%ENAME = '.tws'
3267  meta(1)%VARNM = 'tws'
3268  meta(1)%VARNL = 'wind sea fraction'
3269  !META(1)%VARNS = 'wind_sea_fraction'
3270  meta(1)%VARNS = ''
3271  meta(1)%VARNG = 'wind_sea_fraction'
3272  meta(1)%VARNC = partcom
3273  meta(1)%VMIN = 0
3274  meta(1)%VMAX = 1
3275  ! IFI=4, IFJ=17, PNR
3276  meta => group(4)%FIELD(17)%META
3277  meta(1)%FSC = 1.
3278  meta(1)%UNITS = '1'
3279  meta(1)%ENAME = '.pnr'
3280  meta(1)%VARNM = 'pnr'
3281  meta(1)%VARNL = 'number of wave partitions'
3282  !META(1)%VARNS = 'number_of_wave_partitions'
3283  meta(1)%VARNS = ''
3284  meta(1)%VARNG = 'number_of_wave_partitions'
3285  meta(1)%VARNC = partcom
3286  meta(1)%VMIN = 0
3287  meta(1)%VMAX = 100
3288  !
3289  !---------- GROUP 5 ----------------
3290  !
3291  ! IFI=5, IFJ=1, UST
3292  meta => group(5)%FIELD(1)%META
3293  ! First component
3294  meta(1)%FSC = 0.001
3295  meta(1)%ENAME = '.ust'
3296  meta(1)%UNITS = 'm s-1'
3297  meta(1)%VARNM='uust'
3298  meta(1)%VARNL='eastward friction velocity'
3299  !META(1)%VARNS='eastward_friction_velocity'
3300  meta(1)%VARNS=''
3301  meta(1)%VARNG='eastward_friction_velocity'
3302  meta(1)%VARNC='ust=sqrt(uust**2+vust**2)'
3303  meta(1)%VARND=dircom
3304  meta(1)%VMIN = -99.0
3305  meta(1)%VMAX = 99.0
3306 
3307  ! Second component
3308  meta(2) = meta(1)
3309  meta(2)%VARNM='vust'
3310  meta(2)%VARNL='northward friction velocity'
3311  !META(2)%VARNS='northward_friction_velocity'
3312  meta(2)%VARNS=''
3313  meta(2)%VARNG='northward_friction_velocity'
3314  ! IFI=5, IFJ=2, CHA
3315  meta => group(5)%FIELD(2)%META
3316  meta(1)%FSC = 1.e-5
3317  meta(1)%UNITS = '1'
3318  meta(1)%ENAME = '.cha'
3319  meta(1)%VARNM='cha'
3320  meta(1)%VARNL='charnock coefficient for surface roughness length for momentum in air'
3321  meta(1)%VARNS='charnock_coefficient_for_surface_roughness_length_for_momentum_in_air'
3322  meta(1)%VARNG='charnock_coefficient'
3323  meta(1)%VMIN = 0
3324  meta(1)%VMAX = 0.327
3325  ! IFI=5, IFJ=3, CGE
3326  meta => group(5)%FIELD(3)%META
3327  meta(1)%FSC = 0.1 !0.01
3328  meta(1)%UNITS = 'kW m-1'
3329  meta(1)%ENAME = '.cge'
3330  meta(1)%VARNM='cge'
3331  meta(1)%VARNL='wave energy flux'
3332  !META(1)%VARNS='sea_surface_wind_wave_energy_flux'
3333  meta(1)%VARNS=''
3334  meta(1)%VARNG='wave_energy_flux'
3335  meta(1)%VMIN = 0
3336  meta(1)%VMAX = 999
3337  ! IFI=5, IFJ=4, FAW
3338  meta => group(5)%FIELD(4)%META
3339  meta(1)%FSC = 0.1
3340  meta(1)%UNITS = 'W m-2'
3341  meta(1)%ENAME = '.faw'
3342  meta(1)%VARNM='faw'
3343  meta(1)%VARNL='wind to wave energy flux'
3344  meta(1)%VARNS='wind_mixing_energy_flux_into_sea_water'
3345  meta(1)%VARNG='wind_to_wave_energy_flux'
3346  meta(1)%VMIN = 0
3347  meta(1)%VMAX = 999
3348  ! IFI=5, IFJ=5, TAW
3349  meta => group(5)%FIELD(5)%META
3350  ! First component
3351  meta(1)%FSC = 0.000001
3352  meta(1)%UNITS = 'm2 s-2'
3353  meta(1)%ENAME = '.taw'
3354  meta(1)%VARNM='utaw'
3355  meta(1)%VARNL='eastward wave supported wind stress'
3356  !META(1)%VARNS='eastward_wave_supported_wind_stress'
3357  meta(1)%VARNS=''
3358  meta(1)%VARNC='taw=sqrt(utaw**2+vtaw**2)'
3359  meta(1)%VARNG='eastward_wave_supported_wind_stress'
3360  meta(1)%VARND=dircom
3361  meta(1)%VMIN = -0.032
3362  meta(1)%VMAX = 0.032
3363 
3364  ! Second component
3365  meta(2) = meta(1)
3366  meta(2)%VARNM='vtaw'
3367  meta(2)%VARNL='northward wave supported wind stress'
3368  !META(2)%VARNS='northward_wave_supported_wind_stress'
3369  meta(2)%VARNS=''
3370  meta(2)%VARNG='northward_wave_supported_wind_stress'
3371  meta(2)%VARNC='taw=sqrt(utaw**2+vtaw**2)'
3372  ! IFI=5, IFJ=6, TWA
3373  meta => group(5)%FIELD(6)%META
3374  ! First component
3375  meta(1)%FSC = 0.0001
3376  meta(1)%ENAME = '.twa'
3377  meta(1)%UNITS = 'm2 s-2'
3378  meta(1)%VARNM='utwa'
3379  meta(1)%VARNL='eastward wave to wind stress'
3380  !META(1)%VARNS='eastward_wave_to_wind_stress'
3381  meta(1)%VARNS=''
3382  meta(1)%VARNG='eastward_wave_to_wind_stress'
3383  meta(1)%VARNC='twa=sqrt(utwa**2+vtwa**2)'
3384  meta(1)%VARND=dircom
3385  meta(1)%VMIN = -3.2
3386  meta(1)%VMAX = 3.2
3387 
3388  ! Second component
3389  meta(2) = meta(1)
3390  meta(2)%VARNM='vtwa'
3391  meta(2)%VARNL='northward wave to wind stress'
3392  !META(2)%VARNS='northward_wave_to_wind_stress'
3393  meta(2)%VARNS=''
3394  meta(2)%VARNG='northward_wave_to_wind_stress'
3395  meta(2)%VARNC='twa=sqrt(utwa**2+vtwa**2)'
3396  ! IFI=5, IFJ=7, WCC
3397  meta => group(5)%FIELD(7)%META
3398  meta(1)%FSC = 0.0001
3399  meta(1)%UNITS = '1'
3400  meta(1)%ENAME = '.wcc'
3401  meta(1)%VARNM='wcc'
3402  meta(1)%VARNL='whitecap coverage'
3403  !META(1)%VARNS='whitecap_coverage'
3404  meta(1)%VARNS=''
3405  meta(1)%VARNG='whitecap_coverage'
3406  meta(1)%VARNC=''
3407  meta(1)%VARND=''
3408  meta(1)%VMIN = 0
3409  meta(1)%VMAX = 1
3410  ! IFI=5, IFJ=8, WCF
3411  meta => group(5)%FIELD(8)%META
3412  meta(1)%FSC = 0.001
3413  meta(1)%UNITS = 'm'
3414  meta(1)%ENAME = '.wcf'
3415  meta(1)%VARNM='wcf'
3416  meta(1)%VARNL='whitecap foam thickness'
3417  !META(1)%VARNS='whitecap_foam_thickness'
3418  meta(1)%VARNS=''
3419  meta(1)%VARNG='whitecap_foam_thickness'
3420  meta(1)%VMIN = 0
3421  meta(1)%VMAX = 10
3422  ! IFI=5, IFJ=9, WCH
3423  meta => group(5)%FIELD(9)%META
3424  meta(1)%FSC = 0.002
3425  meta(1)%UNITS = 'm'
3426  meta(1)%ENAME = '.wch'
3427  meta(1)%VARNM='wch'
3428  meta(1)%VARNL='significant breaking wave height'
3429  !META(1)%VARNS='significant_breaking_wave_height'
3430  meta(1)%VARNS=''
3431  meta(1)%VARNG='significant_breaking_wave_height'
3432  meta(1)%VMIN = 0
3433  meta(1)%VMAX = 64
3434  ! IFI=5, IFJ=10, WCM
3435  meta => group(5)%FIELD(10)%META
3436  meta(1)%FSC = 0.0001
3437  meta(1)%UNITS = '1'
3438  meta(1)%ENAME = '.wcm'
3439  meta(1)%VARNM='wcm'
3440  meta(1)%VARNL='whitecap moment'
3441  !META(1)%VARNS='whitecap_moment'
3442  meta(1)%VARNS=''
3443  meta(1)%VARNG='whitecap_moment'
3444  meta(1)%VMIN = 0
3445  meta(1)%VMAX = 1
3446  ! IFI=5, IFJ=11, FWS
3447  meta => group(5)%FIELD(11)%META
3448  meta(1)%FSC = 0.002
3449  meta(1)%UNITS = 's'
3450  meta(1)%ENAME = '.fws'
3451  meta(1)%VARNM='fws'
3452  meta(1)%VARNL='Wind_sea_mean_period_T0M1'
3453  meta(1)%VARNS='sea_surface_wind_wave_mean_period_from_variance' // &
3454  '_spectral_density_inverse_frequency_moment'
3455  meta(1)%VARNG='Wind_sea_mean_period_T0M1'
3456  meta(1)%VARNC=''
3457  meta(1)%VARND=''
3458  meta(1)%VMIN = 0
3459  meta(1)%VMAX = 64
3460  !
3461  !---------- GROUP 6 ----------------
3462  !
3463  ! IFI=6, IFJ=1, SXY
3464  meta => group(6)%FIELD(1)%META
3465  meta(1)%FSC = 10.
3466  meta(1)%UNITS = 'N m-1'
3467  meta(1)%ENAME = '.sxy'
3468  meta(1)%VARND = dircom
3469  meta(1)%VMIN = -30000
3470  meta(1)%VMAX = 30000
3471 
3472  ! First component
3473  meta(1)%VARNM='sxx'
3474  meta(1)%VARNL='Radiation stress component Sxx'
3475  !META(1)%VARNS='radiation_stress_component_sxx'
3476  meta(1)%VARNS=''
3477 
3478  ! S6cond component
3479  meta(2) = meta(1)
3480  meta(2)%VARNM='syy'
3481  meta(2)%VARNL='Radiation stress component Syy'
3482  !META(2)%VARNS='radiation_stress_component_syy'
3483  meta(2)%VARNS=''
3484 
3485  ! Third component
3486  meta(3) = meta(1)
3487  meta(3)%FSC = 1.
3488  meta(3)%VARNM='sxy'
3489  meta(3)%VARNL='Radiation stress component Sxy'
3490  !META(3)%VARNS='radiation_stress_component_sxy'
3491  meta(3)%VARNS=''
3492  ! IFI=6, IFJ=2, TWO
3493  meta => group(6)%FIELD(2)%META
3494  meta(1)%FSC = 0.000001
3495  meta(1)%UNITS = 'm2 s-2'
3496  meta(1)%ENAME = '.two'
3497  meta(1)%VMIN = -0.032
3498  meta(1)%VMAX = 0.032
3499  meta(1)%VARND = dircom
3500 
3501  ! First component
3502  meta(1)%VARNM='utwo'
3503  meta(1)%VARNL='eastward wave to ocean stress'
3504  !META(1)%VARNS='eastward_wave_to_ocean_stress'
3505  meta(1)%VARNS=''
3506  meta(1)%VARNG='eastward_wave_to_ocean_stress'
3507  meta(1)%VARNC='two=sqrt(utwo**2+vtwo**2)'
3508 
3509  ! Second component
3510  meta(2) = meta(1)
3511  meta(2)%VARNM='vtwo'
3512  meta(2)%VARNL='northward wave to ocean stress'
3513  !META(2)%VARNS='northward_wave_to_ocean_stress'
3514  meta(2)%VARNS=''
3515  meta(2)%VARNG='northward_wave_to_ocean_stress'
3516  meta(2)%VARNC='two=sqrt(utwo**2+vtwo**2)'
3517  ! IFI=6, IFJ=3, BHD
3518  meta => group(6)%FIELD(3)%META
3519  meta(1)%FSC = 0.1
3520  meta(1)%UNITS = 'm2 s-2'
3521  meta(1)%ENAME = '.bhd'
3522  meta(1)%VARNM='bhd'
3523  meta(1)%VARNL='radiation pressure (Bernouilli Head)'
3524  !META(1)%VARNS='radiation_pressure'
3525  meta(1)%VARNS=''
3526  meta(1)%VARNG='radiation_pressure'
3527  meta(1)%VMIN = 0
3528  meta(1)%VMAX = 100
3529  ! IFI=6, IFJ=4, FOC
3530  meta => group(6)%FIELD(4)%META
3531  meta(1)%FSC = 0.1
3532  meta(1)%UNITS = 'W m-2'
3533  meta(1)%ENAME = '.foc'
3534  meta(1)%VARNM='foc'
3535  meta(1)%VARNL='wave to ocean energy flux'
3536  !META(1)%VARNS='wave_to_ocean_energy_flux'
3537  meta(1)%VARNS=''
3538  meta(1)%VARNG='wave_to_ocean_energy_flux'
3539  meta(1)%VMIN = 0
3540  meta(1)%VMAX = 999
3541  ! IFI=6, IFJ=5, TUS
3542  meta => group(6)%FIELD(5)%META
3543  meta(1)%FSC = 0.001
3544  meta(1)%UNITS = 'm2 s-1'
3545  meta(1)%ENAME = '.tus'
3546  meta(1)%VARND = dircom
3547  meta(1)%VMIN = -32.0 ! C Hansen: The former values of +-9.9 might be
3548  meta(1)%VMAX = 32.0 ! exceeded more frequently in real storms
3549 
3550  ! First component
3551  meta(1)%VARNM='utus'
3552  meta(1)%VARNL='eastward stokes transport'
3553  !META(1)%VARNS='eastward_stokes_transport'
3554  meta(1)%VARNS=''
3555  meta(1)%VARNG='eastward_stokes_transport'
3556  meta(1)%VARNC='tus=sqrt(utus**2+vtus**2)'
3557 
3558  ! Second component
3559  meta(2) = meta(1)
3560  meta(2)%VARNM='vtus'
3561  meta(2)%VARNL='northward stokes transport'
3562  !META(2)%VARNS='northward_stokes_transport'
3563  meta(2)%VARNS=''
3564  meta(2)%VARNG='northward_stokes_transport'
3565  meta(2)%VARNC='tus=sqrt(utus**2+vtus**2)'
3566 
3567  ! IFI=6, IFJ=6, USS
3568  meta => group(6)%FIELD(6)%META
3569  meta(1)%FSC = 0.0005
3570  meta(1)%UNITS = 'm s-1'
3571  meta(1)%ENAME = '.uss'
3572 
3573  ! First component
3574  meta(1)%VARNM='uuss'
3575  meta(1)%VARNL='eastward surface stokes drift'
3576  meta(1)%VARNS='sea_surface_wave_stokes_drift_eastward_velocity'
3577  meta(1)%VARNG='eastward_surface_stokes_drift'
3578  meta(1)%VARNC='uss=sqrt(uuss**2+vuss**2)'
3579  meta(1)%VARND=dircom
3580  meta(1)%VMIN = -4.95
3581  meta(1)%VMAX = 4.95
3582 
3583  ! Second component
3584  meta(2) = meta(1)
3585  meta(2)%VARNM='vuss'
3586  meta(2)%VARNL='northward surface stokes drift'
3587  meta(2)%VARNS='sea_surface_wave_stokes_drift_northward_velocity'
3588  meta(2)%VARNG='northward_surface_stokes_drift'
3589  WRITE(meta(2)%VARNC,'(A,F8.4,A,F8.4,A)') 'Frequency range ',sig(1)*tpiinv,' to ',sig(nk)*tpiinv,' Hz'
3590  ! IFI=6, IFJ=7, P2S
3591  meta => group(6)%FIELD(7)%META
3592  meta(1)%FSC = 0.01
3593  meta(1)%ENAME = '.p2s'
3594  meta(1)%UNITS = 'm4'
3595  meta(1)%VMIN = -150
3596  meta(1)%VMAX = 320
3597 
3598  ! First component
3599  meta(1)%VARNL='power spectral density of equivalent surface pressure'
3600  !META(1)%VARNS='power_spectral_density_of_equivalent_surface_pressure'
3601  meta(1)%VARNS=''
3602  meta(1)%VARNG='power_spectral_density_of_equivalent_surface_pressure'
3603  meta(1)%VARNM='fp2s'
3604 
3605  ! Second component
3606  meta(2) = meta(1)
3607  meta(2)%VARNM='pp2s'
3608  meta(2)%UNITS= 's-1'
3609  meta(2)%VARNL='peak period of power spectral density of equivalent surface pressure'
3610  !META(2)%VARNS='peak_period_of_power_spectral_density_of_equivalent_surface_pressure'
3611  meta(2)%VARNS=''
3612  meta(2)%VARNG='peak_period_of_power_spectral_density_of_equivalent_surface_pressure'
3613 
3614  ! IFI=6, IFJ=8, USF
3615  meta => group(6)%FIELD(8)%META
3616  meta(1)%UNITS = 'm s-1 Hz-1'
3617  meta(1)%FSC = 0.0005
3618  meta(1)%ENAME = '.usf'
3619  meta(1)%VMIN = -4.95
3620  meta(1)%VMAX = 4.95
3621  meta(1)%VARND = dircom
3622 
3623  ! First component
3624  meta(1)%VARNM='uusf'
3625  meta(1)%VARNL='eastward spectral variance of surface stokes drift'
3626  !META(1)%VARNS='eastward_spectral_variance_of_surface_stokes_drift'
3627  meta(1)%VARNS=''
3628  meta(1)%VARNC='usf=sqrt(uusf**2+vusf**2)'
3629  meta(1)%VARNG='eastward_spectral_variance_of_surface_stokes_drift'
3630 
3631  ! Second component
3632  meta(2) = meta(1)
3633  meta(2)%VARNM='vusf'
3634  meta(2)%VARNL='northward spectral variance of surface stokes drift'
3635  !META(2)%VARNS='northward_spectral_variance_of_surface_stokes_drift'
3636  meta(2)%VARNS=''
3637  meta(2)%VARNG='northward_spectral_variance_of_surface_stokes_drift'
3638  meta(2)%VARNC='usf=sqrt(uusf**2+vusf**2)'
3639  ! IFI=6, IFJ=9, P2L
3640  meta => group(6)%FIELD(9)%META
3641  ! Information for spectral microseismic generation data (2nd file)
3642  meta(1)%FSC = 0.0004
3643  meta(1)%VARNM='p2l'
3644  meta(1)%VARNL='base ten logarithm of power spectral density of equivalent surface pressure'
3645  !META(1)%VARNS='base_ten_logarithm_of_power_spectral_density_of_equivalent_surface_pressure'
3646  meta(1)%VARNS=''
3647  meta(1)%VARNG='base_ten_logarithm_of_power_spectral_density_of_equivalent_surface_pressure'
3648  IF (ncvartype.EQ.2) THEN
3649  meta(1)%UNITS='log10(Pa2 m2 s+1E-12)'
3650  meta(1)%VMIN = -12.
3651  meta(1)%VMAX = 12.
3652  ELSE
3653  meta(1)%UNITS='Pa2 m2 s'
3654  meta(1)%VARNL='power spectral density of equivalent surface pressure'
3655  !META(1)%VARNS='power_spectral_density_of_equivalent_surface_pressure'
3656  meta(1)%VARNG='power_spectral_density_of_equivalent_surface_pressure'
3657  meta(1)%VMIN = 0.
3658  meta(1)%VMAX = 1.e12
3659  ENDIF
3660  meta(1)%VARNC=''
3661  meta(1)%VARND=''
3662  meta(1)%ENAME='.p2l'
3663  ! IFI=6, IFJ=10, TWI
3664  meta => group(6)%FIELD(10)%META
3665  meta(1)%FSC = 0.000001
3666  meta(1)%UNITS = 'm2 s-2'
3667  meta(1)%ENAME = '.tic'
3668  meta(1)%VMIN = -0.032
3669  meta(1)%VMAX = 0.032
3670  meta(1)%VARND = dircom
3671 
3672  ! First component
3673  meta(1)%VARNL='eastward wave to sea ice stress'
3674  meta(1)%VARNM='utic'
3675  !META(1)%VARNS='eastward_wave_to_sea_ice_stress'
3676  meta(1)%VARNS=''
3677  meta(1)%VARNG='eastward_wave_to_sea_ice_stress'
3678  meta(1)%VARNC='two=sqrt(utwo**2+vtwo**2)'
3679  ! Second component
3680  meta(2) = meta(1)
3681  meta(2)%VARNM='vtic'
3682  meta(2)%VARNL='northward wave to sea ice stress'
3683  !META(2)%VARNS='northward_wave_to_sea_ice_stress'
3684  meta(2)%VARNS=''
3685  meta(2)%VARNG='northward_wave_to_sea_ice_stress'
3686  meta(2)%VARNC='two=sqrt(utwo**2+vtwo**2)'
3687  ! IFI=6, IFJ=11, FIC
3688  meta => group(6)%FIELD(11)%META
3689  meta(1)%FSC = 0.1
3690  meta(1)%UNITS = 'W m-2'
3691  meta(1)%ENAME = '.fic'
3692  meta(1)%VARNM='fic'
3693  meta(1)%VARNL='wave to sea ice energy flux'
3694  !META(1)%VARNS='wave_to_sea_ice_energy_flux'
3695  meta(1)%VARNS=''
3696  meta(1)%VARNG='wave_to_sea_ice_energy_flux'
3697  meta(1)%VMIN = 0
3698  meta(1)%VMAX = 999
3699  ! IFI=6, IFJ=12, USP
3700  meta => group(6)%FIELD(12)%META
3701  meta(1)%UNITS = 'm s-1'
3702  meta(1)%FSC = 0.0005
3703  meta(1)%ENAME = '.usp'
3704  meta(1)%VARND = dircom
3705  meta(1)%VMIN = -9.99
3706  meta(1)%VMAX = 9.98
3707 
3708  ! First component
3709  meta(1)%VARNM='ussp'
3710  meta(1)%VARNL='eastward partitioned surface stokes drift'
3711  !META(1)%VARNS='eastward_partitioned_surface_stokes_drift'
3712  meta(1)%VARNS=''
3713  meta(1)%VARNG='eastward_partitioned_surface_stokes_drift'
3714  meta(1)%VARNC='usp=sqrt(ussp**2+vssp**2)'
3715 
3716  ! Second component
3717  meta(2) = meta(1)
3718  meta(2)%VARNM='vssp'
3719  meta(2)%VARNL='northward partitioned surface stokes drift'
3720  !META(2)%VARNS='northward_partitioned_surface_stokes_drift'
3721  meta(2)%VARNS=''
3722  meta(2)%VARNG='northward_partitioned_surface_stokes_drift'
3723  meta(2)%VARNC='usp=sqrt(ussp**2+vssp**2)'
3724  ! IFI=6, IFJ=13
3725  meta => group(6)%FIELD(13)%META
3726  meta(1)%UNITS = 'Pa'
3727  meta(1)%FSC = 0.01
3728  meta(1)%ENAME = '.toc'
3729  meta(1)%VMIN = -320
3730  meta(1)%VMAX = 320
3731  meta(1)%VARND = dircom
3732 
3733  ! First component
3734  meta(1)%VARNM='utoc'
3735  meta(1)%VARNL='eastward total wave to ocean stres'
3736  meta(1)%VARNS=''
3737  meta(1)%VARNG=''
3738  meta(1)%VARNC='toc=sqrt(utoc**2+vtoc**2)'
3739 
3740  ! Second component
3741  meta(2) = meta(1)
3742  meta(2)%VARNM='vtoc'
3743  meta(2)%VARNL='northward total wave to ocean stres'
3744  meta(2)%VARNS=''
3745  meta(2)%VARNG=''
3746  meta(2)%VARNC='toc=sqrt(utoc**2+vtoc**2)'
3747  !
3748  !---------- GROUP 7 ----------------
3749  !
3750  ! IFI=7, IFJ=1, ABR
3751  meta => group(7)%FIELD(1)%META
3752  meta(1)%FSC = 0.01
3753  meta(1)%ENAME = '.abr'
3754  meta(1)%UNITS = 'm'
3755  meta(1)%VMIN = -180
3756  meta(1)%VMAX = 180
3757  meta(1)%VARND = dircom
3758 
3759  ! First component
3760  meta(1)%VARNM='uabr'
3761  meta(1)%VARNL='rms of bottom displacement amplitude zonal'
3762  !META(1)%VARNS='rms_of_bottom_displacement_amplitude_zonal'
3763  meta(1)%VARNS=''
3764  meta(1)%VARNG='rms_of_bottom_displacement_amplitude_zonal'
3765  meta(1)%VARNC='abr=sqrt(uabr**2+vabr**2)'
3766 
3767  ! Second component
3768  meta(2) = meta(1)
3769  meta(2)%VARNM='vabr'
3770  meta(2)%VARNL='rms of bottom displacement amplitude meridional'
3771  !META(2)%VARNS='rms_of_bottom_displacement_amplitude_meridional'
3772  meta(2)%VARNS=''
3773  meta(2)%VARNG='rms_of_bottom_displacement_amplitude_meridional'
3774  meta(2)%VARNC='abr=sqrt(uabr**2+vabr**2)'
3775  ! IFI=7, IFJ=2, UBR
3776  meta => group(7)%FIELD(2)%META
3777  meta(1)%FSC = 0.01
3778  meta(1)%ENAME = '.ubr'
3779  meta(1)%UNITS = 'm s-1'
3780  meta(1)%VMIN = -180
3781  meta(1)%VMAX = 180
3782  meta(1)%VARND = dircom
3783 
3784  ! First component
3785  meta(1)%VARNM='uubr'
3786  meta(1)%VARNL='rms of bottom velocity amplitude zonal'
3787  !META(1)%VARNS='rms_of_bottom_velocity_amplitude_zonal'
3788  meta(1)%VARNS=''
3789  meta(1)%VARNG='rms_of_bottom_velocity_amplitude_zonal'
3790  meta(1)%VARNC='ubr=sqrt(uubr**2+vubr**2)'
3791 
3792  ! Second component
3793  meta(2) = meta(1)
3794  meta(2)%VARNM='vubr'
3795  meta(2)%VARNL='rms of bottom velocity amplitude meridional'
3796  !META(2)%VARNS='rms_of_bottom_velocity_amplitude_meridional'
3797  meta(2)%VARNS=''
3798  meta(2)%VARNG='rms_of_bottom_velocity_amplitude_meridional'
3799  ! IFI=7, IFJ=3, BED
3800  meta => group(7)%FIELD(3)%META
3801  meta(1)%FSC = 0.001
3802  meta(1)%UNITS = 'm'
3803  meta(1)%ENAME = '.bed'
3804  meta(1)%VMIN = 0
3805  meta(1)%VMAX = 30
3806  meta(1)%VARND = dircom
3807 
3808  ! First component
3809  meta(1)%VARNM='bed'
3810  meta(1)%VARNL='bottom roughness'
3811  !META(1)%VARNS='sea bottom roughness length'
3812  meta(1)%VARNS=''
3813  meta(1)%VARNG='ripple_wavelength'
3814  meta(1)%VARNC='ripple_length=sqrt(ripplex**2+rippley**2)'
3815 
3816  ! Second component
3817  meta(2) = meta(1)
3818  meta(2)%VARNM='ripplex'
3819  meta(2)%VARNL='eastward sea bottom ripple wavelength'
3820  !META(2)%VARNS='eastward_ripple_wavelength'
3821  meta(2)%VARNS=''
3822  meta(2)%VARNG='eastward_ripple_wavelength'
3823  meta(2)%VARNC='ripple_length=sqrt(ripplex**2+rippley**2)'
3824 
3825  ! Third component
3826  meta(3) = meta(1)
3827  meta(3)%VARNM='rippley'
3828  meta(3)%VARNL='northward sea bottom ripple wavelength'
3829  !META(3)%VARNS='northward_ripple_wavelength'
3830  meta(3)%VARNS=''
3831  meta(3)%VARNG='northward_ripple_wavelength'
3832  meta(3)%VARNC='ripple_length=sqrt(ripplex**2+rippley**2)'
3833  ! IFI=7, IFJ=4, FBB
3834  meta => group(7)%FIELD(4)%META
3835  meta(1)%FSC = 0.1
3836  meta(1)%UNITS = 'W m-2'
3837  meta(1)%ENAME = '.fbb'
3838  meta(1)%VARNM='fbb'
3839  meta(1)%VARNL='wave dissipation in bbl'
3840  !META(1)%VARNS='wave_energy_dissipation_in_bottom_boundary_layer'
3841  meta(1)%VARNS=''
3842  meta(1)%VARNG='wave_dissipation_in_bbl'
3843  meta(1)%VMIN = 0
3844  meta(1)%VMAX = 999
3845  ! IFI=7, IFJ=5, TBB
3846  meta => group(7)%FIELD(5)%META
3847  meta(1)%FSC = 0.000001
3848  meta(1)%UNITS = 'm2 s-2'
3849  meta(1)%ENAME = '.tbb'
3850  meta(1)%VMIN = -0.032
3851  meta(1)%VMAX = 0.032
3852  meta(1)%VARND = dircom
3853 
3854  ! First component
3855  meta(1)%VARNM='utbb'
3856  meta(1)%VARNL='eastward wave to bbl stress'
3857  !META(1)%VARNS='eastward_wave_to_bottom_boundary_layer_stress'
3858  meta(1)%VARNS=''
3859  meta(1)%VARNG='eastward_wave_to_bbl_stress'
3860  meta(1)%VARNC='tbb=sqrt(utbb**2+vtbb**2)'
3861 
3862  ! Second component
3863  meta(2) = meta(1)
3864  meta(2)%VARNM='vtbb'
3865  meta(2)%VARNL='northward wave to bbl stress'
3866  !META(2)%VARNS='northward_wave_to_bottom_boundary_layer_stress'
3867  meta(2)%VARNS=''
3868  meta(2)%VARNG='northward_wave_to_bbl_stress'
3869  meta(2)%VARNC='tbb=sqrt(utbb**2+vtbb**2)'
3870  !
3871  !---------- GROUP 8 ----------------
3872  ! IFI=8, IFJ=1, MSS
3873  meta => group(8)%FIELD(1)%META
3874  meta(1)%FSC = 0.00001
3875  meta(1)%ENAME = '.mss'
3876  meta(1)%UNITS = '1'
3877  meta(1)%VMIN = 0
3878  meta(1)%VMAX = 0.3
3879  meta(1)%VARND = dircom
3880  WRITE(meta(1)%VARNC,'(A,F8.4,A,F8.4,A)') 'Frequency range ',sig(1)*tpiinv,' to ',sig(nk)*tpiinv,' Hz'
3881 
3882  ! First component
3883  meta(1)%VARNM='mssu'
3884  meta(1)%VARNL='downwave mean square slope'
3885  meta(1)%VARNS='sea_surface_wave_mean_square_upwave_slope'
3886  meta(1)%VARNG='x_mean_square_slope'
3887  meta(1)%VARNC='mss=mssu+mssc'
3888 
3889  ! Second component
3890  meta(2) = meta(1)
3891  meta(2)%VARNM='mssc'
3892  meta(2)%VARNL='crosswave mean square slope'
3893  meta(2)%VARNS='sea_surface_wave_mean_square_crosswave_slope'
3894  meta(2)%VARNG='y_mean_square_slope'
3895  ! IFI=8, IFJ=2, MSC
3896  meta => group(8)%FIELD(2)%META
3897  meta(1)%FSC = 1e-7
3898  meta(1)%ENAME = '.msc'
3899  meta(1)%UNITS = '1'
3900  meta(1)%VMIN = 0
3901  meta(1)%VMAX = 0.003
3902  meta(1)%VARND = dircom
3903 
3904  ! First component
3905  meta(1)%VARNM='mscx'
3906  meta(1)%VARNL='eastward phillips constant'
3907  !META(1)%VARNS='eastward_phillips_constant'
3908  meta(1)%VARNS=''
3909  meta(1)%VARNG='eastward_phillips_constant'
3910  meta(1)%VARNC='msc=mscx+mscy'
3911 
3912  ! Second component
3913  meta(2) = meta(1)
3914  meta(2)%VARNM='mscy'
3915  meta(2)%VARNL='northward phillips constant'
3916  !META(2)%VARNS='northward_phillips_constant'
3917  meta(2)%VARNS=''
3918  meta(2)%VARNG='northward_phillips_constant'
3919  meta(2)%VARNC='msc=mscx+mscy'
3920  ! IFI=8, IFJ=3, MSD
3921  meta => group(8)%FIELD(3)%META
3922  meta(1)%FSC = 0.1
3923  meta(1)%UNITS = 'degree'
3924  meta(1)%ENAME = '.msd'
3925  meta(1)%VARNM='mssd'
3926  meta(1)%VARNL='u direction for mss'
3927  meta(1)%VARNS='sea_surface_mean_square_upwave_slope_direction'
3928  meta(1)%VARNG='sea_surface_wave_dominant_mean_square_slope_direction'
3929  WRITE(meta(1)%VARNC,'(A,F8.4,A,F8.4,A)') 'Frequency range ',sig(1)*tpiinv,' to ',sig(nk)*tpiinv,' Hz'
3930  meta(1)%VARND = dircom
3931  meta(1)%VMIN = 0
3932  meta(1)%VMAX = 360
3933  ! IFI=8, IFJ=4, MCD
3934  meta => group(8)%FIELD(4)%META
3935  meta(1)%FSC = 0.1
3936  meta(1)%UNITS = 'degree'
3937  meta(1)%ENAME = '.mcd'
3938  meta(1)%VARNM='mscd'
3939  meta(1)%VARNL='x direction for msc'
3940  !META(1)%VARNS='sea_surface_wave_dominant_mean_square_slope_direction_in_highest_frequency'
3941  meta(1)%VARNS=''
3942  meta(1)%VARNG='sea_surface_wave_dominant_mean_square_slope_direction_in_highest_frequency'
3943  meta(1)%VARND = dircom
3944  meta(1)%VMIN = 0
3945  meta(1)%VMAX = 360
3946  ! IFI=8, IFJ=5, QP
3947  meta => group(8)%FIELD(5)%META
3948  meta(1)%FSC = 0.001
3949  meta(1)%UNITS = '1'
3950  meta(1)%ENAME = '.qp'
3951  meta(1)%VARNM='qp'
3952  meta(1)%VARNL='peakedness'
3953  !META(1)%VARNS='sea_surface_wave_peakedness'
3954  meta(1)%VARNS=''
3955  meta(1)%VARNG='wave_peakedness'
3956  meta(1)%VARNC='Goda wave peakedness parameter'
3957  meta(1)%VMIN = 0
3958  meta(1)%VMAX = 32
3959  ! IFI=8, IFJ=6, QKK
3960  meta => group(8)%FIELD(6)%META
3961  meta(1)%FSC = 0.05
3962  meta(1)%UNITS = 'm/rad'
3963  meta(1)%ENAME = '.qkk'
3964  meta(1)%VARNM='qkk'
3965  meta(1)%VARNL='k-peakedness'
3966  !META(1)%VARNS='sea_surface_wave_peakedness'
3967  meta(1)%VARNS=''
3968  meta(1)%VARNG='wavenumber_peakedness'
3969  meta(1)%VARNC='2D wavenumber peakedness'
3970  meta(1)%VMIN = 0
3971  meta(1)%VMAX = 1600
3972  ! IFI=8, IFJ=7, SKW
3973  meta => group(8)%FIELD(7)%META
3974  meta(1)%FSC = 0.00001
3975  meta(1)%UNITS = '1'
3976  meta(1)%ENAME = '.skw'
3977  meta(1)%VARNM='skw'
3978  meta(1)%VARNL='skewness'
3979  !META(1)%VARNS='sea_surface_wave_peakedness'
3980  meta(1)%VARNS=''
3981  meta(1)%VARNG='skewness of P(z,sx,sy=0)'
3982  meta(1)%VARNC='skewness of P(z,sx,sy=0)'
3983  meta(1)%VMIN = 0
3984  meta(1)%VMAX = 1
3985  ! IFI=8, IFJ=8, EMB
3986  meta => group(8)%FIELD(8)%META
3987  meta(1)%FSC = 0.00001
3988  meta(1)%UNITS = '1'
3989  meta(1)%ENAME = '.emb'
3990  meta(1)%VARNM='emb'
3991  meta(1)%VARNL='EM-bias'
3992  !META(1)%VARNS='sea_surface_wave_peakedness'
3993  meta(1)%VARNS=''
3994  meta(1)%VARNG='EM bias coefficient'
3995  meta(1)%VARNC='EM bias coefficient'
3996  meta(1)%VMIN = -1
3997  meta(1)%VMAX = 1
3998  ! IFI=8, IFJ=7, SKW
3999  meta => group(8)%FIELD(9)%META
4000  meta(1)%FSC = 0.00001
4001  meta(1)%UNITS = '1'
4002  meta(1)%ENAME = '.emc'
4003  meta(1)%VARNM='emc'
4004  meta(1)%VARNL='trackerbias'
4005  !META(1)%VARNS='sea_surface_wave_peakedness'
4006  meta(1)%VARNS=''
4007  meta(1)%VARNG='tracker bias coefficient'
4008  meta(1)%VARNC='tracker bias coefficient'
4009  meta(1)%VMIN = -1
4010  meta(1)%VMAX = 1 !
4011  !
4012  !---------- GROUP 9 ----------------
4013  !
4014  ! IFI=9, IFJ=1, DTD
4015  meta => group(9)%FIELD(1)%META
4016  meta(1)%FSC = 0.1
4017  meta(1)%UNITS = 'min.'
4018  meta(1)%ENAME = '.dtd'
4019  meta(1)%VARNM='dtd'
4020  meta(1)%VARNL='dynamic time step'
4021  !META(1)%VARNS='dynamic_time_step'
4022  meta(1)%VARNS=''
4023  meta(1)%VARNG='dynamic_time_step'
4024  meta(1)%VMIN = 0
4025  meta(1)%VMAX = 3200
4026  ! IFI=9, IFJ=2, FC
4027  meta => group(9)%FIELD(2)%META
4028  meta(1)%FSC = 0.001
4029  meta(1)%UNITS = 's-1'
4030  meta(1)%ENAME = '.fc'
4031  meta(1)%VARNM='fc'
4032  meta(1)%VARNL='cut off frequency'
4033  !META(1)%VARNS='cut_off_frequency'
4034  meta(1)%VARNS=''
4035  meta(1)%VARNG='cut_off_frequency'
4036  meta(1)%VMIN = 0
4037  meta(1)%VMAX = 8
4038  ! IFI=9, IFJ=3, CFX
4039  meta => group(9)%FIELD(3)%META
4040  meta(1)%FSC = 0.01
4041  meta(1)%UNITS = '1'
4042  meta(1)%ENAME = '.cfx'
4043  meta(1)%VARNM='cfx'
4044  meta(1)%VARNL='maximum cfl for spatial advection'
4045  !META(1)%VARNS='maximum_cfl_for_spatial_advection'
4046  meta(1)%VARNS=''
4047  meta(1)%VARNG='maximum_cfl_for_spatial_advection'
4048  meta(1)%VMIN = 0
4049  meta(1)%VMAX = 320
4050  ! IFI=9, IFJ=4, CFD
4051  meta => group(9)%FIELD(4)%META
4052  meta(1)%FSC = 0.01
4053  meta(1)%UNITS = '1'
4054  meta(1)%ENAME = '.cfd'
4055  meta(1)%VARNM='cfd'
4056  meta(1)%VARNL='maximum cfl for direction advection'
4057  !META(1)%VARNS='maximum_cfl_for_direction_advection'
4058  meta(1)%VARNS=''
4059  meta(1)%VARNG='maximum_cfl_for_direction_advection'
4060  meta(1)%VMIN = 0
4061  meta(1)%VMAX = 320
4062  ! IFI=9, IFJ=5, CFK
4063  meta => group(9)%FIELD(5)%META
4064  meta(1)%FSC = 0.01
4065  meta(1)%UNITS = '1'
4066  meta(1)%ENAME = '.cfk'
4067  meta(1)%VARNM='cfk'
4068  meta(1)%VARNL='maximum cfl for frequency advection'
4069  !META(1)%VARNS='maximum_cfl_for_frequency_advection'
4070  meta(1)%VARNS=''
4071  meta(1)%VARNG='maximum_cfl_for_frequency_advection'
4072  meta(1)%VMIN = 0
4073  meta(1)%VMAX = 320
4074  !
4075  ! ------ Group 10 (User defined) -------
4076  !
4077  ! IFI=10, IFJ=1
4078  meta => group(10)%FIELD(1)%META
4079  meta(1)%FSC = 0.1
4080  meta(1)%UNITS = 'm'
4081  meta(1)%VMIN = 0
4082  meta(1)%VMAX = 0
4083  WRITE (meta(1)%ENAME,'(A2,I2.2)') '.u'
4084  WRITE (meta(1)%VARNM,'(A1,I2.2)') 'u'
4085  WRITE (meta(1)%VARNL,'(A12,I2.2)') 'User_defined'
4086  WRITE (meta(1)%VARNS,'(A12,I2.2)') 'User_defined'
4087  WRITE (meta(1)%VARNG,'(A12,I2.2)') 'user_defined'
4088  !

References dircom, group, ipart_token, ncvartype, partcom, and spart_token_.

Referenced by init_meta().

◆ get_attval_type()

subroutine w3ounfmetamd::get_attval_type ( character(*), intent(in)  BUF,
integer, intent(in)  ILINE,
character(*), intent(out)  ATTV,
character(*), intent(out)  ATT_TYPE 
)

Gets the attribute value and optional variable type from the passed in string.

If two freeform values can be read from the input string, it is assumed to be a value and type, otherwise if only one value can be read the type is assumed to be "character".

It is important to quote strings if they contain spaces.

Valid types are "c" "r/f", and "i" for character, real/float and integer values.

Parameters
[in]BUFInput string to process
[in]ILINELine number (for error reporting)
[out]ATTVAttribute value
[out]ATT_TYPEAttribute type
Author
Chris Bunney
Date
09-Nov-2020

Definition at line 1225 of file w3ounfmetamd.F90.

1225  !/
1226  !/ +-----------------------------------+
1227  !/ | WAVEWATCH III NOAA/NCEP |
1228  !/ | C. Bunney |
1229  !/ | |
1230  !/ | FORTRAN 90 |
1231  !/ | Last update : 09-Nov-2020 |
1232  !/ +-----------------------------------+
1233  !/
1234  !/ 09-Nov-2020 : Creation ( version 7.12 )
1235  !/
1236  !
1237  ! 1. Purpose :
1238  !
1239  ! Gets the attribute value and optional variable type from
1240  ! the passed in string.
1241  !
1242  ! 2. Method:
1243  !
1244  ! If two freeform values can be read from the input string, it is
1245  ! assumed to be a value and type, otherwise if only one value can
1246  ! be read the type is assumed to be "character".
1247  !
1248  ! It is important to quote strings if they contain spaces.
1249  !
1250  ! Valid types are "c" "r/f", and "i" for character, real/float and
1251  ! integer values.
1252 
1253  ! 3. Parameters :
1254  !
1255  ! Parameter list
1256  ! ----------------------------------------------------------------
1257  ! BUF Char. I Input string to process
1258  ! ILINE Int. I Line number (for error reporting)
1259  ! ATTV Char. O Attribute value
1260  ! ATT_TYPE Char. O Attribute type
1261  ! ----------------------------------------------------------------
1262  !
1263  !/ ------------------------------------------------------------------- /
1264  IMPLICIT NONE
1265 
1266  CHARACTER(*), INTENT(IN) :: BUF
1267  INTEGER, INTENT(IN) :: ILINE
1268  CHARACTER(*), INTENT(OUT) :: ATTV, ATT_TYPE
1269  !/ ------------------------------------------------------------------- /
1270  !/ Local parameters
1271  !
1272  REAL :: R
1273  INTEGER :: I, IERR
1274 
1275  ! Get attribute and type (default to "c" if no type set)
1276  att_type = 'c'
1277  attv = ''
1278  READ(buf, *, iostat=ierr) attv, att_type
1279  IF(ierr /= 0) READ(buf, *, iostat=ierr) attv
1280 
1281  ! Check attr values are valid w.r.t. attr type
1282  SELECT CASE(trim(att_type))
1283 
1284  CASE("i")
1285  READ(attv, *, iostat=ierr) i
1286  IF(ierr .ne. 0) then
1287  WRITE(ndse, 8001) "INTEGER", trim(fn_meta), iline, trim(attv)
1288  CALL extcde(10)
1289  ENDIF
1290 
1291  CASE("r", "f")
1292  READ(attv, *, iostat=ierr) r
1293  IF(ierr .ne. 0) THEN
1294  WRITE(ndse, 8001) "REAL/FLOAT", trim(fn_meta), iline, trim(attv)
1295  CALL extcde(10)
1296  ENDIF
1297 
1298  CASE("c")
1299  ! Always ok.
1300 
1301  CASE DEFAULT
1302  WRITE(ndse, 8002) trim(fn_meta), iline, trim(buf)
1303  CALL extcde(10)
1304 
1305  END SELECT
1306  !
1307 8001 FORMAT (/' *** WAVEWATCH III ERROR IN W3OUNFMETA : '/ &
1308  ' VALUE IS NOT A VALID ', a / &
1309  ' FILENAME = ', a / &
1310  ' LINE NO =', i5 / &
1311  ' => ', a /)
1312  !
1313 8002 FORMAT (/' *** WAVEWATCH III ERROR IN W3OUNFMETA : '/ &
1314  ' ATTRIBUTE TYPE SHOULD BE ONE OF [c,i,r] '/ &
1315  ' FILENAME = ', a / &
1316  ' LINE NO =', i5 / &
1317  ' => ', a /)
1318  !

References fn_meta.

Referenced by read_freeform_meta_list(), and read_meta_pairs().

◆ getmeta()

type(meta_t) function w3ounfmetamd::getmeta ( integer, intent(in)  IFI,
integer, intent(in)  IFJ,
integer, intent(in), optional  ICOMP,
integer, intent(in), optional  IPART 
)

Get the meta data for a particular field.

The required field is specified using the group (IFI) and field (IFJ) index. Optionally, the component (ICOMP) and partition (IPART) numbers can be specified for vector/tensor or partitioned parameter fields. If not specified, these default to 1. A copy of the meta-data is returned, rather than a pointer. This is because in the case of paritioned parameters, the metadata will be updated with the partition number.

Parameters
[in]IFIOutput group number
[in]IFJOutput field number
[in]ICOMPComponent number (defaults to 1)
[in]IPARTPartition number (defaults to 1)
Author
Chris Bunney
Date
02-Nov-2020

Definition at line 1610 of file w3ounfmetamd.F90.

1610  !/
1611  !/ +-----------------------------------+
1612  !/ | WAVEWATCH III NOAA/NCEP |
1613  !/ | C. Bunney |
1614  !/ | |
1615  !/ | FORTRAN 90 |
1616  !/ | Last update : 02-Nov-2020 |
1617  !/ +-----------------------------------+
1618  !/
1619  !/ 09-Nov-2020 : Creation ( version 7.12 )
1620  !/
1621  !
1622  ! 1. Purpose :
1623  !
1624  ! Returns a META_T type containig the netCDF matadata for the
1625  ! requested field
1626  !
1627  ! 2. Method :
1628  !
1629  ! A copy of the meta-data is returned, rather than a pointer. This
1630  ! is because in the case of paritioned parameters, the metadata
1631  ! will be updated with the partition number.
1632  !
1633  ! 3. Parameters :
1634  !
1635  ! Parameter list
1636  ! ----------------------------------------------------------------
1637  ! IFI Int. I Output group number
1638  ! IFJ Int. I Output field number
1639  ! ICOMP Int. I Component number (defaults to 1)
1640  ! IPART Int. I Partition number (defaults to 1)
1641  ! ----------------------------------------------------------------
1642  !
1643  !/ ------------------------------------------------------------------- /
1644  IMPLICIT NONE
1645  INTEGER, INTENT(IN) :: IFI, IFJ
1646  INTEGER, INTENT(IN), OPTIONAL :: ICOMP, IPART
1647  !/
1648  !/ ------------------------------------------------------------------- /
1649  !/ Local parameters
1650  !/
1651  INTEGER :: IFP, IFC
1652  TYPE(META_T) :: META ! Not pointer as we might need to modify it
1653 
1654  ifc = 1
1655  ifp = 1
1656  IF(PRESENT(icomp)) ifc = icomp
1657  IF(PRESENT(ipart)) ifp = ipart
1658 
1659  ! Error checking on size of IFJ, ICOMP, IPART.
1660  IF(ifi .LT. 1 .OR. ifi .GT. nogrp) THEN
1661  WRITE(ndse,1000) nogrp
1662  CALL extcde(1)
1663  ENDIF
1664  IF(ifj .LT. 1 .OR. ifj .GT. noge(ifi)) THEN
1665  WRITE(ndse,1001) noge(ifi)
1666  CALL extcde(1)
1667  ENDIF
1668  IF(ifc .LT. 1 .OR. ifc .GT. 3) THEN
1669  WRITE(ndse,1002)
1670  CALL extcde(1)
1671  ENDIF
1672 
1673  meta = meta_deep_copy(group(ifi)%FIELD(ifj)%META(ifc))
1674 
1675  ! For partitioned data, expand in the partition number:
1676  IF(ifi .EQ. 4) THEN
1677  CALL add_partno(meta, ifp)
1678  ENDIF
1679 
1680  RETURN
1681 
1682 1000 FORMAT (/' *** WAVEWATCH III ERROR IN W3OUNFMETA : ' / &
1683  ' GETMETA: IFI value should be in range 1,',i2 / )
1684  !
1685 1001 FORMAT (/' *** WAVEWATCH III ERROR IN W3OUNFMETA : ' / &
1686  ' GETMETA: IFJ value should be in range 1,',i2 / )
1687  !
1688 1002 FORMAT (/' *** WAVEWATCH III ERROR IN W3OUNFMETA : ' / &
1689  ' GETMETA: IFC value should be in range 1,3' / )
1690  !

References add_partno(), group, and meta_deep_copy().

Referenced by w3ounf().

◆ init_meta()

subroutine w3ounfmetamd::init_meta ( logical, intent(in), optional  VEC)

Allocates space for the META_T arrays and sets some defaults.

By default, directional fields will be set up to output a magnitude and direction field. Alternatively, if VEC is set to True, then u/v vectors will be generated instead.

Note
- vector output is currently only implemented for the "current" and "wind" fields.
Parameters
VECOutput vectors for directional fields rather than direction/magnitude.
Author
Chris Bunney
Date
09-Mar-2020

Definition at line 299 of file w3ounfmetamd.F90.

299  !/
300  !/ +-----------------------------------+
301  !/ | WAVEWATCH III NOAA/NCEP |
302  !/ | C. Bunney |
303  !/ | |
304  !/ | FORTRAN 90 |
305  !/ | Last update : 22-Mar-2021 |
306  !/ +-----------------------------------+
307  !/
308  !/ 09-Nov-2020 : Creation ( version 7.12 )
309  !/ 22-Mar-2021 : Added vector flag ( version 7.12 )
310  !/
311  !
312  ! 1. Purpose :
313  !
314  ! Allocates space for the META_T arrays and sets some constants.
315  !
316  !/ ------------------------------------------------------------------- /
317  IMPLICIT NONE
318 
319  LOGICAL, INTENT(IN), OPTIONAL :: VEC
320  !/
321  !/ ------------------------------------------------------------------- /
322  !/ Local parameters
323  !/
324  LOGICAL :: FLGNML
325  INTEGER :: I, J
326 
327  vector = .true.
328  IF(PRESENT(vec)) vector = vec
329 #ifdef W3_RTD
330  ! Is the grid really rotated?
331  IF ( polat < 90. ) flrtd = .true.
332 #endif
333 #if defined W3_SMC && defined W3_RTD
334  ! SMC type 3/4 outputs are currently on standard pole grid only
335  IF(smcotype .EQ. 3 .OR. smcotype .EQ. 4) flrtd = .false.
336 #endif
337 
338  ! 1. Allocate nested GROUP, FIELD structure:
339  ALLOCATE(group(nogrp))
340  DO i = 1,nogrp
341  ALLOCATE(group(i)%FIELD(noge(i)))
342  DO j = 1,noge(i)
343  ALLOCATE(group(i)%FIELD(j)%META(3)) ! Hardcode to 3 components for the moment
344  ENDDO
345  ENDDO
346 
347  ! 1.1 Make sure partitioned template pointer is null (i.e. empty list)
348  NULLIFY(part_tmpl)
349 
350  ! 2. Set direction convention:
351  dircom = ""
352 #ifdef W3_RTD
353  IF( flrtd ) THEN
354  IF ( flagunr ) THEN
355  dircom = 'True North'
356  ELSE IF ( .NOT. flagunr ) THEN
357  dircom = 'Rotated Pole Grid North'
358  ENDIF
359  ENDIF
360 #endif
361 
362  ! Set partitioning method comment and standard name templates:
363  IF( ptmeth .LE. 3 ) THEN
364  snamep(1) = 'wind'
365  snamep(2) = 'primary swell'
366  snamep(3) = 'secondary swell'
367  snamep(4) = 'tertiary swell'
368  snamep(5) = 'swell'
369  ELSE
370  snamep(1) = 'wind'
371  snamep(2) = 'swell'
372  snamep(3:5) = ''
373  ENDIF
374 
375  IF ( ptmeth .EQ. 1 ) THEN
376  partcom = "Wind sea and swells defined using topographic " // &
377  "partitions and partition wave-age cut-off " // &
378  "(WWIII default scheme)"
379  ELSE IF ( ptmeth .EQ. 2 ) THEN
380  partcom = "Wind sea and swells defined using topographic " // &
381  "partitions and spectral wave-age cut-off"
382  ELSE IF ( ptmeth .EQ. 3 ) THEN
383  partcom = "Wave components defined using topographic " // &
384  "partitions only"
385  ELSE IF ( ptmeth .EQ. 4 ) THEN
386  partcom = "Wind sea and swell defined using spectral " // &
387  "wave-age cut-off"
388  ELSE IF ( ptmeth .EQ. 5 ) THEN
389  WRITE(partcom, '("Wave components defined using ",F5.3,' // &
390  '"Hz spectral frequency cutoff")') ptfcut
391  ELSE
392  WRITE(partcom, '("PTM_",I1,"_Unknown")') ptmeth
393  ENDIF
394 
395  ! 3. Set the default values for the OUNF netCDF meta data.
396  CALL default_meta()
397 
398  ! Set the default coordiante reference system (if applicable)
399  CALL default_crs_meta()
400 
401  ! If the ounfmeta.inp exists, read this in to override defaults:
402  INQUIRE(file=trim(fnmpre)//"ounfmeta.inp", exist=flgnml)
403  IF(flgnml) THEN
404  CALL read_meta()
405  ENDIF
406 

References default_crs_meta(), default_meta(), dircom, file(), w3gdatmd::flagunr, flrtd, w3odatmd::fnmpre, group, w3odatmd::noge, w3odatmd::nogrp, part_tmpl, partcom, w3gdatmd::polat, w3odatmd::ptfcut, w3odatmd::ptmeth, read_meta(), w3smcomd::smcotype, and snamep.

Referenced by w3ounf().

◆ meta_deep_copy()

type(meta_t) function w3ounfmetamd::meta_deep_copy ( type(meta_t), intent(in)  META)

Performs "deep" copy of a META_T type.

A "deep" copy ensures that the linked list data in the EXTRA field is copied, rather than just copying the pointer.

Calls copy_meta_list() internally to copy the EXTRA linked list.

Returns
A new META_T variable
Parameters
[in]METAMETA data structure to copy
Author
Chris Bunney
Date
16-Dec-2020

Definition at line 2448 of file w3ounfmetamd.F90.

2448  !/ +-----------------------------------+
2449  !/ | WAVEWATCH III NOAA/NCEP |
2450  !/ | C. Bunney |
2451  !/ | |
2452  !/ | FORTRAN 90 |
2453  !/ | Last update : 16-Dec-2020 |
2454  !/ +-----------------------------------+
2455  !/
2456  !/ 16-Dec-2020 : Creation ( version 7.12 )
2457  !/
2458  !
2459  ! 1. Purpose :
2460  !
2461  ! Performs "Deep" copy of a META_T type. This ensures that the
2462  ! linked list data in the EXTRA field is copied, rather than just
2463  ! copying the pointer.
2464  !
2465  ! 2. Parameters :
2466  !
2467  ! Parameter list
2468  ! ----------------------------------------------------------------
2469  ! META META_T. I META data structure to copy
2470  ! ----------------------------------------------------------------
2471  !
2472  !/ ------------------------------------------------------------------- /
2473  IMPLICIT NONE
2474  TYPE(META_T), INTENT(IN) :: META
2475  TYPE(META_T) :: COPY
2476 
2477  ! Shallow copy first:
2478  copy = meta
2479 
2480  ! Now deep copy the EXTRA field (is pointer)
2481  copy%EXTRA = copy_meta_list(meta%EXTRA)
2482 

Referenced by getmeta().

◆ next_line()

subroutine w3ounfmetamd::next_line ( integer, intent(in)  NDMI,
character(*), intent(out)  BUF,
integer, intent(inout)  ILINE,
logical, intent(out)  EOF,
logical, intent(out), optional  NEW_SECTION 
)

Reads the next valid line from the user meta input file.

Lines are repeatedly read in from the input file until a valid input line is reached. Blank lines and comment lines (starting with $) are skipped.

If the end of file is reached before any valid line is read then EOF is set to true.

If the next valid line is a new section marker (META or TEMPLATE) then the NEW_SECTION flag is set to true.

Parameters
[in]NDMIUnit number of input file
[out]BUFNext input line read from file
[in,out]ILINELine number of file
[out]EOFTrue if end-of-file is reached.
[out]NEW_SECTIONTrue if new section marker found
Author
Chris Bunney
Date
09-Nov-2020

Definition at line 475 of file w3ounfmetamd.F90.

475  !/
476  !/ +-----------------------------------+
477  !/ | WAVEWATCH III NOAA/NCEP |
478  !/ | C. Bunney |
479  !/ | |
480  !/ | FORTRAN 90 |
481  !/ | Last update : 09-Nov-2020 |
482  !/ +-----------------------------------+
483  !/
484  !/ 09-Nov-2020 : Creation ( version 7.12 )
485  !/
486  !
487  ! 1. Purpose :
488  !
489  ! Reads the next valid line from the user meta input file.
490  !
491  ! 2. Method :
492  ! Lines are repeatedly read in from the input file until
493  ! a valid input line is reached. Blank lines and comment lines
494  ! (starting with $) are skipped.
495  !
496  ! If the end of file is reached before any valid line is read
497  ! then EOF is set to true.
498  !
499  ! If the next valid line is a new section marker (META or TEMPLATE)
500  ! then the NEW_SECTION flag is set to true.
501  !
502  ! 3. Parameters :
503  !
504  ! Parameter list
505  ! ----------------------------------------------------------------
506  ! NDMI Int. I Unit number of input file
507  ! BUF Char. O Next input line read from file
508  ! ILINE Int. I/O Line number of file
509  ! EOF Bool. O True if end-of-file is reached.
510  ! NEW_SECTION
511  ! Bool. O True if new section marker found
512  ! ----------------------------------------------------------------
513  !
514  !/ ------------------------------------------------------------------- /
515  IMPLICIT NONE
516 
517  INTEGER, INTENT(IN) :: NDMI
518  CHARACTER(*), INTENT(OUT) :: BUF
519  INTEGER, INTENT(INOUT) :: ILINE
520  LOGICAL, INTENT(OUT) :: EOF
521  LOGICAL, INTENT(OUT), OPTIONAL :: NEW_SECTION
522  !/ ------------------------------------------------------------------- /
523  !/ Local parameters
524  !/
525  INTEGER :: IERR
526  CHARACTER(LEN=10) :: TEST
527 
528  eof = .false.
529 
530  ! Keep reading from file until we read a line that is not:
531  ! - a blank line
532  ! - a comment line (starting with $)
533  ! - the end of the file
534  DO
535  READ(ndmi, '(A)', iostat=ierr, err=101, end=100) buf
536 
537  iline = iline + 1
538 
539  ! Remove any tab characters from buffer (replace with a space)
540  CALL notabs(buf)
541 
542  ! Empty line?
543  IF(trim(buf) == '') THEN
544  IF(debug) WRITE(*,'(I5,1X,A20)') iline, '[blank line]'
545  cycle
546  ENDIF
547 
548  IF(trim(buf) == "$ DEBUG ON") THEN
549  WRITE(*,'(I5,1X,A20)') iline, '[DEBUG ON]'
550  debug = .true.
551  cycle
552  ENDIF
553 
554  IF(trim(buf) == "$ DEBUG OFF") THEN
555  WRITE(*,'(I5,1X,A20)') iline, '[DEBUG OFF]'
556  debug = .false.
557  cycle
558  ENDIF
559 
560  ! Read first token on line:
561  READ(buf, *) test
562 
563  ! Check for comment:
564  IF(test(1:1) == "$" .OR. trim(buf) == '') THEN
565  IF(debug) WRITE(*,'(I5,1X,A20)') iline, '[comment line]'
566  cycle
567  ENDIF
568 
569  ! Check if is section header
570  IF(PRESENT(new_section)) THEN
571  CALL str_to_upper(test)
572  SELECT CASE(test)
573  CASE ("META", "TEMPLATE", "CRS")
574  new_section = .true.
575  CASE DEFAULT
576  new_section = .false.
577  END SELECT
578  ENDIF
579 
580  ! Anything else can be considered the "next line"
581  RETURN
582  ENDDO
583 
584  !/ Escape locations
585  !
586  ! End of file
587 100 CONTINUE
588  buf = ''
589  eof = .true.
590  RETURN
591  !
592  ! I/O Error
593 101 CONTINUE
594  WRITE(ndse, 1000) fn_meta, iline, ierr
595  CALL extcde(10)
596  !
597 1000 FORMAT (/' *** WAVEWATCH III ERROR IN W3OUNFMETA : '/ &
598  ' ERROR READING METADATA FILE'/ &
599  ' FILENAME = ', a / &
600  ' LINE NO = ', i5 / &
601  ' IOSTAT =',i5 /)
602  !

References w3servmd::extcde(), fn_meta, w3odatmd::ndse, notabs(), and w3servmd::str_to_upper().

Referenced by read_freeform_meta_list(), read_meta(), read_meta_pairs(), and read_part_tmpl().

◆ notabs()

subroutine w3ounfmetamd::notabs ( character(*), intent(inout)  STR)

Replaces tab characters in a string with a space.

Remarks
Assumes ASCII encoding (Tab character is ASCII value 9)
Parameters
[in,out]STRCharacter string to process
Author
Chris Bunney
Date
02-Nov-2020

Definition at line 615 of file w3ounfmetamd.F90.

615  !/
616  !/ +-----------------------------------+
617  !/ | WAVEWATCH III NOAA/NCEP |
618  !/ | C. Bunney |
619  !/ | |
620  !/ | FORTRAN 90 |
621  !/ | Last update : 02-Nov-2020 |
622  !/ +-----------------------------------+
623  !/
624  !/ 02-Nov-2020 : Creation ( version 7.12 )
625  !/
626  !
627  ! 1. Purpose :
628  !
629  ! Replaces tab characters in a string with a space.
630  !
631  ! 2. Parameters :
632  !
633  ! Parameter list
634  ! ----------------------------------------------------------------
635  ! STR Char. I/O Character string to process
636  ! ----------------------------------------------------------------
637  !
638  ! 3. Remarks :
639  !
640  ! Assumes ASCII encoding! Tab character is ASCII value 9.
641  !
642  !/ ------------------------------------------------------------------- /
643  IMPLICIT NONE
644  CHARACTER(*), INTENT(INOUT) :: STR
645  !/ ------------------------------------------------------------------- /
646  !/ Local parameters
647  !/
648  INTEGER, PARAMETER :: ASCII_TAB = 9
649  INTEGER :: SLEN
650  INTEGER :: I
651  !
652  slen = len_trim(str)
653 
654  DO i=1,slen
655  IF(ichar(str(i:i)) == ascii_tab) THEN
656  str(i:i) = ' '
657  ENDIF
658  ENDDO
659 

Referenced by next_line().

◆ partno_string_sub()

subroutine w3ounfmetamd::partno_string_sub ( character(len=*), intent(inout)  INSTR,
integer, intent(in)  IPART 
)

Performs string substition of placeholder strings with partition number specfic values.

The placeholder <IPART> is automatically replaced with the partition number (0, 1, 2, etc).

Other template placeholders can be defined in the ounfmeta.inp file by the user.

Parameters
[in,out]INSTRInput string
[in]IPARTPartition number
Author
Chris Bunney
Date
02-Nov-2020

Definition at line 1977 of file w3ounfmetamd.F90.

1977  !/
1978  !/ +-----------------------------------+
1979  !/ | WAVEWATCH III NOAA/NCEP |
1980  !/ | C. Bunney |
1981  !/ | |
1982  !/ | FORTRAN 90 |
1983  !/ | Last update : 02-Nov-2020 |
1984  !/ +-----------------------------------+
1985  !/
1986  !/ 09-Nov-2020 : Creation ( version 7.12 )
1987  !/
1988  !
1989  ! 1. Purpose :
1990  !
1991  ! Performs string substition of placeholder strings with partition
1992  ! number specfic values.
1993  !
1994  ! The placeholder <IPART> is automatically replaced with the
1995  ! partition number (0, 1, 2, etc).
1996  !
1997  ! Other template placeholders can be defined in the ounfmeta.inp
1998  ! file by the user.
1999  !
2000  ! 2. Parameters :
2001  !
2002  ! Parameter list
2003  ! ----------------------------------------------------------------
2004  ! INSTR Char. I/O Input string
2005  ! IPART Int. I Partition number
2006  ! ----------------------------------------------------------------
2007  !
2008  !/ ------------------------------------------------------------------- /
2009  IMPLICIT NONE
2010 
2011  CHARACTER(LEN=*), INTENT(INOUT) :: INSTR
2012  INTEGER, INTENT(IN) :: IPART
2013  !/
2014  !/ ------------------------------------------------------------------- /
2015  !/ Local parameters
2016  !/
2017  INTEGER :: I, J, ISN
2018  TYPE(PART_TMPL_T), POINTER :: P
2019  CHARACTER(LEN=512) :: TMPL
2020 
2021  isn = ipart + 1
2022  IF(ptmeth .LE. 3) THEN
2023  IF (isn .GT. 5) isn = 5
2024  ELSE
2025  IF (isn .GT. 2) isn = 2
2026  ENDIF
2027 
2028  ! Set partition number (built-in IPART template)
2029  i = index(instr, ipart_token)
2030  j = i + len_trim(ipart_token)
2031  IF(i .GT. 0) THEN
2032  WRITE(tmpl, '(A,I1,A)') instr(1:i-1), ipart, instr(j:len(instr))
2033  instr = tmpl
2034  ENDIF
2035 
2036  ! Set standard name string (built-in SPART template)
2037  i = index(instr, spart_token)
2038  j = i + len_trim(spart_token)
2039 
2040  IF(i .GT. 0) THEN
2041  instr = instr(1:i-1) // trim(snamep(isn)) // instr(j:len(instr))
2042  ENDIF
2043 
2044  ! Also try underscore separated version: <SPART_>
2045  i = index(instr, spart_token_)
2046  j = i + len_trim(spart_token_)
2047 
2048  IF(i .GT. 0) THEN
2049  instr = instr(1:i-1) // trim(replace_char(snamep(isn), " ", "_")) &
2050  // instr(j:len(instr))
2051  ENDIF
2052 
2053  ! Merge in user defined partition templates (if any):
2054  IF(.NOT. ASSOCIATED(part_tmpl)) RETURN
2055 
2056  p => part_tmpl
2057  DO
2058  i = index(instr, trim(p%TMPL))
2059  j = i + len_trim(p%TMPL)
2060 
2061  IF(i .GT. 0) THEN
2062  IF(ipart .GE. p%NP) THEN
2063  WRITE(ndse, 1000) trim(p%TMPL), p%NP, ipart
2064  CALL extcde(10)
2065  ENDIF
2066  instr = instr(1:i-1) // trim(p%PART_TEXT(ipart)) // instr(j:len(instr))
2067  ENDIF
2068 
2069  ! Try "underscore" version <TMPL_>:
2070  i = len_trim(p%TMPL)
2071  tmpl = p%TMPL(1:i-1) // "_>"
2072  i = index(instr, trim(tmpl))
2073  j = i + len_trim(tmpl)
2074  IF(i .GT. 0) THEN
2075  instr = instr(1:i-1) // trim(replace_char(p%PART_TEXT(ipart), " ", "_")) &
2076  // instr(j:len(instr))
2077  ENDIF
2078 
2079  IF(.NOT. ASSOCIATED(p%NEXT)) EXIT
2080  p => p%NEXT
2081  ENDDO
2082 
2083  RETURN
2084 
2085 1000 FORMAT (/' *** WAVEWATCH III ERROR IN W3OUNFMETA : ' / &
2086  ' NOT ENOUGH USER DEFINED ENTRIES FOR TEMPLATE' / &
2087  ' TEMPLATE ID : ',a / &
2088  ' NUM ENTRIES : ',i2 / &
2089  ' REQESTED IPART* : ',i2 / &
2090  ' (*Note: IPART is zero-refernced)' / &
2091  ' Please update your ounfmeta.inp file.' /)
2092 

References ipart_token, part_tmpl, replace_char(), snamep, spart_token, and spart_token_.

Referenced by add_partno().

◆ print_meta()

subroutine w3ounfmetamd::print_meta ( type(meta_t), intent(in)  META)

Writes meta-data to the screen - for debugging purposes.

Parameters
[in]METAMeta data type
Author
Chris Bunney
Date
09-Nov-2020

Definition at line 2383 of file w3ounfmetamd.F90.

2383  !/
2384  !/ +-----------------------------------+
2385  !/ | WAVEWATCH III NOAA/NCEP |
2386  !/ | C. Bunney |
2387  !/ | |
2388  !/ | FORTRAN 90 |
2389  !/ | Last update : 02-Nov-2020 |
2390  !/ +-----------------------------------+
2391  !/
2392  !/ 09-Nov-2020 : Creation ( version 7.12 )
2393  !/
2394  !
2395  ! 1. Purpose :
2396  !
2397  ! Writes meta-data to the screen - for debugging purposes.
2398  !
2399  ! 2. Parameters :
2400  !
2401  ! Parameter list
2402  ! ----------------------------------------------------------------
2403  ! VARID Int. I/O NetCDF variable ID
2404  ! ----------------------------------------------------------------
2405  !
2406  !/ ------------------------------------------------------------------- /
2407  IMPLICIT NONE
2408  TYPE(META_T), INTENT(IN) :: META
2409  !/ ------------------------------------------------------------------- /
2410  !/ Local parameters
2411  !/
2412  TYPE(META_PAIR_T), POINTER :: P
2413 
2414  WRITE(*,*) meta%VARNM
2415  WRITE(*,"(A20,':',1X,A)") "Standard name", trim(meta%VARNS)
2416  WRITE(*,"(A20,':',1X,A)") "Long name", trim(meta%VARNL)
2417  WRITE(*,"(A20,':',1X,A)") "Units", trim(meta%UNITS)
2418  WRITE(*,"(A20,':',1X,A)") "GLOBWAVE name", trim(meta%VARNG)
2419  WRITE(*,"(A20,':',1X,A)") "Direction conv", trim(meta%VARND)
2420  WRITE(*,"(A20,':',1X,A)") "Comment", trim(meta%VARNC)
2421  WRITE(*,"(A20,':',1X,2F12.3)") "Min/Max", meta%VMIN, meta%VMAX
2422  IF(meta%EXTRA%N .GT. 0) THEN
2423  p => meta%EXTRA%HEAD
2424  DO
2425  WRITE(*,"(A20,':',1X,A)") trim(p%ATTNAME), trim(p%ATTVAL)
2426  IF(.NOT. ASSOCIATED(p%NEXT)) EXIT
2427  p => p%NEXT
2428  ENDDO
2429  ENDIF
2430 

◆ print_part_tmpl()

subroutine w3ounfmetamd::print_part_tmpl

Prints the patition templates to screen (for debug use).

Author
Chris Bunney
Date
04-Dec-2020

Definition at line 1844 of file w3ounfmetamd.F90.

1844  !/
1845  !/ +-----------------------------------+
1846  !/ | WAVEWATCH III NOAA/NCEP |
1847  !/ | C. Bunney |
1848  !/ | |
1849  !/ | FORTRAN 90 |
1850  !/ | Last update : 04-Dec-2020 |
1851  !/ +-----------------------------------+
1852  !/
1853  !/ 04-Dec-2020 : Creation ( version 7.12 )
1854  !/
1855  !
1856  ! 1. Purpose :
1857  !
1858  ! Prints the patition templates to screen (for debug use).
1859  !
1860  !/ ------------------------------------------------------------------- /
1861  IMPLICIT NONE
1862  !/ ------------------------------------------------------------------- /
1863  !/ Local parameters
1864  !/
1865  TYPE(PART_TMPL_T), POINTER :: P
1866  INTEGER :: I
1867 
1868  print*,'=============='
1869  IF(.NOT. ASSOCIATED(part_tmpl)) THEN
1870  print*,'Empty partition list'
1871  RETURN
1872  ENDIF
1873 
1874  p => part_tmpl
1875  DO
1876  print*,p%TMPL
1877  DO i=0,p%NP - 1
1878  print*,' - ',i,trim(p%PART_TEXT(i))
1879  ENDDO
1880  IF(.NOT. ASSOCIATED(p%NEXT)) EXIT
1881  p => p%NEXT
1882  ENDDO
1883  print*,'=============='

References part_tmpl.

◆ read_crs_meta()

subroutine w3ounfmetamd::read_crs_meta ( integer, intent(in)  NDMI,
integer, intent(inout)  ILINE 
)

Reads in metadata for the coordinate reference system (CRS).

The "grid_mapping_name" must be supplied as an attribute.

Parameters
[in]NDMIUnit number of metadata input file
[in,out]ILINECurrent line number in file
Author
Chris Bunney
Date
07-Dec-2020

Definition at line 1451 of file w3ounfmetamd.F90.

1451  !/
1452  !/ +-----------------------------------+
1453  !/ | WAVEWATCH III NOAA/NCEP |
1454  !/ | C. Bunney |
1455  !/ | |
1456  !/ | FORTRAN 90 |
1457  !/ | Last update : 07-Dec-2020 |
1458  !/ +-----------------------------------+
1459  !/
1460  !/ 07-Dec-2020 : Creation ( version 7.12 )
1461  !/
1462  !
1463  ! 1. Purpose :
1464  !
1465  ! Reads in metadata for the coordinate reference system (CRS)
1466  ! scalar variable. The "grid_mapping_name" must be supplied as
1467  ! an attribute.
1468  !
1469  ! 2. Parameters :
1470  !
1471  ! Parameter list
1472  ! ----------------------------------------------------------------
1473  ! NDMI Char. I Unit number of metadata input file
1474  ! ILINE Int. I/O Current line number in file
1475  ! ----------------------------------------------------------------
1476  !
1477  !/ ------------------------------------------------------------------- /
1478  IMPLICIT NONE
1479  INTEGER, INTENT(IN) :: NDMI
1480  INTEGER, INTENT(INOUT) :: ILINE
1481  !/
1482  !/ ------------------------------------------------------------------- /
1483  !/ Local parameters
1484  !/
1485  CHARACTER(LEN=128) :: BUF, PREV_NAME
1486  INTEGER :: I, IERR
1487 
1488  prev_name = crs_name
1489 
1490  ! Re-read header line (we only want the second field)
1491  READ(ndmi, '(A)') buf
1492  READ(buf, *, iostat=ierr) crs_name, crs_name
1493  IF(ierr /= 0 ) THEN
1494  WRITE(ndse,1000)
1495  WRITE(ndse,2000) trim(fn_meta), iline, trim(buf)
1496  CALL extcde(10)
1497  ENDIF
1498  IF(debug) WRITE(*,'(I5,1X,A20,1X,A)') iline, '[CRS id]', trim(crs_name)
1499 
1500  IF(crs_meta%N .NE. 0) THEN
1501  IF(crs_is_default) THEN
1502  WRITE(ndse,1001) trim(prev_name)
1503  crs_is_default = .false.
1504  ELSE
1505  WRITE(ndse,1002) trim(prev_name)
1506  ENDIF
1507  WRITE(ndse,2000) trim(fn_meta), iline, trim(buf)
1508  CALL del_meta_list(crs_meta)
1509  ENDIF
1510 
1511  CALL read_freeform_meta_list(ndmi, iline, crs_meta)
1512 
1513  ! Check that "grid_mapping_name" is defined
1514  IF(.NOT. meta_list_has_attr(crs_meta, "grid_mapping_name")) THEN
1515  WRITE(ndse, 1003)
1516  WRITE(ndse, 2000) trim(fn_meta), iline, ""
1517  CALL extcde(10)
1518  ENDIF
1519 
1520  RETURN
1521 
1522 1000 FORMAT (/' *** WAVEWATCH III ERROR IN W3OUNFMETA : '/ &
1523  ' ERROR READING CRS HEADER - MISSING CRS NAME?' )
1524  !
1525 1001 FORMAT (/' *** WARNING : USER DEFINED CRS SECTION WILL ' / &
1526  ' OVERIDE DEFAULT CRS DEFINITION FOR GRID' / &
1527  ' PREV CRS = ', a )
1528  !
1529 1002 FORMAT (/' *** WARNING : DUPLICATE CRS SECTION WILL ' / &
1530  ' OVERRIDE PREVIOUS CRS DEFINITION' / &
1531  ' PREV CRS = ', a )
1532  !
1533 1003 FORMAT (/' *** WAVEWATCH III ERROR IN W3OUNFMETA : '/ &
1534  ' CRS SECTION DOES NOT CONTAIN MANDATORY '/ &
1535  ' ATTRIBUTE "grid_mapping_name"' )
1536 
1537 2000 FORMAT ( ' FILENAME = ', a / &
1538  ' LINE NO = ', i5 / &
1539  ' => ', a /)
1540  !
1541 

References crs_is_default, crs_meta, crs_name, fn_meta, and read_freeform_meta_list().

Referenced by read_meta().

◆ read_freeform_meta_list()

subroutine w3ounfmetamd::read_freeform_meta_list ( integer, intent(in)  NDMI,
integer, intent(inout)  ILINE,
type(meta_list_t), intent(inout)  METALIST 
)

Reads in freeform attribute name/value pairs.

Keeps looping over input lines in file until next section or EOF is found. Splits meta pairs on the = character.

Freeform metadata pairs can also provide a variable type ("c", "i", or "r"; for character, int or real respectively). String values with spaces should be quoted.

Parameters
[in]NDMIUnit number of metadata input file
[in,out]ILINECurrent line number in file
[in,out]METALISTA META_LIST_T object to append to
Author
Chris Bunney
Date
16-Dec-2020

Definition at line 1338 of file w3ounfmetamd.F90.

1338  !/
1339  !/ +-----------------------------------+
1340  !/ | WAVEWATCH III NOAA/NCEP |
1341  !/ | C. Bunney |
1342  !/ | |
1343  !/ | FORTRAN 90 |
1344  !/ | Last update : 16-Dec-2020 |
1345  !/ +-----------------------------------+
1346  !/
1347  !/ 16-Dec-2020 : Creation ( version 7.12 )
1348  !/
1349  !
1350  ! 1. Purpose :
1351  !
1352  ! Reads in freeform attribute name/value pairs.
1353  !
1354  ! 2. Method:
1355  !
1356  ! Keeps looping over input lines in file until next section
1357  ! or EOF is found. Splits meta pairs on the = character.
1358  !
1359  ! Freeform metadata pairs can also provide a variable type
1360  ! ("c", "i", or "r"; for character, int or real respectively).
1361  ! String values with spaces should be quoted.
1362  !
1363  ! 3. Parameters :
1364  !
1365  ! Parameter list
1366  ! ----------------------------------------------------------------
1367  ! NDMI Char. I Unit number of metadata input file
1368  ! ILINE Int. I/O Current line number in file
1369  ! METALIST Type. I/O A META_LIST_T object to append to
1370  ! ----------------------------------------------------------------
1371  !
1372  !/ ------------------------------------------------------------------- /
1373  IMPLICIT NONE
1374  INTEGER, INTENT(IN) :: NDMI
1375  INTEGER, INTENT(INOUT) :: ILINE
1376  TYPE(META_LIST_T), INTENT(INOUT) :: METALIST
1377 
1378  !/ ------------------------------------------------------------------- /
1379  !/ Local parameters
1380  !/
1381  CHARACTER(LEN=256) :: BUF
1382  CHARACTER(LEN=128) :: ATTN, ATTV, TMP
1383  CHARACTER(LEN=16) :: ATT_TYPE
1384  INTEGER :: I, IERR
1385  REAL :: R
1386  LOGICAL :: EOF, NEW
1387  TYPE(META_PAIR_T) :: META
1388  !
1389  ! Keep reading lines until we hit EOF or anoter META keyword
1390  DO
1391  CALL next_line(ndmi, buf, iline, eof, new_section=new)
1392  IF(eof) THEN
1393  backspace(ndmi)
1394  RETURN
1395  ENDIF
1396 
1397  IF(new) THEN
1398  IF(debug) WRITE(*,'(I5,1X,A20)') iline, '[--end of section--]'
1399  iline = iline - 1
1400  backspace(ndmi)
1401  EXIT
1402  ENDIF
1403 
1404  ! Split attr name/value pair
1405  i = index(buf, "=")
1406  IF( i .LT. 1 ) THEN
1407  WRITE(ndse, 9000) trim(fn_meta), iline, trim(buf)
1408  CALL extcde(10)
1409  ENDIF
1410 
1411  attn = adjustl(buf(1:i-1))
1412  tmp = adjustl(buf(i+1:))
1413 
1414  ! Get type, if set:
1415  CALL get_attval_type(tmp, iline, attv, att_type)
1416 
1417  IF(debug) THEN
1418  WRITE(*,'(I5,1X,A20,1X,A)') iline, '[FREEFORM meta]', &
1419  trim(attn)//' = '//trim(attv)//' (type: '//trim(att_type)//")"
1420  ENDIF
1421 
1422 
1423  meta%ATTNAME = trim(attn)
1424  meta%ATTVAL = trim(attv)
1425  meta%TYPE = trim(att_type)
1426 
1427  CALL meta_list_append(metalist, meta)
1428 
1429  ENDDO
1430  !
1431 9000 FORMAT (/' *** WAVEWATCH III ERROR IN W3OUNFMETA : '/ &
1432  ' SYNTAX ERROR IN METADATA FILE ' / &
1433  ' SHOULD BE "attr_name = attr_value" ' / &
1434  ' FILENAME = ', a / &
1435  ' LINE NO =', i5 / &
1436  ' => ', a /)
1437  !

References fn_meta, get_attval_type(), and next_line().

Referenced by read_crs_meta(), and read_meta().

◆ read_meta()

subroutine w3ounfmetamd::read_meta

Reads meta data entries from the ountmeta.inp file.

This is the main entry routine for parsing the ounfmeta.inp file. Values read from the file will be used to update or add to the default meta data values set in the default_meta() subroutine.

Author
Chris Bunney
Date
26-Jan-2021

Definition at line 729 of file w3ounfmetamd.F90.

729  !/
730  !/ +-----------------------------------+
731  !/ | WAVEWATCH III NOAA/NCEP |
732  !/ | C. Bunney |
733  !/ | |
734  !/ | FORTRAN 90 |
735  !/ | Last update : 26-Jan-2021 |
736  !/ +-----------------------------------+
737  !/
738  !/ 09-Nov-2020 : Creation ( version 7.12 )
739  !/ 26-Jan-2021 : Added TP and alternative dir/mag ( version 7.12 )
740  !/ metadata for directional fields.
741  !/
742  !
743  ! 1. Purpose :
744  !
745  ! Reads meta data entries from the ountmeta.inp file and update
746  ! default values set via the DEFAULT_META subroutine.
747  !
748  !/ ------------------------------------------------------------------- /
749  IMPLICIT NONE
750  !/ ------------------------------------------------------------------- /
751  !/ Local parameters
752  !/
753  INTEGER :: IERR, I, NDMI
754  CHARACTER(LEN=256) :: BUF
755  TYPE(META_T), POINTER :: PMETA
756  CHARACTER(LEN=32) :: TEST, TESTU
757 
758  INTEGER :: IFI, IFJ, IFC
759  INTEGER :: ILINE, MCNT
760  LOGICAL :: EOF
761 
762  ndmi = 60
763  iline = 0
764  mcnt = 0
765 
766  OPEN(unit=ndmi, file=trim(fnmpre)//trim(fn_meta), &
767  status="OLD", iostat=ierr)
768 
769  IF(ierr .NE. 0) THEN
770  WRITE(ndse, 5010) trim(fnmpre)//trim(fn_meta), ierr
771  CALL extcde(10)
772  ENDIF
773 
774  ! Loop over file, skipping comments or blank lines, until we find
775  ! a META line.
776  DO
777  CALL next_line(ndmi, buf, iline, eof)
778  IF(eof) EXIT
779 
780  ! Read first token on line:
781  READ(buf, *) test
782 
783  ! A new meta-data section will start with the keyword "META"
784  testu = test
785  CALL str_to_upper(testu)
786  IF(testu == "META") THEN
787  mcnt = mcnt + 1
788 
789  IF(debug) WRITE(*,'(I5,1X,A20,1X,A)') iline, '[META header]', trim(buf)
790 
791  ! Get the IFI, IFJ, IFC values from the header:
792  i = index(buf, trim(test)) + 4 ! Handles lower/mixed-case META keyword
793  CALL decode_header(buf(i:), iline, ifi, ifj, ifc)
794  IF(ifi .EQ. -1) THEN
795  WRITE(ndse, 5011) trim(buf(i:)), trim(fn_meta), iline
796  CALL extcde(10)
797  ENDIF
798 
799  ! IFI = 999 is a section for the "global" meta data
800  IF(ifi .EQ. 999) THEN
801  CALL read_freeform_meta_list(ndmi, iline, global_meta)
802  cycle
803  ENDIF
804 
805  ! Error checking on size of IFJ, ICOMP, IPART.
806  IF(ifi .LT. 1 .OR. ifi .GT. nogrp) THEN
807  WRITE(ndse,5013) nogrp, trim(fn_meta), iline
808  CALL extcde(1)
809  ENDIF
810  IF(ifj .LT. 1 .OR. ifj .GT. noge(ifi)) THEN
811  WRITE(ndse,5014) noge(ifi), trim(fn_meta), iline
812  CALL extcde(1)
813  ENDIF
814  IF(ifc .LT. 1 .OR. ifc .GT. 3) THEN
815  WRITE(ndse,5015) trim(fn_meta), iline
816  CALL extcde(1)
817  ENDIF
818 
819  ! Select correct variable metadata entry:
820  pmeta => group(ifi)%FIELD(ifj)%META(ifc)
821 
822  ! Update the metadata with values from file:
823  CALL read_meta_pairs(ndmi, pmeta, iline)
824 
825  ELSE IF(testu == "TEMPLATE") THEN
826  backspace(ndmi) ! We will reprocess this line
827  CALL read_part_tmpl(ndmi, iline)
828  cycle
829 
830  ELSE IF(testu == "CRS") THEN
831  backspace(ndmi) ! We will reprocess this line
832  CALL read_crs_meta(ndmi, iline)
833  cycle
834 
835  ELSE
836  ! Anything else is a syntax error
837  WRITE(ndse, 5012) trim(fn_meta), iline, trim(buf)
838  CALL extcde(10)
839  ENDIF
840  ENDDO
841 
842  CLOSE(ndmi)
843  !WRITE(*, 5000) MCNT, N_GBLMETA, N_CRSMETA
844  RETURN
845  !
846 5000 FORMAT(/' Read in: ',i3,' variable metadata entries' / &
847  ' and: ',i3,' global meta data entries' / &
848  ' and: ',i3,' CRS meta data entries' /)
849  !
850 5010 FORMAT (/' *** WAVEWATCH III ERROR IN W3OUNFMETA : '/ &
851  ' ERROR OPENING METADATA FILE'/ &
852  ' FILENAME = ', a / &
853  ' IOSTAT =', i5 /)
854  !
855 5011 FORMAT (/' *** WAVEWATCH III ERROR IN W3OUNFMETA : '/ &
856  ' UNKNOWN FIELD ID: ',a / &
857  ' FILENAME = ', a / &
858  ' LINE =', i5 /)
859  !
860 5012 FORMAT (/' *** WAVEWATCH III ERROR IN W3OUNFMETA : '/ &
861  ' SYNTAX ERROR ' / &
862  ' FILENAME = ', a / &
863  ' LINE =', i5 / &
864  ' => ', a /)
865  !
866 5013 FORMAT (/' *** WAVEWATCH III ERROR IN W3OUNFMETA : ' / &
867  ' IFI value should be in range 1,',i2 / &
868  ' FILENAME = ', a / &
869  ' LINE =', i5 / &
870  ' => ', a /)
871  !
872 5014 FORMAT (/' *** WAVEWATCH III ERROR IN W3OUNFMETA : ' / &
873  ' IFJ value should be in range 1,',i2 / &
874  ' FILENAME = ', a / &
875  ' LINE =', i5 / &
876  ' => ', a /)
877  !
878 5015 FORMAT (/' *** WAVEWATCH III ERROR IN W3OUNFMETA : ' / &
879  ' IFC value should be in range 1,3' / &
880  ' FILENAME = ', a / &
881  ' LINE =', i5 / &
882  ' => ', a /)
883  !

References decode_header(), file(), fn_meta, global_meta, group, next_line(), read_crs_meta(), read_freeform_meta_list(), read_meta_pairs(), and read_part_tmpl().

Referenced by init_meta().

◆ read_meta_pairs()

subroutine w3ounfmetamd::read_meta_pairs ( integer, intent(in)  NDMI,
type(meta_t), intent(inout), pointer  META,
integer, intent(inout)  ILINE 
)

Reads in attribute name/value pairs and updates the relevant values in the META type.

Keeps looping over input lines in file until next META section or EOF is found. Splits meta pairs on the = character.

Note - the "extra" metadata pair can also provide a variable type ("c", "i", or "r"; for character, int or real respectively)

Parameters
[in]NDMIUnit number of metadata input file
[out]METAPointer to META type
[in,out]ILINECurrent line number in file
Author
Chris Bunney
Date
09-11-2020

Definition at line 1043 of file w3ounfmetamd.F90.

1043  !/
1044  !/ +-----------------------------------+
1045  !/ | WAVEWATCH III NOAA/NCEP |
1046  !/ | C. Bunney |
1047  !/ | |
1048  !/ | FORTRAN 90 |
1049  !/ | Last update : 09-Nov-2020 |
1050  !/ +-----------------------------------+
1051  !/
1052  !/ 09-Nov-2020 : Creation ( version 7.12 )
1053  !/
1054  !
1055  ! 1. Purpose :
1056  !
1057  ! Reads in attribute name/value pairs and updates the relevant
1058  ! values in the META type.
1059  !
1060  ! 2. Method:
1061  !
1062  ! Keeps looping over input lines in file until next META section
1063  ! or EOF is found. Splits meta pairs on the = character.
1064  !
1065  ! Note - the "extra" metadata pair can also provide a variable
1066  ! type ("c", "i", or "r"; for character, int or real respectively)
1067  !
1068  ! 3. Parameters :
1069  !
1070  ! Parameter list
1071  ! ----------------------------------------------------------------
1072  ! NDMI Int. I Unit number of metadata input file
1073  ! META Int.Ptr. O Pointer to META type
1074  ! ILINE Int. I/O Current line number in file
1075  ! ----------------------------------------------------------------
1076  !
1077  !/ ------------------------------------------------------------------- /
1078  IMPLICIT NONE
1079  INTEGER, INTENT(IN) :: NDMI
1080  TYPE(META_T), INTENT(INOUT), POINTER :: META
1081  INTEGER, INTENT(INOUT) :: ILINE
1082  !/ ------------------------------------------------------------------- /
1083  !/ Local parameters
1084  !
1085  CHARACTER(LEN=256) :: BUF
1086  CHARACTER(LEN=128) :: ATTN, ATTV, TMP
1087  CHARACTER(LEN=16) :: ATT_TYPE!, TEST
1088  INTEGER :: I, IERR
1089  REAL :: R
1090  LOGICAL :: EOF, NEW
1091  TYPE(META_PAIR_T) :: EXTRA
1092 
1093  ! Keep reading lines until we hit EOF or anoter META keyword
1094  DO
1095  CALL next_line(ndmi, buf, iline, eof, new_section=new)
1096  IF(eof) THEN
1097  backspace(ndmi)
1098  RETURN
1099  ENDIF
1100 
1101  IF(new) THEN
1102  IF(debug) WRITE(*,'(I5,1X,A20)') iline, '[--end of section--]'
1103  iline = iline - 1
1104  backspace(ndmi)
1105  EXIT
1106  ENDIF
1107 
1108  IF(debug) WRITE(*,'(I5,1X,A20,1X,A)') iline, '[META pair]', trim(buf)
1109 
1110  ! Meta data should be formatted as "attr_name = attr_value"
1111  i = index(buf, "=")
1112  IF( i .LT. 1 ) THEN
1113  WRITE(ndse, 7000) fn_meta, iline, trim(buf)
1114  CALL extcde(10)
1115  ENDIF
1116 
1117  attn = adjustl(buf(1:i-1))
1118  attv = adjustl(buf(i+1:))
1119 
1120  ! Some compilers won't read an "empty" string unless quoted:
1121  IF(trim(attv) == '') THEN
1122  attv='""'
1123  ENDIF
1124 
1125  ierr = 0
1126  SELECT CASE(trim(attn))
1127  ! Character variables
1128  ! Note: Using internal reads will allow the use of quote marks in strings
1129  CASE("varnm")
1130  READ(attv, *, iostat=ierr) meta%VARNM
1131 
1132  CASE("ename")
1133  READ(attv, *, iostat=ierr) meta%ENAME
1134 
1135  CASE("standard_name", "varns")
1136  READ(attv, *, iostat=ierr) meta%VARNS
1137 
1138  CASE("long_name", "varnl")
1139  READ(attv, *, iostat=ierr) meta%VARNL
1140 
1141  CASE("globwave_name", "varng")
1142  READ(attv, *, iostat=ierr) meta%VARNG
1143 
1144  CASE("direction_reference", "dir_ref", "varnd")
1145  READ(attv, *, iostat=ierr) meta%VARND
1146 
1147  CASE("comment", "varnc")
1148  READ(attv, *, iostat=ierr) meta%VARNC
1149 
1150  CASE("units")
1151  READ(attv, *, iostat=ierr) meta%UNITS
1152 
1153  ! Real variables
1154  CASE("valid_min", "vmin")
1155  READ(attv, *, iostat=ierr) meta%VMIN
1156 
1157  CASE("valid_max", "vmax")
1158  READ(attv, *, iostat=ierr) meta%VMAX
1159 
1160  CASE("scale_factor", "fsc")
1161  READ(attv, *, iostat=ierr) meta%FSC
1162 
1163  ! Default case will be the "extra" meta data variable
1164  CASE DEFAULT
1165  tmp = attv
1166  CALL get_attval_type(tmp, iline, attv, att_type)
1167 
1168  IF(debug) THEN
1169  WRITE(*,'(I5,1X,A20,1X,A)') iline, '[META extra]', &
1170  trim(attn)//' = '//trim(attv)//' (type: '//trim(att_type)//")"
1171  ENDIF
1172 
1173  extra%ATTNAME = trim(attn)
1174  extra%ATTVAL = trim(attv)
1175  extra%TYPE = trim(att_type)
1176  CALL meta_list_append(meta%EXTRA, extra)
1177 
1178  END SELECT
1179 
1180  IF(ierr /= 0) THEN
1181  WRITE(ndse, 7002) fn_meta, iline, trim(buf)
1182  CALL extcde(10)
1183  ENDIF
1184 
1185  ENDDO
1186 
1187  RETURN
1188  !
1189 7000 FORMAT (/' *** WAVEWATCH III ERROR IN W3OUNFMETA : '/ &
1190  ' SYNTAX ERROR IN METADATA FILE ' / &
1191  ' SHOULD BE "attr_name = attr_value" ' / &
1192  ' FILENAME = ', a / &
1193  ' LINE NO =', i5 / &
1194  ' => ', a /)
1195  !
1196 7002 FORMAT (/' *** WAVEWATCH III ERROR IN W3OUNFMETA : '/ &
1197  ' IO ERROR READING ATTRIBUTE' / &
1198  ' FILENAME = ', a / &
1199  ' LINE NO =', i5 / &
1200  ' => ', a /)
1201  !

References fn_meta, get_attval_type(), and next_line().

Referenced by read_meta().

◆ read_part_tmpl()

subroutine w3ounfmetamd::read_part_tmpl ( integer, intent(in)  NDMI,
integer, intent(inout)  ILINE 
)

Reads in a TEMPLATE section from file.

This section defines a list of text strings that will be used to replace a "placeholder string" when generating metadata for partitioned parameters.

Format of section is:

template <placeholder_string>
Value for partition ipart=0
Value for partition ipart=1
Value for partition ipart=2
...
Value for partition ipart=n
Parameters
[in,out]NDMIUnit number
[in,out]ILINELine number
Author
Chris Bunney
Date
04-Dec-2020

Definition at line 1717 of file w3ounfmetamd.F90.

1717  !/
1718  !/ +-----------------------------------+
1719  !/ | WAVEWATCH III NOAA/NCEP |
1720  !/ | C. Bunney |
1721  !/ | |
1722  !/ | FORTRAN 90 |
1723  !/ | Last update : 04-Dec-2020 |
1724  !/ +-----------------------------------+
1725  !/
1726  !/ 04-Dec-2020 : Creation ( version 7.12 )
1727  !/
1728  !
1729  ! 1. Purpose :
1730  !
1731  ! Reads in a TEMPLATE section from file.
1732  ! This section defines a list of text strings that will be used
1733  ! to replace a "placeholder string" when generating metadata for
1734  ! partitioned parameters.
1735  !
1736  ! Format of section is:
1737  !
1738  ! TEMPLATE <placeholder_string>
1739  ! Value for partition IPART=0
1740  ! Value for partition IPART=1
1741  ! Value for partition IPART=2
1742  ! ...
1743  ! Value for partition IPART=N
1744  !
1745  ! 2. Parameters :
1746  !
1747  ! Parameter list
1748  ! ----------------------------------------------------------------
1749  ! NDMI Int. I/O Unit number
1750  ! ILINE Int. I/O Line number
1751  ! ----------------------------------------------------------------
1752  !
1753  !/ ------------------------------------------------------------------- /
1754  IMPLICIT NONE
1755  INTEGER, INTENT(IN) :: NDMI
1756  INTEGER, INTENT(INOUT) :: ILINE
1757  !/
1758  !/ ------------------------------------------------------------------- /
1759  !/ Local parameters
1760  !/
1761  CHARACTER(LEN=256) :: BUF, ID
1762  INTEGER :: IERR
1763  LOGICAL :: EOF, NEW
1764  TYPE(PART_TMPL_T), POINTER :: P
1765 
1766  ! Re-read META line to get template string ID (the 2nd field)
1767  READ(ndmi, '(A)') buf
1768  READ(buf, *, iostat=ierr) id, id
1769  IF(ierr /= 0) THEN
1770  WRITE(ndse, 1000) fn_meta, iline, buf
1771  CALL extcde(10)
1772  ENDIF
1773  id = "<" // trim(id) // ">"
1774 
1775  IF(debug) WRITE(*,'(I5,1X,A20,1X,A)') iline, '[template id]', trim(id)
1776 
1777  ! Extend list of partition template types:
1778  IF(ASSOCIATED(part_tmpl)) THEN
1779  ! Got to end of list
1780  p => part_tmpl
1781  DO WHILE(ASSOCIATED(p%NEXT))
1782  p => p%NEXT
1783  ENDDO
1784  ALLOCATE(p%NEXT)
1785  p => p%NEXT
1786  ELSE
1787  ALLOCATE(part_tmpl)
1788  p => part_tmpl
1789  ENDIF
1790 
1791  ! Set template id and read template strings from file:
1792  p%TMPL = trim(id)
1793  ALLOCATE(p%PART_TEXT(0:noswll))
1794  NULLIFY(p%NEXT)
1795  p%NP = 0
1796 
1797  DO
1798  CALL next_line(ndmi, buf, iline, eof, new_section=new)
1799  IF(eof) THEN
1800  backspace(ndmi)
1801  RETURN
1802  ENDIF
1803 
1804  IF(new) THEN
1805  ! Start of new meta data entry
1806  IF(debug) WRITE(*,'(I5,1X,A20)') iline, '[--end of section--]'
1807  iline = iline - 1
1808  backspace(ndmi)
1809  EXIT
1810  ENDIF
1811 
1812  ! Check we have not exceeded NOSWLL
1813  IF(p%NP .GT. noswll) THEN
1814  WRITE(*,*) "Too many partition entries (NOSWLL=",noswll,"). Ignoring"
1815  cycle
1816  ENDIF
1817 
1818  ! Add string to array of partition text
1819  IF(debug) THEN
1820  WRITE(*,'(I5,1X,A20,1X,I1,1X,A)') iline, '[part template]', &
1821  p%NP, trim(buf)
1822  ENDIF
1823 
1824  p%PART_TEXT(p%NP) = trim(adjustl(buf)) ! Zero indexed
1825  p%NP = p%NP + 1
1826  ENDDO
1827 
1828  RETURN
1829  !
1830 1000 FORMAT (/' *** WAVEWATCH III ERROR IN W3OUNFMETA : '/ &
1831  ' ERROR READING PART HEADER - MISSING TEMPLATE ID?'/ &
1832  ' FILENAME = ', a / &
1833  ' LINE NO =', i5 / &
1834  ' => ', a /)
1835  !

References fn_meta, next_line(), and part_tmpl.

Referenced by read_meta().

◆ replace_char()

character(len(str)) function w3ounfmetamd::replace_char ( character(*)  STR,
character  C,
character  REP 
)

Replaces single characters in a string.

Returns
A new string
Parameters
[in]STRCharacter string to process
[in]CCharacter to search for
[in]REPCharacter to substitute
Author
Chris Bunney
Date
02-Feb-2021

Definition at line 674 of file w3ounfmetamd.F90.

674  !/
675  !/ +-----------------------------------+
676  !/ | WAVEWATCH III NOAA/NCEP |
677  !/ | C. Bunney |
678  !/ | |
679  !/ | FORTRAN 90 |
680  !/ | Last update : 02-Fev-2021 |
681  !/ +-----------------------------------+
682  !/
683  !/ 02-Feb-2021 : Creation ( version 7.12 )
684  !/
685  !
686  ! 1. Purpose :
687  !
688  ! Replaces single characters in a string. Returns a new string,
689  !
690  ! 2. Parameters :
691  !
692  ! Parameter list
693  ! ----------------------------------------------------------------
694  ! STR CharArr I Character string to process
695  ! C Char I Character to search for
696  ! REP Char I Character to substitute
697  ! ----------------------------------------------------------------
698  !
699  !/ ------------------------------------------------------------------- /
700  IMPLICIT NONE
701  CHARACTER(*) :: STR
702  CHARACTER :: C, REP
703  CHARACTER(LEN(STR)) :: OSTR
704  !/ ------------------------------------------------------------------- /
705  !/ Local parameters
706  !/
707  INTEGER :: I
708 
709  ostr = trim(str)
710  DO
711  i = index(trim(ostr), c)
712  IF(i .LE. 0) EXIT
713  ostr(i:i) = rep
714  ENDDO
715 

Referenced by partno_string_sub().

◆ teardown_meta()

subroutine w3ounfmetamd::teardown_meta

De-allocates memory used for the META_T arrays.

Author
Chris Bunney
Date
09-Nov-2020

Definition at line 415 of file w3ounfmetamd.F90.

415  !/
416  !/ +-----------------------------------+
417  !/ | WAVEWATCH III NOAA/NCEP |
418  !/ | C. Bunney |
419  !/ | |
420  !/ | FORTRAN 90 |
421  !/ | Last update : 09-Nov-2020 |
422  !/ +-----------------------------------+
423  !/
424  !/ 09-Nov-2020 : Creation ( version 7.12 )
425  !/
426  !
427  ! 1. Purpose :
428  !
429  ! De-allocates memory used for the META_T arrays
430  !
431  !/ ------------------------------------------------------------------- /
432  IMPLICIT NONE
433  !/
434  !/ ------------------------------------------------------------------- /
435  !/ Local parameters
436  !/
437  INTEGER :: I, J
438 
439  DO i = 1,nogrp
440  DO j = 1,noge(i)
441  DEALLOCATE(group(i)%FIELD(j)%META)
442  ENDDO
443  DEALLOCATE(group(i)%FIELD)
444  ENDDO
445  DEALLOCATE(group)
446 
447  CALL del_meta_list(global_meta)
448  CALL del_meta_list(crs_meta)
449 

References crs_meta, w3metamd::del_meta_list(), global_meta, group, w3odatmd::noge, and w3odatmd::nogrp.

Referenced by w3ounf().

◆ write_freeform_meta_list()

subroutine w3ounfmetamd::write_freeform_meta_list ( integer, intent(in)  NCID,
integer, intent(in)  VARID,
type(meta_list_t), intent(in)  METALIST,
integer, intent(out)  ERR 
)

Writes the freeform user meta-data entries for a NetCDF variable.

Parameters
[in,out]NCIDNetCDF file ID
[in,out]VARIDNetCDF variable ID
[in]METALISTMETA_LIST_T object to write
[out]ERRError value
Author
Chris Bunney
Date
16-Dec-2020

Definition at line 2293 of file w3ounfmetamd.F90.

2293  !/
2294  !/ +-----------------------------------+
2295  !/ | WAVEWATCH III NOAA/NCEP |
2296  !/ | C. Bunney |
2297  !/ | |
2298  !/ | FORTRAN 90 |
2299  !/ | Last update : 16-Dec-2020 |
2300  !/ +-----------------------------------+
2301  !/
2302  !/ 16-Dec-2020 : Creation ( version 7.12 )
2303  !/
2304  !
2305  ! 1. Purpose :
2306  !
2307  ! Writes the freeform user meta-data entries for a NetCDF variable
2308  !
2309  ! 2. Parameters :
2310  !
2311  ! Parameter list
2312  ! ----------------------------------------------------------------
2313  ! NCID Int. I/O NetCDF file ID
2314  ! VARID Int. I/O NetCDF file ID
2315  ! METALIST Type. I META_LIST_T object to write
2316  ! ERR Int. O Error value
2317  ! ----------------------------------------------------------------
2318  !
2319  !/ ------------------------------------------------------------------- /
2320  IMPLICIT NONE
2321 
2322  INTEGER, INTENT(IN) :: NCID, VARID
2323  TYPE(META_LIST_T), INTENT(IN) :: METALIST
2324  INTEGER, INTENT(OUT) :: ERR
2325  !/
2326  !/ ------------------------------------------------------------------- /
2327  !/ Local parameters
2328  !/
2329  INTEGER :: I, IVAL
2330  REAL :: RVAL
2331  TYPE(META_PAIR_T), POINTER :: P
2332 
2333  IF(metalist%N .EQ. 0) RETURN
2334 
2335  p => metalist%HEAD
2336 
2337  ! Loop over global metadata pairs:
2338  DO
2339 
2340  IF (p%ATTNAME .EQ. '' .OR. &
2341  p%ATTNAME .EQ. unsetc) cycle
2342 
2343  SELECT CASE(p%TYPE)
2344 
2345  CASE('i')
2346  READ(p%ATTVAL, *) ival
2347  err = nf90_put_att(ncid, varid, p%ATTNAME, ival)
2348  IF(err /= nf90_noerr) RETURN
2349 
2350  CASE('r', 'f')
2351  READ(p%ATTVAL, *) rval
2352  err = nf90_put_att(ncid, varid, p%ATTNAME, rval)
2353  IF(err /= nf90_noerr) RETURN
2354 
2355  CASE('c')
2356  err = nf90_put_att(ncid, varid, p%ATTNAME, &
2357  p%ATTVAL)
2358  IF(err /= nf90_noerr) RETURN
2359 
2360  CASE DEFAULT
2361  WRITE(ndse,1000) p%TYPE
2362  CALL extcde(10)
2363  END SELECT
2364 
2365  IF(.NOT. ASSOCIATED(p%NEXT)) EXIT
2366  p => p%NEXT
2367  ENDDO
2368  !
2369 1000 FORMAT (/' *** WAVEWATCH III ERROR IN W3OUNFMETA : ' / &
2370  ' WRITE_FREEFORM_META: Unknown attribute' / &
2371  ' data type: ', a1 / )
2372  !

Referenced by w3ounf(), write_global_meta(), and write_meta().

◆ write_global_meta()

subroutine w3ounfmetamd::write_global_meta ( integer, intent(in)  NCID,
integer, intent(out)  ERR 
)

Writes the user meta-data entries for the global attributes.

Global meta-data is stored as a meta-data list, so this is essentially a convenience/legacy function that calls the write_freeform_meta_list() subroutine.

Parameters
[in]NCIDNetCDF file ID
[out]ERRError value
Author
Chris Bunney
Date
09-Nov-2020

Definition at line 2246 of file w3ounfmetamd.F90.

2246  !/
2247  !/ +-----------------------------------+
2248  !/ | WAVEWATCH III NOAA/NCEP |
2249  !/ | C. Bunney |
2250  !/ | |
2251  !/ | FORTRAN 90 |
2252  !/ | Last update : 09-Nov-2020 |
2253  !/ +-----------------------------------+
2254  !/
2255  !/ 09-Nov-2020 : Creation ( version 7.12 )
2256  !/
2257  !
2258  ! 1. Purpose :
2259  !
2260  ! Writes the user meta-data entries for the global attributes
2261  !
2262  ! 2. Parameters :
2263  !
2264  ! Parameter list
2265  ! ----------------------------------------------------------------
2266  ! NCID Int. I/O NetCDF file ID
2267  ! ERR Int. O Error value
2268  ! ----------------------------------------------------------------
2269  !
2270  !/ ------------------------------------------------------------------- /
2271  IMPLICIT NONE
2272 
2273  INTEGER, INTENT(IN) :: NCID
2274  INTEGER, INTENT(OUT) :: ERR
2275  !/
2276  !/ ------------------------------------------------------------------- /
2277  !/ Local parameters
2278  !/
2279  CALL write_freeform_meta_list(ncid, nf90_global, global_meta, err)

References global_meta, and write_freeform_meta_list().

Referenced by w3ounf().

◆ write_meta()

subroutine w3ounfmetamd::write_meta ( integer, intent(in)  NCID,
integer, intent(in)  VARID,
type(meta_t), intent(in)  META,
integer, intent(out)  ERR 
)

Writes the meta-data entries for a variable.

Attribute pairs defined in META are written to the netCDF variable specificed in the VARID handle.

There are two stages to the write - first all "mandatory" or "pre-defined" attributes are written out (those defined in the META_T type). Secondly, if there is any user-defined "extra" freeform meta data defined, this is written out via a separate call to write_freeform_meta_list().

Parameters
[in,out]NCIDNetCDF file ID
[in,out]VARIDNetCDF variable ID
[in]METAMeta data type
[out]ERRError value
Author
Chris Bunney
Date
02-Nov-2020

Definition at line 2115 of file w3ounfmetamd.F90.

2115  !/
2116  !/ +-----------------------------------+
2117  !/ | WAVEWATCH III NOAA/NCEP |
2118  !/ | C. Bunney |
2119  !/ | |
2120  !/ | FORTRAN 90 |
2121  !/ | Last update : 02-Nov-2020 |
2122  !/ +-----------------------------------+
2123  !/
2124  !/ 09-Nov-2020 : Creation ( version 7.12 )
2125  !/
2126  !
2127  ! 1. Purpose :
2128  !
2129  ! Writes the meta-data entries for a variable.
2130  !
2131  ! 2. Parameters :
2132  !
2133  ! Parameter list
2134  ! ----------------------------------------------------------------
2135  ! NCID Int. I/O NetCDF file ID
2136  ! VARID Int. I/O NetCDF variable ID
2137  ! META Int. I Meta data type
2138  ! ERR Int. O Error value
2139  ! ----------------------------------------------------------------
2140  !
2141  !/ ------------------------------------------------------------------- /
2142  IMPLICIT NONE
2143 
2144  INTEGER, INTENT(IN) :: NCID, VARID
2145  TYPE(META_T), INTENT(IN) :: META
2146  INTEGER, INTENT(OUT) :: ERR
2147  !/
2148  !/ ------------------------------------------------------------------- /
2149  !/ Local parameters
2150  !/
2151  INTEGER :: IVAL, VAL
2152  REAL :: RVAL
2153  !/
2154  err = nf90_put_att(ncid, varid, 'long_name', meta%VARNL)
2155  IF(err /= nf90_noerr) RETURN
2156 
2157  IF(meta%VARNS .NE. '' .AND. meta%VARNS .NE. unsetc) THEN
2158  err = nf90_put_att(ncid, varid, 'standard_name', meta%VARNS)
2159  IF(err /= nf90_noerr) RETURN
2160  ENDIF
2161 
2162  IF(meta%VARNG .NE. '' .AND. meta%VARNG .NE. unsetc) THEN
2163  err = nf90_put_att(ncid, varid, 'globwave_name', meta%VARNG)
2164  IF(err /= nf90_noerr) RETURN
2165  ENDIF
2166 
2167  err = nf90_put_att(ncid, varid, 'units', meta%UNITS)
2168  IF(err /= nf90_noerr) RETURN
2169 
2170  ! Fill value dependent on variable type
2171  IF(ncvartype .EQ. 2) THEN
2172  err = nf90_put_att(ncid, varid, '_FillValue', nf90_fill_short)
2173  ELSE
2174  err = nf90_put_att(ncid, varid, '_FillValue', nf90_fill_float)
2175  END IF
2176  IF(err /= nf90_noerr) RETURN
2177 
2178  err = nf90_put_att(ncid, varid, 'scale_factor', meta%FSC)
2179  IF(err /= nf90_noerr) RETURN
2180 
2181  err = nf90_put_att(ncid, varid, 'add_offset', 0.)
2182  IF(err /= nf90_noerr) RETURN
2183 
2184  ! For variables with vartype SHORT, the valid min/max
2185  ! are scaled by scale_factor and converted to integers.
2186  ! If vartype is FLOAT, then no scaling is performed and
2187  ! valid min/max are written out directly as floats.
2188  IF(ncvartype .EQ. 2) THEN
2189  val = nint(meta%VMIN / meta%FSC)
2190  err = nf90_put_att(ncid, varid,'valid_min', val)
2191  IF(err /= nf90_noerr) RETURN
2192 
2193  val = nint(meta%VMAX / meta%FSC)
2194  err = nf90_put_att(ncid, varid,'valid_max', val)
2195  IF(err /= nf90_noerr) RETURN
2196  ELSE
2197  err = nf90_put_att(ncid, varid,'valid_min', meta%VMIN)
2198  IF(err /= nf90_noerr) RETURN
2199 
2200  err = nf90_put_att(ncid, varid,'valid_max', meta%VMAX)
2201  IF(err /= nf90_noerr) RETURN
2202  ENDIF
2203 
2204  IF(meta%VARNC .NE. '' .AND. meta%VARNC .NE. unsetc) THEN
2205  err = nf90_put_att(ncid, varid, 'comment', meta%VARNC)
2206  IF(err /= nf90_noerr) RETURN
2207  ENDIF
2208 
2209  IF(meta%VARND .NE. '' .AND. meta%VARND .NE. unsetc) THEN
2210  err = nf90_put_att(ncid, varid, 'direction_reference', meta%VARND)
2211  IF(err /= nf90_noerr) RETURN
2212  END IF
2213 
2214  IF(crs_name .NE. '' .AND. crs_name .NE. unsetc) THEN
2215  err = nf90_put_att(ncid, varid, 'grid_mapping', crs_name)
2216  IF(err /= nf90_noerr) RETURN
2217  ENDIF
2218 
2219  IF(coords_attr .NE. '' .AND. coords_attr .NE. unsetc) THEN
2220  err = nf90_put_att(ncid, varid, 'coordinates', adjustl(coords_attr))
2221  IF(err /= nf90_noerr) RETURN
2222  ENDIF
2223 
2224  IF (meta%EXTRA%N .GT. 0) THEN
2225  CALL write_freeform_meta_list(ncid, varid, meta%EXTRA, err)
2226  IF(err /= nf90_noerr) RETURN
2227  ENDIF
2228 
2229  RETURN
2230  !

References coords_attr, crs_name, ncvartype, and write_freeform_meta_list().

Referenced by w3ounf().

Variable Documentation

◆ coords_attr

character(len=256) w3ounfmetamd::coords_attr = ''

"coordinates" attribute - for defining auxiliary coordinates (for all variables)

Definition at line 257 of file w3ounfmetamd.F90.

257  CHARACTER(LEN=256) :: COORDS_ATTR = ''

Referenced by w3ounf(), and write_meta().

◆ crs_is_default

logical w3ounfmetamd::crs_is_default = .FALSE.

True if CRS set by this module.

Definition at line 254 of file w3ounfmetamd.F90.

254  LOGICAL :: CRS_IS_DEFAULT = .false.

Referenced by default_crs_meta(), and read_crs_meta().

◆ crs_meta

type(meta_list_t) w3ounfmetamd::crs_meta

Meta data list for CRS.

Definition at line 253 of file w3ounfmetamd.F90.

253  TYPE(META_LIST_T) :: CRS_META

Referenced by default_crs_meta(), read_crs_meta(), teardown_meta(), and w3ounf().

◆ crs_name

character(len=128) w3ounfmetamd::crs_name = ''

Coordinate reference system (CRS) name.

Definition at line 252 of file w3ounfmetamd.F90.

252  CHARACTER(LEN=128) :: CRS_NAME = ''

Referenced by default_crs_meta(), read_crs_meta(), w3ounf(), and write_meta().

◆ dircom

character(len=30) w3ounfmetamd::dircom

Directional convention comment.

Definition at line 272 of file w3ounfmetamd.F90.

272  CHARACTER(LEN=30) :: DIRCOM

Referenced by default_meta(), and init_meta().

◆ fl_default_gbl_meta

logical w3ounfmetamd::fl_default_gbl_meta = .TRUE.

Flag for using default (true) or user-defined (false) global meta data.

Definition at line 249 of file w3ounfmetamd.F90.

249  LOGICAL :: FL_DEFAULT_GBL_META = .true.

Referenced by decode_header(), and w3ounf().

◆ flrtd

logical w3ounfmetamd::flrtd = .FALSE.

Flag for rototed pole grid.

Definition at line 279 of file w3ounfmetamd.F90.

279  LOGICAL :: FLRTD = .false.

Referenced by default_crs_meta(), and init_meta().

◆ fn_meta

character(len=*), parameter w3ounfmetamd::fn_meta = "ounfmeta.inp"

Meta-data input filename.

Definition at line 199 of file w3ounfmetamd.F90.

199  CHARACTER(LEN=*), PARAMETER :: FN_META = "ounfmeta.inp"

Referenced by decode_header(), get_attval_type(), next_line(), read_crs_meta(), read_freeform_meta_list(), read_meta(), read_meta_pairs(), and read_part_tmpl().

◆ global_meta

type(meta_list_t) w3ounfmetamd::global_meta

Storage for the Global meta data (free form)

Definition at line 246 of file w3ounfmetamd.F90.

246  TYPE(META_LIST_T) :: GLOBAL_META

Referenced by read_meta(), teardown_meta(), and write_global_meta().

◆ group

type(group_t), dimension(:), allocatable w3ounfmetamd::group

Storage for meta data aggregated by group (IFJ)

Definition at line 243 of file w3ounfmetamd.F90.

243  TYPE(GROUP_T), ALLOCATABLE :: GROUP(:)

Referenced by default_meta(), getmeta(), init_meta(), read_meta(), and teardown_meta().

◆ ipart_token

character(len=*), parameter w3ounfmetamd::ipart_token = "<IPART>"

String token for integer partition number.

Definition at line 202 of file w3ounfmetamd.F90.

202  CHARACTER(LEN=*), PARAMETER :: IPART_TOKEN = "<IPART>"

Referenced by default_meta(), and partno_string_sub().

◆ ncvartype

integer w3ounfmetamd::ncvartype

NetCDF variable type (2=int, 3=real, 4=depends)

Definition at line 271 of file w3ounfmetamd.F90.

271  INTEGER :: NCVARTYPE

Referenced by default_meta(), w3ounf(), and write_meta().

◆ part_tmpl

type(part_tmpl_t), pointer w3ounfmetamd::part_tmpl

User-defined partitionted paratmeters template strings.

Definition at line 269 of file w3ounfmetamd.F90.

269  TYPE(PART_TMPL_T), POINTER :: PART_TMPL

Referenced by init_meta(), partno_string_sub(), print_part_tmpl(), and read_part_tmpl().

◆ partcom

character(len=128) w3ounfmetamd::partcom

Partitioning method comment.

Definition at line 273 of file w3ounfmetamd.F90.

273  CHARACTER(LEN=128) :: PARTCOM

Referenced by default_meta(), and init_meta().

◆ snamep

character(len=15), dimension(5) w3ounfmetamd::snamep

Part.

standard name templates

Definition at line 274 of file w3ounfmetamd.F90.

274  CHARACTER(LEN=15) :: SNAMEP(5)

Referenced by init_meta(), and partno_string_sub().

◆ spart_token

character(len=*), parameter w3ounfmetamd::spart_token = "<SPART>"

String token for partition descriptive string (space separated)

Definition at line 205 of file w3ounfmetamd.F90.

205  CHARACTER(LEN=*), PARAMETER :: SPART_TOKEN = "<SPART>"

Referenced by partno_string_sub().

◆ spart_token_

character(len=*), parameter w3ounfmetamd::spart_token_ = "<SPART_>"

String token for partition descriptive string (underscore separated)

Definition at line 208 of file w3ounfmetamd.F90.

208  CHARACTER(LEN=*), PARAMETER :: SPART_TOKEN_ = "<SPART_>"

Referenced by default_meta(), and partno_string_sub().

scrip_timers::status
character(len=8), dimension(max_timers), save status
Definition: scrip_timers.f:63
w3odatmd::ndse
integer, pointer ndse
Definition: w3odatmd.F90:456
file
file(STRINGS ${CMAKE_BINARY_DIR}/switch switch_strings) separate_arguments(switches UNIX_COMMAND $
Definition: CMakeLists.txt:3
w3iogomd::w3fldtoij
subroutine w3fldtoij(FLD, I, J, IAPROC, NAPOUT, NDSEN)
Returns the group/field (I/J) indices for a named output field.
Definition: w3iogomd.F90:761
w3iogomd
Gridded output of mean wave parameters.
Definition: w3iogomd.F90:15