Configuration File

Create a file that will hold configuration values for the various scripts that are needed for the inversion. This file is made up of key = value lines, with comments available using ‘#’ as the beginning of the comment. The default name of the configuration file is ‘config.ini’.

Example

# Template for inversion config file
#
# Top directory we are working in.
# h and hq directories will be created in workdir
workdir='/data/inversions/summer2012v1.1'
hdir = 'H'
h_tmp_dir = "tmpH"
hqdir = 'HQ'
hsigdir = 'Hsigma'

isbound = 0
bound_name = "flux"

start_date = "2012-6-1"
end_date = "2012-8-31"

# hrsperstep - Hours between time steps in the inversion/footprint
hrsperstep = 3

# domain latitude and longitude boundaries
south = 10
north = 80
west = -170
east = -50

# resolution of grid in degrees
lat_resolution = 1
lon_resolution = 1

# spatial and temporal correlation parameters
spatial_corr_length = 1000
temporal_corr_length = 7.0

# landmask file
# Netcdf file containing land/ocean designation for domain
landmask_file = 'landmask_na.npy'

# vshat aggregation dates
# time span will be from date up to but not including the following date
# include ending date 1 day past end_date
vshat_dates = ["2012-6-1", "2012-7-1", "2012-8-1", "2012-9-1"]

# The spatial covariance file.
# Created with make_sc.py
# This file has the distances from grid cell to grid cell,
# which is the bulk of the calculations, but needs to be done
# only once per grid.
# Actual covariance is computed in inversion.py
# as var*exp(-spcov/corr_length)
sp_cov_file = "spcov.npy"

hsensitivity_name = "Hsensitivity"

Warning

For the current version of the software, there are restrictions on the value of the ‘hrsperstep’ value in the configuration. It must be <= 24 and evenly divide into 24, that is, allowed values are 1,2,3,4,6,8,12,24. This restriction may be removed in future versions of the software.

The configuration values are contained in a python dict called ‘config’. There are additional entries calculated in addition to the ones specified in the configuration file. A complete config dict from the above configuration file would contain:

          bound_name : flux
                east : -50
               edate : 2012-09-01 00:00:00
            end_date : 2012-8-31
           h_tmp_dir : tmpH
                hdir : H
               hqdir : HQ
          hrsperstep : 3
   hsensitivity_name : Hsensitivity
             hsigdir : Hsigma
             isbound : 0
       landmask_file : landmask_na.npy
      lat_resolution : 1
              latmax : 169
              latmin : 100
                lats : [ 10.5  10.5  10.5 ...,  79.5  79.5  79.5]
           locations : 3470
      lon_resolution : 1
              lonmax : 129
              lonmin : 10
                lons : [-85.5 -84.5 -83.5 ..., -81.5 -80.5 -75.5]
              ncells : 8400
               ndays : 92
          nlandcells : 3470
           nlatgrids : 70
           nlongrids : 120
               north : 80
          ntimesteps : 736
              oneday : 1 day, 0:00:00
               sdate : 2012-06-01 00:00:00
               south : 10
         sp_cov_file : spcov.npy
 spatial_corr_length : 1000
          start_date : 2012-6-1
       steps_per_day : 8
temporal_corr_length : 7.0
            timestep : 3:00:00
         vshat_dates : ['2012-6-1', '2012-7-1', '2012-8-1', '2012-9-1']
                west : -170
             workdir : /data/inversions/summer2012v1.1

Note

Starting with version 0.15, the ‘numprocs’ setting is no longer used. It is now an option to the HQ Calculations script.

TODO

Getting the config dictionary values from the config file using the getConfig() method in utils.py.

Explain what all the config dict entries mean