WAVEWATCH III  beta 0.0.1
ww3_systrk.F90 File Reference

Contains program WW3_SYSTRK for tracking of wave systems. More...

Go to the source code of this file.

Functions/Subroutines

program ww3_systrk
 Perform spatial and temporal tracking of wave systems, based on spectral partition (bulletin) output. More...
 
subroutine t2netcdf (lons, lats, data_in, nlons, nlats, nsys, date1, date2, dt, ntime, ivar, outputType)
 N/A. More...
 
subroutine check (status)
 N/A. More...
 
subroutine pt2netcdf (longitude, latitude, hs, tp, dir, npoints, date1, date2, dt, ntime, outputType)
 N/A. More...
 

Detailed Description

Contains program WW3_SYSTRK for tracking of wave systems.

Author
A. J. van der Westhuysen
Jeff Hanson
Eve-Marie Devaliere
Date
16-Jan-2017

Definition in file ww3_systrk.F90.

Function/Subroutine Documentation

◆ check()

subroutine check ( integer, intent(in)  status)

N/A.

Parameters
[in]status
Author
N/A
Date
N/A

Definition at line 1299 of file ww3_systrk.F90.

1299  use netcdf
1300  integer, intent ( in) :: status
1301  if(status /= nf90_noerr) then
1302  write(6,996)
1303 996 FORMAT (/' *** WAVEWATCH III ERROR IN WW3_SYSTRK:'/ &
1304  'netCDF error:')
1305  print *, trim(nf90_strerror(status))
1306  stop "Stopped in netcdf output part"
1307  endif

Referenced by wmesmfmd::fieldindex(), pt2netcdf(), t2netcdf(), w3gsrumd::w3gsup(), and wmunitmd::wmuinq().

◆ pt2netcdf()

subroutine pt2netcdf ( real, dimension(npoints)  longitude,
real, dimension(npoints)  latitude,
real, dimension(nsys, npoints, ntime)  hs,
real, dimension(nsys, npoints, ntime)  tp,
real, dimension(nsys, npoints, ntime)  dir,
integer  npoints,
double precision  date1,
double precision  date2,
real  dt,
integer  ntime,
integer  outputType 
)

N/A.

Parameters
longitude
latitude
hs
tp
dir
npoints
date1
date2
dt
ntime
outputType
Author
N/A
Date
N/A

Definition at line 1332 of file ww3_systrk.F90.

1332  USE w3timemd
1333  use netcdf
1334  implicit none
1335  integer :: ntime,npoints,outputType
1336  integer, parameter :: deflate = 1
1337  integer :: iret, oldMode
1338  integer :: ncid
1339  integer :: system_index_dim
1340  integer :: point_dim,rec_dim
1341  integer :: nsys
1342  integer :: start(3), count(3)
1343  parameter(nsys = 10)
1344  integer :: latitude_id
1345  integer :: longitude_id
1346  integer :: time_id
1347  integer :: hs_id
1348  integer :: tp_id
1349  integer :: dir_id
1350  integer :: time_rank
1351  integer :: hs_rank
1352  integer :: tp_rank
1353  integer :: dir_rank
1354  parameter(time_rank = 1)
1355  parameter(hs_rank = 3)
1356  parameter(tp_rank = 3)
1357  parameter(dir_rank = 3)
1358 #endif
1359  !
1360 #ifdef W3_TRKNC
1361  integer :: hs_dims(hs_rank)
1362  integer :: tp_dims(tp_rank)
1363  integer :: dir_dims(dir_rank)
1364  real :: latitude(npoints),dt
1365  real :: longitude(npoints)
1366  real :: hs(nsys, npoints, ntime)
1367  real :: tp(nsys, npoints, ntime)
1368  real :: dir(nsys, npoints, ntime)
1369  integer :: iyc,imc,idc,ihc,iminc,isc,Jday,Jday0,rec
1370  double precision date1,date2,timenc
1371  double precision times(ntime)
1372 #endif
1373  !
1374 #ifdef W3_TRKNC
1375  iyc=date1/10000
1376  imc=(date1-iyc*10000)/100
1377  idc=int(date1-dble(iyc*10000)-dble(imc*100))
1378  ihc=date2/10000
1379  iminc=(date2-ihc*10000)/100
1380  isc=date2-ihc*10000-100*iminc
1381  timenc=dble(julday(idc,imc,iyc))+(dble(ihc)+(dble(iminc)+ &
1382  (dble(isc)/60.0d0))/60.0d0)/24.0d0
1383  jday0=julday(1,1,1990)
1384  timenc=timenc-jday0
1385  do rec=1,ntime
1386  times(rec)=timenc+dble( (rec-1)*dt)/3600.0d0/24.0d0
1387  enddo
1388 #endif
1389  !
1390 #ifdef W3_TRKNC
1391  if(outputtype.EQ.3) then
1392  iret = nf90_create('sys_pnt.ww3.nc', nf90_clobber, ncid)
1393  endif
1394  if (outputtype.EQ.4) iret = nf90_create('sys_pnt.ww3.nc',nf90_netcdf4, ncid)
1395  call check(iret)
1396  iret = nf90_set_fill(ncid,nf90_nofill,oldmode)
1397  call check(iret)
1398  ! define dimensions
1399  iret = nf90_def_dim(ncid, 'system_index', nsys, system_index_dim)
1400  call check(iret)
1401  iret = nf90_def_dim(ncid, 'point', npoints, point_dim)
1402  call check(iret)
1403  iret = nf90_def_dim(ncid, 'time', ntime, rec_dim)
1404  call check(iret)
1405  ! define variables
1406  iret = nf90_def_var(ncid, 'latitude', nf90_real, point_dim, &
1407  latitude_id)
1408  call check(iret)
1409  if (outputtype.EQ.4) call check( nf90_def_var_deflate(ncid,latitude_id,1,1,deflate))
1410  iret = nf90_def_var(ncid, 'longitude', nf90_real, point_dim, &
1411  longitude_id)
1412  call check(iret)
1413  if (outputtype.EQ.4) call check( nf90_def_var_deflate(ncid,longitude_id,1,1,deflate))
1414  iret = nf90_def_var(ncid, 'time', nf90_double, rec_dim, &
1415  time_id)
1416  call check(iret)
1417  if (outputtype.EQ.4) call check( nf90_def_var_deflate(ncid,time_id,1,1,deflate) )
1418  hs_dims(3) = rec_dim
1419  hs_dims(2) = point_dim
1420  hs_dims(1) = system_index_dim
1421  iret = nf90_def_var(ncid, 'hs', nf90_real, &
1422  hs_dims, hs_id)
1423  call check(iret)
1424  if (outputtype.EQ.4) call check( nf90_def_var_deflate(ncid,hs_id,1,1,deflate))
1425  tp_dims(3) = rec_dim
1426  tp_dims(2) = point_dim
1427  tp_dims(1) = system_index_dim
1428  iret = nf90_def_var(ncid, 'tp', nf90_real, &
1429  tp_dims, tp_id)
1430  call check(iret)
1431  if (outputtype.EQ.4) call check( nf90_def_var_deflate(ncid,tp_id,1,1,deflate))
1432  dir_dims(3) = rec_dim
1433  dir_dims(2) = point_dim
1434  dir_dims(1) = system_index_dim
1435  iret = nf90_def_var(ncid, 'dir', nf90_real, &
1436  dir_dims, dir_id)
1437  call check(iret)
1438  if (outputtype.EQ.4) call check( nf90_def_var_deflate(ncid,dir_id,1,1,deflate))
1439  ! assign attributes
1440  iret = nf90_put_att(ncid, latitude_id, 'units', 'degrees_north')
1441  call check(iret)
1442  iret = nf90_put_att(ncid, latitude_id, 'long_name', 'latitude')
1443  call check(iret)
1444  iret = nf90_put_att(ncid, latitude_id, 'standard_name', 'latitude')
1445  call check(iret)
1446  iret = nf90_put_att(ncid, latitude_id, 'axis', 'Y')
1447  call check(iret)
1448  iret = nf90_put_att(ncid, longitude_id, 'units', 'degrees_east')
1449  call check(iret)
1450  iret = nf90_put_att(ncid, longitude_id,'long_name','longitude')
1451  call check(iret)
1452  iret = nf90_put_att(ncid, longitude_id,'standard_name','longitude')
1453  call check(iret)
1454  iret = nf90_put_att(ncid, longitude_id, 'axis', 'X')
1455  call check(iret)
1456  iret = nf90_put_att(ncid, time_id, 'units', &
1457  'days since 1990-01-01 00:00:00')
1458  call check(iret)
1459  iret = nf90_put_att(ncid, time_id, 'long_name','julian day(UT)')
1460  call check(iret)
1461  iret = nf90_put_att(ncid, time_id, 'standard_name','time')
1462  call check(iret)
1463  iret = nf90_put_att(ncid, time_id, 'conventions', &
1464  'relative julian day with decimal part (as part of the day)')
1465  call check(iret)
1466  iret = nf90_put_att(ncid, time_id, 'axis', 'T')
1467  call check(iret)
1468  iret = nf90_put_att(ncid, hs_id, 'units', 'm')
1469  call check(iret)
1470  iret = nf90_put_att(ncid, hs_id,'long_name','significant_wave_height')
1471  call check(iret)
1472  iret = nf90_put_att(ncid, hs_id, 'missing_value', &
1473  '999.9999')
1474  call check(iret)
1475  iret = nf90_put_att(ncid, tp_id, 'units', 's')
1476  call check(iret)
1477  iret = nf90_put_att(ncid, tp_id,'long_name','peak_period')
1478  call check(iret)
1479  iret = nf90_put_att(ncid, tp_id, 'missing_value', &
1480  '999.9999')
1481  call check(iret)
1482  iret = nf90_put_att(ncid, dir_id, 'units', 'degrees')
1483  call check(iret)
1484  iret = nf90_put_att(ncid, dir_id,'long_name','peak_direction')
1485  call check(iret)
1486  iret = nf90_put_att(ncid, dir_id, 'missing_value',&
1487  '999.9999')
1488  call check(iret)
1489  ! leave define mode
1490  iret = nf90_enddef(ncid)
1491  call check(iret)
1492  iret = nf90_put_var(ncid, latitude_id, latitude)
1493  call check(iret)
1494 #endif
1495  !
1496 #ifdef W3_TRKNC
1497  iret = nf90_put_var(ncid, longitude_id, longitude)
1498  call check(iret)
1499 #endif
1500  !
1501 #ifdef W3_TRKNC
1502  iret = nf90_put_var(ncid, time_id, times)
1503  call check(iret)
1504 #endif
1505  !
1506 #ifdef W3_TRKNC
1507  start = (/ 1, 1, 1 /)
1508  count = (/ nsys,npoints,ntime /)
1509 #endif
1510  !
1511 #ifdef W3_TRKNC
1512  iret = nf90_put_var(ncid, hs_id, hs,&
1513  start = start, count = count )
1514  call check(iret)
1515  iret = nf90_put_var(ncid, tp_id, tp, &
1516  start = start, count = count )
1517  call check(iret)
1518  iret = nf90_put_var(ncid, dir_id, dir,&
1519  start = start, count = count )
1520  call check(iret)
1521  iret = nf90_close(ncid)
1522  call check(iret)
1523  return

References check(), and w3timemd::julday().

Referenced by ww3_systrk().

◆ t2netcdf()

subroutine t2netcdf ( real, dimension(nlons)  lons,
real, dimension(nlats)  lats,
real, dimension(nlons, nlats, nsys,ntime)  data_in,
integer  nlons,
integer  nlats,
integer  nsys,
double precision  date1,
double precision  date2,
real  dt,
integer  ntime,
integer  ivar,
integer  outputType 
)

N/A.

Parameters
lons
lats
data_in
nlons
nlats
nsys
date1
date2
dt
ntime
ivar
outputType
Author
N/A
Date
N/A

Definition at line 1129 of file ww3_systrk.F90.

1129  USE w3timemd
1130  use netcdf
1131  implicit none
1132  character (len = 15) :: file_name
1133  integer, parameter :: ndims = 4
1134  integer, parameter :: deflate = 1
1135  integer :: outputType, ncid, oldMode
1136  integer :: nlons,nlats,nsys,rec,ntime,ivar
1137  double precision :: date1,date2,timenc
1138  real :: data_in(nlons, nlats, nsys,ntime)
1139  real :: lats(nlats), lons(nlons),dt
1140  double precision :: times(ntime)
1141  integer :: iyc,imc,idc,ihc,iminc,isc,Jday,Jday0
1142  integer :: iret
1143 #endif
1144  !
1145 #ifdef W3_TRKNC
1146  integer :: lon_varid, lat_varid, rec_varid
1147  character (len = *), parameter :: lsys_name = "system_index"
1148  character (len = *), parameter :: lat_name = "latitude"
1149  character (len = *), parameter :: lon_name = "longitude"
1150  character (len = *), parameter :: time_name = "time"
1151  integer :: sys_dimid, lon_dimid, lat_dimid, rec_dimid
1152  integer :: start(ndims), count(ndims)
1153 #endif
1154  !
1155 #ifdef W3_TRKNC
1156  character (len = *), parameter :: var1_name="hs"
1157  character (len = *), parameter :: var2_name="tp"
1158  character (len = *), parameter :: var3_name="dir"
1159  character (len = *), parameter :: var4_name="dspr"
1160  integer :: var1_varid, var2_varid, var3_varid,var4_varid
1161  integer :: dimids(ndims)
1162 #endif
1163  !
1164 #ifdef W3_TRKNC
1165  character (len = *), parameter :: units = "units"
1166  character (len = *), parameter :: var1_units = "m"
1167  character (len = *), parameter :: var2_units = "s"
1168  character (len = *), parameter :: var3_units = "degrees"
1169  character (len = *), parameter :: var4_units = "degrees"
1170  character (len = *), parameter :: lat_units = "degrees_north"
1171  character (len = *), parameter :: lon_units = "degrees_east"
1172  iyc=date1/10000
1173  imc=(date1-iyc*10000)/100
1174  idc=int(date1-dble(iyc*10000)-dble(imc*100))
1175  ihc=date2/10000
1176  iminc=(date2-ihc*10000)/100
1177  isc=date2-ihc*10000-100*iminc
1178  timenc=dble(julday(idc,imc,iyc))+(dble(ihc)+(dble(iminc)+ &
1179  (dble(isc)/60.0d0))/60.0d0)/24.0d0
1180  jday0=julday(1,1,1990)
1181  timenc=timenc-jday0
1182  do rec=1,ntime
1183  times(rec)=timenc+dble( (rec-1)*dt)/3600.0d0/24.0d0
1184  enddo
1185  if( ivar == 1) then
1186  file_name = "sys_hs.ww3.nc"
1187  else if( ivar == 2) then
1188  file_name = "sys_tp.ww3.nc"
1189  else if( ivar == 3) then
1190  file_name = "sys_dir.ww3.nc"
1191  else
1192  file_name = "sys_dspr.ww3.nc"
1193  endif
1194 #endif
1195  !
1196 #ifdef W3_TRKNC
1197  ! create the netcdf file.
1198  if (outputtype.EQ.3) then
1199  call check( nf90_create(file_name, nf90_clobber, ncid) )
1200  endif
1201  if(outputtype.EQ.4) call check( nf90_create(file_name,nf90_netcdf4,ncid))
1202  call check ( nf90_set_fill(ncid,nf90_nofill,oldmode) )
1203  call check( nf90_def_dim(ncid, lsys_name, nsys, sys_dimid) )
1204  call check( nf90_def_dim(ncid, lat_name, nlats, lat_dimid) )
1205  call check( nf90_def_dim(ncid, lon_name, nlons, lon_dimid) )
1206  call check( nf90_def_dim(ncid, time_name, ntime, rec_dimid) )
1207  call check( nf90_def_var(ncid, lat_name, nf90_real, lat_dimid,lat_varid))
1208  if(outputtype.EQ.4) call check( nf90_def_var_deflate(ncid,lat_varid,1,1,deflate) )
1209  call check( nf90_def_var(ncid, lon_name, nf90_real, lon_dimid,lon_varid))
1210  if(outputtype.EQ.4) call check( nf90_def_var_deflate(ncid,lon_varid,1,1,deflate) )
1211  call check( nf90_def_var(ncid,time_name,nf90_double,rec_dimid,rec_varid))
1212  if(outputtype.EQ.4) call check( nf90_def_var_deflate(ncid,rec_varid,1,1,deflate) )
1213 #endif
1214  !
1215 #ifdef W3_TRKNC
1216  call check( nf90_put_att(ncid, lat_varid, units, lat_units) )
1217  call check( nf90_put_att(ncid, lat_varid, 'long_name', 'latitude') )
1218  call check( nf90_put_att(ncid, lat_varid, 'standard_name', 'latitude') )
1219  call check( nf90_put_att(ncid, lat_varid, 'axis','Y'))
1220  call check( nf90_put_att(ncid, lon_varid, units, lon_units) )
1221  call check( nf90_put_att(ncid, lon_varid, 'long_name', 'longitude') )
1222  call check( nf90_put_att(ncid, lon_varid, 'standard_name', 'longitude') )
1223  call check( nf90_put_att(ncid, lon_varid, 'axis','X'))
1224  call check(nf90_put_att(ncid,rec_varid,units,&
1225  'days since 1990-01-01 00:00:00'))
1226  call check(nf90_put_att(ncid,rec_varid,'long_name','julian day (UT)'))
1227  call check( nf90_put_att(ncid, rec_varid,'standard_name', 'time') )
1228  call check( nf90_put_att(ncid, rec_varid, 'conventions',&
1229  'relative julian day with decimal part (as part of the day)' ) )
1230  call check( nf90_put_att(ncid, rec_varid, 'axis','T'))
1231 #endif
1232  !
1233 #ifdef W3_TRKNC
1234  dimids = (/ lon_dimid, lat_dimid, sys_dimid, rec_dimid /)
1235  if( ivar == 1) then
1236  call check( nf90_def_var(ncid, var1_name, nf90_real, dimids,var1_varid) )
1237  if(outputtype.EQ.4) call check( nf90_def_var_deflate(ncid,var1_varid,1,1,deflate) )
1238  call check( nf90_put_att(ncid, var1_varid, units, var1_units) )
1239  call check( nf90_put_att(ncid, var1_varid,'long_name','significant_wave_height') )
1240  call check( nf90_put_att(ncid, var1_varid,'missing_value','9999.00'))
1241  else if( ivar == 2) then
1242  call check( nf90_def_var(ncid, var2_name, nf90_real, dimids, var2_varid) )
1243  if(outputtype.EQ.4) call check( nf90_def_var_deflate(ncid,var2_varid,1,1,deflate) )
1244  call check( nf90_put_att(ncid, var2_varid, units, var2_units) )
1245  call check( nf90_put_att(ncid, var2_varid,'long_name','peak_period') )
1246  call check( nf90_put_att(ncid, var2_varid,'missing_value','9999.00') )
1247  else if ( ivar ==3 ) then
1248  call check( nf90_def_var(ncid, var3_name, nf90_real, dimids, var3_varid) )
1249  if(outputtype.EQ.4) call check( nf90_def_var_deflate(ncid,var3_varid,1,1,deflate) )
1250  call check( nf90_put_att(ncid, var3_varid, units, var3_units) )
1251  call check( nf90_put_att(ncid, var3_varid,'long_name','peak_direction') )
1252  call check( nf90_put_att(ncid, var3_varid,'missing_value','9999.00') )
1253  else
1254  call check( nf90_def_var(ncid, var4_name, nf90_real, dimids, var4_varid) )
1255  if(outputtype.EQ.4) call check( nf90_def_var_deflate(ncid,var4_varid,1,1,deflate) )
1256  call check( nf90_put_att(ncid, var4_varid, units, var4_units) )
1257  call check( nf90_put_att(ncid,var4_varid,'long_name','directional_spread') )
1258  call check( nf90_put_att(ncid, var4_varid,'missing_value','9999.00') )
1259  endif
1260  call check( nf90_enddef(ncid) )
1261 #endif
1262  !
1263 #ifdef W3_TRKNC
1264  call check( nf90_put_var(ncid, lat_varid, lats) )
1265  call check( nf90_put_var(ncid, lon_varid, lons) )
1266  call check( nf90_put_var(ncid, rec_varid, times) )
1267 #endif
1268  !
1269 #ifdef W3_TRKNC
1270  count = (/ nlons, nlats, nsys, ntime /)
1271  start = (/ 1, 1, 1, 1 /)
1272  if( ivar == 1) then
1273  call check( nf90_put_var(ncid, var1_varid, data_in, start = start, &
1274  count = count) )
1275  else if( ivar == 2) then
1276  call check( nf90_put_var(ncid, var2_varid, data_in, start = start, &
1277  count = count) )
1278  else if( ivar == 3) then
1279  call check( nf90_put_var(ncid, var3_varid, data_in, start = start, &
1280  count = count) )
1281  else
1282  call check( nf90_put_var(ncid, var4_varid, data_in, start = start, &
1283  count = count) )
1284  endif
1285  call check( nf90_close(ncid) )

References check(), and w3timemd::julday().

Referenced by ww3_systrk().

◆ ww3_systrk()

program ww3_systrk

Perform spatial and temporal tracking of wave systems, based on spectral partition (bulletin) output.

This is a controller program. It reads the input parameter file ww3_systrk.inp and calls subroutine waveTracking_NWS_V2 to perform the actual tracking procedure. Write output (fields and point output).

Author
A. J. van der Westhuysen
Jeff Hanson
Eve-Marie Devaliere
Date
16-Jan-2017

Definition at line 29 of file ww3_systrk.F90.

References file(), include(), constants::pi, pt2netcdf(), t2netcdf(), w3timemd::tdiff(), and w3strkmd::wavetracking_nws_v2().

w3adatmd::hs
real, dimension(:), pointer hs
Definition: w3adatmd.F90:587
w3timemd::julday
integer function julday(id, mm, iyyy)
Definition: w3timemd.F90:756
w3timemd
Definition: w3timemd.F90:3
check
subroutine check(status)
N/A.
Definition: ww3_systrk.F90:1299