﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
697	Important: 4D-Var or EnKF initial/restart file, ROMS depths, Observations	arango	arango	"A new output NetCDF file '''DAINAME''' was added to input script '''ocean.in''', which includes the '''4D-Var''' analysis that can be used as initial conditions for the next data assimilation cycle. Also, it can be used to restart the next run of an Ensemble Kalman Filter ('''EnKF''').  For example, this file can be read by the '''DART''' (Data Assimilation Research Testbed) software developed at [http://www.image.ucar.edu/DAReS/DART/ DAReS NCAR]. 

A new C-preprocessing option '''ENKF_RESTART''' is added for using '''DART''' or other offline '''EnKF''' data assimilation packages. It generates ROMS nonlinear model initial/restart conditions for the ensemble runs.

The '''DAINAME''' file contains the usual model state variables needed to initialize ROMS:

 {{{
        double zeta(ocean_time, eta_rho, xi_rho) ;
                zeta:long_name = ""free-surface"" ;
                zeta:units = ""meter"" ;
                zeta:time = ""ocean_time"" ;
                zeta:water_points = ""mask_rho"" ;
                zeta:coordinates = ""lon_rho lat_rho ocean_time"" ;
                zeta:field = ""free-surface, scalar, series"" ;
                zeta:_FillValue = 1.e+37 ;
        double ubar(ocean_time, eta_u, xi_u) ;
                ubar:long_name = ""vertically integrated u-momentum component"" ;
                ubar:units = ""meter second-1"" ;
                ubar:time = ""ocean_time"" ;
                ubar:coordinates = ""lon_u lat_u ocean_time"" ;
                ubar:field = ""ubar-velocity, scalar, series"" ;
                ubar:_FillValue = 1.e+37 ;
        double vbar(ocean_time, eta_v, xi_v) ;
                vbar:long_name = ""vertically integrated v-momentum component"" ;
                vbar:units = ""meter second-1"" ;
                vbar:time = ""ocean_time"" ;
                vbar:coordinates = ""lon_v lat_v ocean_time"" ;
                vbar:field = ""vbar-velocity, scalar, series"" ;
                vbar:_FillValue = 1.e+37 ;
        double u(ocean_time, s_rho, eta_u, xi_u) ;
                u:long_name = ""u-momentum component"" ;
                u:units = ""meter second-1"" ;
                u:time = ""ocean_time"" ;
                u:coordinates = ""lon_u lat_u s_rho ocean_time"" ;
                u:field = ""u-velocity, scalar, series"" ;
                u:_FillValue = 1.e+37 ;
        double v(ocean_time, s_rho, eta_v, xi_v) ;
                v:long_name = ""v-momentum component"" ;
                v:units = ""meter second-1"" ;
                v:time = ""ocean_time"" ;
                v:coordinates = ""lon_v lat_v s_rho ocean_time"" ;
                v:field = ""v-velocity, scalar, series"" ;
                v:_FillValue = 1.e+37 ;
        double temp(ocean_time, s_rho, eta_rho, xi_rho) ;
                temp:long_name = ""potential temperature"" ;
                temp:units = ""Celsius"" ;
                temp:time = ""ocean_time"" ;
                temp:coordinates = ""lon_rho lat_rho s_rho ocean_time"" ;
                temp:field = ""temperature, scalar, series"" ;
                temp:_FillValue = 1.e+37 ;
        double salt(ocean_time, s_rho, eta_rho, xi_rho) ;
                salt:long_name = ""salinity"" ;
                salt:time = ""ocean_time"" ;
                salt:coordinates = ""lon_rho lat_rho s_rho ocean_time"" ;
                salt:field = ""salinity, scalar, series"" ;
                salt:_FillValue = 1.e+37 ;
}}}

In addition, this output file also contains the time independent ('''zeta=0''') depths '''z_rho''', '''z_u''', '''z_v''', and '''z_w''' that are computed in new routine '''set_depth0''' inside of '''set_depth.F''':

 {{{
        double z_rho(s_rho, eta_rho, xi_rho) ;
                z_rho:long_name = ""time independent depth of RHO-points"" ;
                z_rho:units = ""meter"" ;
                z_rho:negative_value = ""downwards"" ;
                z_rho:coordinates = ""lon_rho lat_rho s_rho"" ;
        double z_u(s_rho, eta_u, xi_u) ;
                z_u:long_name = ""time independent depth of U-points"" ;
                z_u:units = ""meter"" ;
                z_u:negative_value = ""downwards"" ;
                z_u:coordinates = ""lon_u lat_u s_rho"" ;
        double z_v(s_rho, eta_v, xi_v) ;
                z_v:long_name = ""time independent depth of V-points"" ;
                z_v:units = ""meter"" ;
                z_v:negative_value = ""downwards"" ;
                z_v:coordinates = ""lon_v lat_v s_rho"" ;
        double z_w(s_w, eta_rho, xi_rho) ;
                z_w:long_name = ""time independent depth of W-points"" ;
                z_w:units = ""meter"" ;
                z_w:negative_value = ""downwards"" ;
                z_w:coordinates = ""lon_rho lat_rho s_w"" ;
}}}

These depths and the state variable longitude and latitudes locations are need in '''EnKF''' packages for 3D localization and inflation techniques.

----

For completeness, the time dependent depths (varying '''zeta''') can also be written to the history ('''HISNAME''') output NetCDF file.  The user just need to activate the appropriate new switches in '''ocean.in''': 

 {{{
Hout(idpthR) == T       ! z_rho              time-varying depths of RHO-points
Hout(idpthU) == T       ! z_u                time-varying depths of U-points
Hout(idpthV) == T       ! z_v                time-varying depths of V-points
Hout(idpthW) == T       ! z_w                time-varying depths of W-points
}}}

In this case, we get the following variables in the history NetCDF file:

 {{{
        double z_rho(ocean_time, s_rho, eta_rho, xi_rho) ;
                z_rho:long_name = ""time dependent depth of RHO-points"" ;
                z_rho:units = ""meter"" ;
                z_rho:time = ""ocean_time"" ;
                z_rho:coordinates = ""lon_rho lat_rho s_rho ocean_time"" ;
                z_rho:field = ""z_rho, scalar, series"" ;
        double z_u(ocean_time, s_rho, eta_u, xi_u) ;
                z_u:long_name = ""time dependent depth of U-points"" ;
                z_u:units = ""meter"" ;
                z_u:time = ""ocean_time"" ;
                z_u:coordinates = ""lon_u lat_u s_rho ocean_time"" ;
                z_u:field = ""z_u, scalar, series"" ;
        double z_v(ocean_time, s_rho, eta_v, xi_v) ;
                z_v:long_name = ""time dependent depth of V-points"" ;
                z_v:units = ""meter"" ;
                z_v:time = ""ocean_time"" ;
                z_v:coordinates = ""lon_v lat_v s_rho ocean_time"" ;
                z_v:field = ""z_v, scalar, series"" ;
        double z_w(ocean_time, s_w, eta_rho, xi_rho) ;
                z_w:long_name = ""time dependent depth of W-points"" ;
                z_w:units = ""meter"" ;
                z_w:time = ""ocean_time"" ;
                z_w:coordinates = ""lon_rho lat_rho s_w ocean_time"" ;
                z_w:field = ""z_w, scalar, series"" ;
}}}

Notice that these time varying depths are not needed in various third party software applications because ROMS output files are CF compliant and the NetCDF-Java interface is used to compute these depths automatically using the registered metadata ''standard_name'' '''ocean_s_coordinate_g1''' or '''ocean_s_coordinate_g2'''.  See [https://www.myroms.org/wiki/Vertical_S-coordinate WikiROMS] for more information. Anyway, having these depths in the history NetCDF file has been requested by several users that want to use the '''R''' Project for Statistical Computing, for example.

----

The ROMS observation operator was enhanced so the output file '''MODNAME''' contains a complete input observations data in addition the model sampled at the observations locations in space and time:

 {{{
        double survey_time(survey) ;
                survey_time:long_name = ""survey time"" ;
                survey_time:units = ""days since 1968-05-23 00:00:00 GMT"" ;
                survey_time:calendar = ""gregorian"" ;
        int obs_type(datum) ;
                obs_type:long_name = ""model state variable associated with observation"" ;
        int obs_provenance(datum) ;
                obs_provenance:long_name = ""observation origin"" ;
                obs_provenance:flag_values = 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 ;
                obs_provenance:flag_meanings = ""gridded_AVISO_SLA blended_SST XBT_Met_Office CTD_temperature_Met_Office CTD_salinity_Met_Office ARGO_temperature_Met_Office ARGO_salinity_Met_Office CTD_temperature_CalCOFI CTD_salinity_CalCOFI CTD_temperature_GLOBEC CTD_salinity_GLOBEC"" ;
        double obs_time(datum) ;
                obs_time:long_name = ""time of observation"" ;
                obs_time:units = ""days since 1968-05-23 00:00:00 GMT"" ;
                obs_time:calendar = ""gregorian"" ;
        double obs_lon(datum) ;
                obs_lon:long_name = ""observation longitude"" ;
                obs_lon:units = ""degrees_east"" ;
        double obs_lat(datum) ;
                obs_lat:long_name = ""observation latitude"" ;
                obs_lat:units = ""degrees_north"" ;
        double obs_depth(datum) ;
                obs_depth:long_name = ""depth of observation"" ;
                obs_depth:units = ""meter"" ;
                obs_depth:negative_value = ""downwards"" ;
                obs_depth:missing_value = 1.e+37 ;
        double obs_Xgrid(datum) ;
                obs_Xgrid:long_name = ""observation fractional x-grid location"" ;
        double obs_Ygrid(datum) ;
                obs_Ygrid:long_name = ""observation fractional y-grid location"" ;
        double obs_Zgrid(datum) ;
                obs_Zgrid:long_name = ""observation fractional z-grid location"" ;
        double obs_error(datum) ;
                obs_error:long_name = ""observation error covariance"" ;
        double obs_value(datum) ;
                obs_value:long_name = ""observation value"" ;
        double obs_scale(datum) ;
                obs_scale:long_name = ""observation screening/normalization scale"" ;
        double NLmodel_value(datum) ;
                NLmodel_value:long_name = ""nonlinear model at observation locations"" ;
}}}

This is done to facilitate offline '''EnKF''' packages to perform '''3D-FGAT''' (First Guess at Appropriate Time) data assimilation.  This capability will be available in '''DART''' '''EnKF''' in the near future.  It is similar to the '''3D-Var''' using variational approaches. For example, it facilitates assimilating very frequent ocean observation (say, gliders) without the need to restart the '''EnKF''' at every ROMS time-step, but at a finite user-defined time window.

Notice that we are using the same observation operators for '''4D-Var''' and offline '''EnKF'''.  The updated output '''MODNAME''' NetCDF file is now self contained and can be use by offline '''EnKF''' packages directly since it contains all the necessary information for localization and inflation.  Also, it can be use by third party OpenDAP severs like the NOAA's '''ERDDAP''' tools to browse and plot its variables.
 
----

'''WARNING:'''

All the ROMS input scripts we modified to add the new output '''DAINAME''' NetCDF file and the switches to write out depths to the output history NetCDF file '''Hout(idpthR)''', '''Hout(idpthU)''', '''Hout(idpthV)''', and '''Hout(idpthW)'''.

----
"	upgrade	new	major	Release ROMS/TOMS 3.7	Nonlinear	3.7			
