• FORTRAN COMPONENTS
  • 5. FORTRAN COMPONENTS

    5.1 ORBIT PROCESSING

    5.1.1 ici flowchart
    main program ici.F
    subroutine ici_l1dinit
    subroutine ici_setup
    subroutine ici_lecl1d
    subroutine ici_lecl1damsu
    subroutine ici_lecl1dmsu
    subroutine lec_airmas
    subroutine lec_delta
    subroutine lec_guess
    subroutine lec_inv
    subroutine lec_previ
    subroutine ici_rtinit
    subroutine ici_chxl1d
    subroutine ici_cpl1d
    subroutine sec_numb
    subroutine cal_delta
    subroutine airmassat
    subroutine extr_previ
    subroutine near_cmeteo
    subroutine ici_emis
    subroutine ici_emis_mw
    subroutine ici_guess
    subroutine ici_inv

    5.1.2 lec_previ flowchart
    subroutine lec_previ
    subroutine ici_open_grib
    subroutine ici_read_grib
    subroutine lec_gmeteo
    subroutine lec_cmeteo

    5.1.3 ici_guess flowchart
    subroutine ici_guess
    subroutine ici_tbguess
    subroutine ici_nearest
    subroutine ici_clarif

    5.1.4 ici_inv flowchart
    subroutine ici_inv
    subroutine ici_rtknoaa
    subroutine ici_cal_ems
    subroutine rttov_cms
    subroutine rtint_cms

    5.2 BASE_METEO CREATION SOURCES main program ici_rs.F
    subroutine f_ici_rs
    main program ici_rs_bufr.F
    subroutine ici_open_bufr
    subroutine ici_close_bufr
    subroutine ici_bufrex
    subroutine ici_decrsbufr
    subroutine ici_rsbufrtop40
    main program ici_analyse.F
    subroutine f_ici_ana
    5.3 INITIAL LIBRARY CREATION SOURCES main program ici_selectp40.F
    main program ici_mkguess.F
    subroutine ici_rtmkficbg
    main program ici_catguess.F
    main program ici_convtop40.F
    main program ici_covair.F
    5.4 CO-LOCATIONS AND STATISTICS CREATION SOURCES 5.4.1 Co-locations
    main program ici_coloc.F
    main program ici_colocl1d.F
    subroutine geogcart
    main program ici_filcoloc.F
    subroutine get_refdelta
    subroutine ici_elimdtb
    subroutine ici_rtnoaa

    5.4.2 Statistics
    main program ici_monitor.F
    main program ici_delta.F
    subroutine ici_ecarttb
    subroutine ici_ecartprofil
    subroutine ici_regmul
    subroutine ici_stat
    main program ici_covbg.F

    5.5 INVERSION CODING SOURCES main program ici_toascii.F
    main program ici_tobufr.F
    subroutine codebufr_atovs.F
    subroutine codebufr_tovs.F
    subroutine ici_bufren
    subroutine ici_tvlayers
    main program ici_togrib.F
    subroutine ici_levels_to_fields
    subroutine ici_write_grib
    subroutine ici_close_grib
    main program ici_tol2.F
    subroutine wr_h_l2
    subroutine wr_rec_l2
    main program ici_satem.F
    subroutine codesatem
    main program ici_p40.F
    5.6 GRAPHIC DISPLAY SOURCES main program ici_gmtfield.F
    subroutine profile_lay
    main program ici_gmtfield_intp.F
    subroutine ici_gmt_interpol
    subroutine ici_gmt_smoothing
    main program ici_gmtstatdtb.F
    main program ici_gmtstatrms.F
    main program ici_gmtdate.F
    validation.html
    5.7 GENERAL PURPOSE SUBROUTINES FOR THE APPLICATION subroutine airmasrs
    subroutine calal
    subroutine coucheh2o
    subroutine ici_calgeo
    subroutine ici_fn
    subroutine ici_msis
    subroutine sp_creeb
    subroutine ici_prstn
    subroutine ici_rtplanck
    subroutine ici_rtbright
    subroutine ici_upg_p40
    subroutine ici_upg_sat
    subroutine intplog
    subroutine matcov
    subroutine matinv
    subroutine rec_tropo
    subroutine ref32po3
    subroutine prn_p40
    real function rmtohu
    subroutine toth2o
    subroutine totozone

    This section gives a description of the Fortran source programs, the execution programs of which (*.exe) are invoked by the commands described in chapter 4.
    The present version is written in Fortran77 with structures proper to the SUN and HP compilers.
    Each software routine or subroutine generally contains a basic self-documented include file: ici_def.h. which can be found in appendix 4. It describes structures, logical units and general purpose application commons. As a general rule, for simplification purposes, the following descriptions do not include the descriptions given in the ici_def.h file.
    Coding stages are described when it is necessary to understand the software.
    Error codes are all described in software managment. This is probably easier for the user who has to deal with an error.
    Subroutines xijg, xigj, xijq, xiqj... are date handling routines e.g.: xijg converts a Julian instant into a Gregorian instant. Such subroutines are used on a regular basis in the application’s routines. They form part of the data handling library f7tp supplied with the AAPP software.
    The cp_xxx functions are used for comparing character strings. For example, cp_cus compares 2 character strings by only considering meaningful characters and ignoring their type (capital letters or lower case characters). They are part of lib : f7cp supplied with the AAPP software. The Julian day 0 is January 1st, 1950 0h.
    The ml_xxx subroutines are used to send formatted messages to the standard error. They are part of lib : f7ml supplied with the AAPP software. The form is :
    > yyyy/mm/dd hh:mn:ss machine-name pid command level text
    level can be : INFO, WARNING, NOTICE, ERROR
     

    1. ORBIT PROCESSING

    2. Diagrams show how the main ici.F program is organized for processing an orbit.

      1. ici flowchart


      2.  

        Diagram -1: ICI module flowchart

         

        1. main program ici.F

        2. SYNTAX : ici
          IN : ici.F
          INVOKED BY: ici command
          INCLUDE : ici_def.h definition of ici charts and variables
          INPUTS:
          hirsl1d_noaaxx_yyyymmdd_hhmn_nnnnn.l1d satellite data file
          previ_noaaxx_yyyymmdd_hhmn.grib forecast file
          delta_noaaxx.txt internal statistic coefficient file
          profils_noaaxx.p40 initial library profiles file
          profils_noaaxx.rad initial library up/down radiance file.
          profils_noaaxx.tau initial library transmittance file
          covbg_noaaxx.mat guess error covariance matrix file
          covair_noaaxx.mat air mass covariance matrix file
          rt_coef_noaa.dat  RTTOV internal coefficients file
          OUTPUTS :
          ici_noaaxx_yyyymmjj_hhmn_nnnnn.ici inversion file 
          ici_noaaxx_yyyymmjj_hhmn_nnnnn.log log file
          OBJECT : This is the main program for processing an hirsl1d pass.
          Description of the algorithm :

          To open the satellite data file and read the header record (ici_l1dinit) in order to check if the file contains some MSU (Noaa14) or AMSU (Noaa15, Noaa16).
          To initialize all satellite dependent charts (ici_setup). The use of the AVHRR information is also defined by this routine.
          To read l1d files (ici_lecl1d) and place the data used for recognizing the air mass (lec_airmas) into charts, to compute the direct model bias (lec_delta), to read the guess profiles library (lec_guess), to compute the cost function (lec_inv). To read the forecast file and to extract the fields that are useful for the inversion (lec_previ).
          To initialize the fast transfer model (ici_rtinit).
          To open the result file. Subroutine ici_fn is used everywhere when a file name has to be defined to be opened so as that the software can be exported.
          Loop onto HIRS pixels
          Loop onto HIRS lines

          Selection of the HIRS f.o.v.’s to be processed in the box, the size of which is defined in parameter (ici_chxl1d). The selection depends on the AVHRR cloud cover. If no AVHRR is used, it takes the centered f.o.v in the box.
          Copy of satellite data from file l1d for selected f.o.v. (ici_cpl1d)
          Definition of processing conditions (land/sea/coast, clear/pt-cloudy/cloudy)
          Computation of secant number (1 to 10) according to sighting angle (num_sec)
          Initialization of the channel tables which depends on the situation (ici_initcan)
          Computation of RTTOV dynamic biases (cal_delta)
          Observations corrected to synthetic values by bias subtraction
          Search for the fov air mass (airmassat)
          Extraction of the forecast values for the fov (extr_previ). If no AVHRR used, the surface temperature comes from the forecast.
          Definition of surface emissivities (IR + micro-wave) according to sighting angle (IR) and to the type of surface on land or computed with a wind-on-sea forecast (micro-wave) (ici_emis).
          Computation of a surface pressure dependent number
          Selection of initial profile (ici_guess)
          The initial profile is printed out in the log output in case of debug mode (prn_p40)
          if irejguess OK : computation of inverted profile (ici_inv)
          the inverted profile is printed out in the log file (prn_p40)
          RTTOV biases applied in the opposite direction on the observations
          if irejinv OK : the record is written into the output file
          end of loop on lines
          end of loop on pixels

          print-out of statistics on execution program (run)
          closure of result file
          SUBROUTINES INVOKED:
          ici_lecl1d ici_initcan lec_airmas lec_delta lec_guess lec_inv
          lec_previ ici_rtinit ici_fn ici_chxl1d sec_num cal_delta
          airmassat extr_previ ici_emis ici_guess ici_inv prn_p40
          ici_setup ici_l1dinit
          ml_wti, ml_wtr, ml_wt display error messages (integer, real, text)
           
        3. subroutine ici_l1dinit

        4. SYNTAX : ici_l1dinit(nomsat, orbit, nbp, nbl)
          IN : in libici
          INCLUDE : ici_def.h definition of ici charts and variables
          ppparms.h definition of the parameters linked to the l1d
          hrs1d.h definition of ATOVS 11d file header
          OUTPUTS : character*8 nomsat satellite name
          integer orbite satellite number
          integer nbp number of pixels of the orbit
          integer nbl number of lines of the orbit
          in the common /c_l1d/ l1d_start, l1d, locl1d, pix_ok
          double precision l1d_start start of acquisition instant
          OBJECT : To recognize the satellite data type (TOVS or ATOVS).
          Description of the algorithm :

          To open the satellite data file
          To read the header
          To recognize if the data is TOVS or ATOVS -> to invoke amsu routines
          To read the nbp, nbl and l1d_start values
          To close the satellite data file
          SUBROUTINES INVOKED : ici_fn
           
        5. subroutine ici_setup

        6. SYNTAX : ici_setup(nomsat)
          IN : in libici
          INCLUDE : ici_def.h definition of ici charts and variables
          INPUTS : nomsat: satellite name (read previously in the level1d file)
          OBJECT : to read the set-up file for the initialization of all the channel tables in ICI which are function of the satellite (icantb, ican_rttov, icanair, icandelt, icanbg,_sat, icaninv_sat).
           
        7. subroutine ici_lecl1d

        8. SYNTAX : ici_lecl1d (nomsat, orbite, nbp, nbl)
          IN : in libici
          INCLUDE : ici_def.h definition of ici charts and variables
          OUTPUTS : character*8 nomsat satellite name
          integer orbite orbit number
          integer nbp number of pixels of the line
          integer nbl number of lines of the orbit
          common /c_l1d/ l1d_start, l1d, locl1d, pix_ok
          double precision l1d_start start of acquisition instant
          integer l1d(l1d_mxc, l1d_mxp, l1d_mxl) satellite data chart
          l1d_mxc =128 maximum number of channels
          l1d_mxp = 140 maximum number of lines
          l1d_mxl = 56 maximum number of pixels
          real locl1d(6, l1d_mxp, l1d_mxl) location chart
          logical pix_ok(l1d_mxp, l1d_mxl) = true if pixel ok
          OBJECT : to open the satellite data file, to file the observation data in charts and close the file.
          Description of the algorithm :

          To open and read satellite data by invoking the relevant subroutine which is different for TOVS and ATOVS(ici_lec1damsu or ici_lec1dmsu)
          To test the quality of the values for each fov (pix_ok),independantly for the next classes: HIRS, HIRS Quality flag, AMSUA, AMSUA preprocessing flag, MSU, total channels.
          To quit in exit 3 if more than 50% of observations are incorrect, for one of the classes.
          SUBROUTINES INVOKED : ici_lecl1damsu ici_lecl1dmsu
           
        9. subroutine ici_lecl1damsu

        10. SYNTAX : ici_lecl1damsu (nbp, nbl)
          IN : in libici
          INCLUDE : ici_def.h definition of ici charts and variables
          ppparms.h definition of the parameters linked to the l1d
          hrs1d.h definition of ATOVS 11d file header
          INPUTS : integer nbp number of pixels in the orbit
          integer nbl number of lines in the orbit
          OUTPUTS : in the common /c_l1d/ l1d_start, l1d, locl1d, pix_ok
          integer l1d(l1d_mxc, l1d_mxp, l1d_mxl) satellite data chart
          l1d_mxc =128 maximum number of channels
          l1d_mxp = 140 maximum number of lines
          l1d_mxl = 56 maximum number of pixels
          real locl1d(6, l1d_mxp, l1d_mxl) location chart
          OBJECT : to read all satellite data in the ATOVS format in the HIRS grid.
          Description of algorithm :

          To open the file and read the header
          To loop onto the lines and read each record corresponding to a line
          To file the information in the 11d chart (satellite measurements, preprocessing) and the locl1d chart (latitude, longitude, angles)
          To close the file
          SUBROUTINES INVOKED: ici_fn
           
        11. subroutine ici_lecl1dmsu

        12. SYNTAX: ici_lecl1dmsu (nbp, nbl)
          IN : in libici
          INCLUDE : ici_def.h definition of ici charts and variables
          ppparms.h definition of the parameters linked to the l1d
          hrs1dm.h definition of TOVS 11d file header
          INPUTS : integer nbp number of pixels in the orbit
          integer nbl number of lines in the orbit
          OUTPUTS : in the common /c_l1d/ l1d_start, l1d, locl1d, pix_ok
          integer l1d(l1d_mxc, l1d_mxp, l1d_mxl) satellite data chart
          l1d_mxc =128 maximum number of channels
          l1d_mxp = 140 maximum number of lines
          l1d_mxl = 56 maximum number of pixels
          real locl1d(6, l1d_mxp, l1d_mxl) location chart
          OBJECT : to read all satellite data in the TOVS format in the HIRS grid.
          Description of algorithm :

          opening of the satellite data file in the MSU on the HIRS grid format
          To open the file and read the header
          To loop onto the lines and read each record corresponding to a line
          To file the information in the l1d chart (satellite measurements, preprocessing) and the locl1d chart (latitude, longitude, angles)
          To close the file
          SUBROUTINES INVOKED : ici_fn
           
        13. subroutine lec_airmas

        14. SYNTAX : lec_airmas
          IN : in libici
          INCLUDE : ici_def.h definition of ici charts and variables
          OUTPUTS : covair_inv(maxcanair,maxcanair,nmair,nsec) (in ici_def.h)
          maxcanair=7, nmair=5, nsec=10
          OBJECT : to read the file containing the inverse covariance matrices for the air mass selection channels for the 10 scanning secants (nsec) and the 5 air masses (nmair)
          SUBROUTINES INVOKED : ici_fn
           
        15. subroutine lec_delta

        16. SYNTAX : lec_delta
          IN : in libici
          INCLUDE : ici_def.h definition of ici charts and variables
          OUTPUTS :
          common /delta/delref_tb, sigdelref_tb, delcor_tb, delsigcor_tb RTTOV bias and standard deviation of error before and after dynamic correction
          common/delta_dyn/deldyn_a0, deldyn_coef regression coefficient for the dynamic computation of biases depending on the observation
          OBJECT : to read the biases (delref_tb) and standard deviation (sigdelref_tb) of the errors of direct model and the corresponding corrected biases and standard deviation (delcor_tb, delsigcor_tb) . To read the linear regression coefficients required for a dynamic computation of biases (deldyn_a0, deldyn_coef) :
          Description of algorithm :

          Open the statistics reference file delta*.txt
          Search for the MDTB, SDTB, MDTBC, SDTBC, DTBA0, DTBCOEFF patterns and file the data into the preceding charts
          Close the file
          SUBROUTINES INVOKED : ici_fn, open, close
           
        17. subroutine lec_guess

        18. SYNTAX : lec_guess
          IN : in libici
          INCLUDE : ici_def.h definition of ici charts and variables
          INPUT : common /init_can/ for the numbers of the channels depending on msu or amsu
          OUTPUTS : common /guess_prof/ profil, nprof
          OBJECT : to read the guess library profiles file and open the 2 other files (radiances, transmittances) :
          Description of the algorithm :

          To open, read and close the profiles files from the initial profiles library.
          To open the 2 other files in the library (up and down radiance, total transmittance)
          SUBROUTINES INVOKED : ici_fn, open, close
           
        19. subroutine lec_inv

        20. SYNTAX : lec_inv
          IN : in libici
          INCLUDE : ici_def.h definition of ici charts and variables
          OUTPUTS : common /inv_covbg/ covbg,bg_moy,
          bg_sig
          covbg : error covariance matrix of the guess
          bg_moy : bias of guess deviation (compared to real profiles)
          bg_sig : standard deviation of guess deviation (compared to real profiles)
          OBJECT : to read the guess profile covariance matrices :
          Description of the algorithm :

          Open the error covariance matrix file of the guess covbg*.mat
          Fill in charts bg_moy, bg_sig and covbg
          Close file
          SUBROUTINES INVOKED : ici_fn, open, close
           
        21. subroutine lec_previ

        22. This subroutine is detailed in chapter 5.1.2
           
        23. subroutine ici_rtinit

        24. SYNTAX : ici_rtinit(noaasat)
          IN : in libf77rttov6
          INCLUDE : none
          INPUTS: noaasat satellite number (e.g.: for noaa14 = 14)
          OBJECT : subroutine of interface with the RTTOV library :
          To invoke the RTTOV initializing rttvi subroutine (RTTOV is not described in this document)
          SUBROUTINES INVOKED: rttvi
           
        25. subroutine ici_chxl1d

        26. SYNTAX : ici_chxl1d(imeth,nbp,nbl,cpbox,clbox,lpbox,llbox,pix,lin,ierr)
          IN : in libici
          INPUTS : imeth,nbp,nbl,cpbox,clbox,lpbox,llbox,
          In the common /c_l1d/ l1d_start, l1d, locl1d, pix_ok l1d and pix_ok
          OUTPUTS : pix, lin, ierr
          OBJECT : to choose the pixel (pix,lin) to be processed from a box of lpbox pixels on llbox lines, centered on the cpbox pixel and the clbox line
          Depending on the imeth method number imeth=1 the clearest in the box
          imeth ne 1 everything has to be developed
           
        27. subroutine ici_cpl1d

        28. SYNTAX : ici_cpl1d(nomsat, orbit, pix, lin, l1dsat, ierr)
          IN : in libici
          INCLUDE : ici_def.h definition of ici charts and variables
          INPUTS : nomsat, orbit, pix, lin
          l1d, locl1d chart of satellite data from the l1d file
          OUTPUTS : l1dsat satellite identification and data with the /ici_sat/structure
          OBJECT : subroutine of interface between the charts (l1d , locl1d) and the structure /ici_sat/, identifier + data, recognized in the whole ICI software (see definition in the ici_def.h include file): it copies all necessary data for the relevant observation.
          Description of the algorithm :

          To document in particular the following information of the /ici_sat/ structure:
          nomsat, orbit, amsu, instant, pixel and line number, latitude, longitude, the 4 angles, the altitude, the land/sea/coast index, the night/day index, defines a clear/ partly cloudy/cloudy index with the avhrr, a surface type with the amsu, a clear percentage with the avhrr, a surface temperature, satellite observations
          The cloud class depends only on AVHRR for msu data, and both on AVHRR and micro-wave preprocessing for amsu data.
          The surface temperature is an output of the AVHRR cloud mask when available; in order of priority:
          split-window on the clear AVHRR pixels
          if it does not exist : on sea T minimum climatology +2degrees
          on land T2m (forecast used by subroutine MAIA of AAPP)
          If the running conditions indicates ‘no AVHRR’, the surface temperature is put to vmanq.
          An error flag is set if a problem is detected on the satellite observations or on the clear/part-cloudy/cloudy index.
           
        29. subroutine sec_numb

        30. SYNTAX : sec_numb(secant, numsec)
          IN : in libici
          INCLUDE : ici_def.h definition of ici charts and variables
          INPUTS : secant 1/cos(satellite zenithal angle)
          tabsec(nsec) in ici_def.h : secant delimiters for a specific number
          OUTPUTS : numsec number from 1 to 10 in order to position oneself in the secant
          dependent files
          OBJECT : to compute a secant number from a secant value :
          If the secant is < 1 a NOTE message is sent back
          If the secant is > max. secant, it is set to max. secant
           
        31. subroutine ici_initcan

        32. SYNTAX : ici_initcan
          IN : in libici
          INCLUDE : ici_def.h definition of ici charts and variables
          OUTPUTS : common /init_can/ (for definitions see appendix 3)
          OBJECT : from the icanbg,_sat, icaninv_sat charts and from the situation conditions (surface type and cloud class) , to determine the channel charts (icanbg and icaninv) for selecting the guess and for inversion.
           
        33. subroutine cal_delta

        34. SYNTAX : cal_delta(datasat)
          IN : in libici
          INCLUDE : ici_def.h definition of ici charts and variables
          INPUTS : datasat observed /ici_sat/ structure satellite data
          common /delta_dyn/ deldyn_a0, deldyn_coef regression coefficients
          OUTPUTS : in the common /delta/ delref_tb, sigdelref_tb,  delcor_tb, sigdelcor_tb:
          delta_tb: dynamic biases of direct model before and after correction
          OBJECT : To compute dynamic biases for the RTTOV forward model
          Description of the algorithm :

          if coefficicients deldyn_a0 and deldyn_coef (1) are not null
          to compute the dynamic biases of the direct model for a given fov by using a multi-linear regression depending on the values of some observed channels and of the satellite zenithal angle.
          The mean delta_tb values initialized by lec_delta are written over by the dynamic values
           
        35. subroutine airmassat

        36. SYNTAX : airmassat(datasat)
          IN : in libici
          INCLUDE : ici_def.h definition of ici charts and variables
          INPUTS : datasat observed /ici_sat/ structure satellite data
          common /covair/ covair_inv, tbair_moy (see ici_def.h)
          OUTPUTS : datasat.data.massair of datasat and imair of the common /cond_cal/ (see ici_def.h)
          OBJECT : to determine the air mass type of an HIRS fov from the observed radiance
          Description of the algorithm :

          The air mass type is the type which reduces the distance to a minimum (out of 5 types):
          dist(air mass) = (Tbmes - Tb
          air_moy)t covair_inv (Tbmes - Tbair_moy)
          Tb
          mes is the satellite measurement
          Tb
          air_moy the mean of the Tbs for the air mass under consideration
          covair_inv the air mass covariance inverse matrix
           
        37. subroutine extr_previ

        38. SYNTAX : extr_previ( lat, lon, alt, previ)
          IN : in libici
          INCLUDE : ici_def.h definition of ici charts and variables
          INPUTS : lat, lon,alt latitude, longitude, altitude of HIRS fov under consideration
          common /ch_previ/ previ_mer, previ_t1000, previ_u, previ_v, previ_vent
          common/ch_previ2/ previ_tsurf
          OUTPUTS : forecast with /ici_previ/ structure (see ici_def.h for definition)
          OBJECT : to extract from forecasted fields stored in the common /ch_previ/ the values corresponding to the HIRS spot’s latitude and longitude.
          Description of the algorithm :

          For each relevant field, to call subroutine near_cmeteo that extracts the nearest information to the given latitude and longitude. For the surface temperature, interpolation in the grid with data of the same surface type.
          To compute the spot’s pressure surface by means of the forecasted Psea and the HIRS spot’s average altitude.
          If there is no forecast Psea, the value is put to 1013hPA.
          If there is no AVHRR information or the surface temperature is equal to vmanq, the surface temperature is extracted and corrected to the surface altitude.
          To compute the surface wind module using the vertical and horizontal components.
          To possibly print out the profile (prn_iciprevi)
          SUBROUTINES INVOKED : near_cmeteo prn_iciprevi
           
        39. subroutine near_cmeteo

        40. SYNTAX : near_cmeteo(lat, lon, champ, valeur, sametype, ierr)
          IN : in libici
          INCLUDE : ici_def.h definition of ici charts and variables
          INPUTS : lat, lon spot’s latitude, longitude
          champ forecast meteorological field with /champ_meteo/ structure (see ici_def.h )
          sametyp logical.
          OUTPUTS : valeur real, extracted value
          ierr return code (0=OK)
          OBJECT : to extract, from the input meteorological field, the value at the HIRS spot position. The extraction depends on the logical sametyp. If it is true, it makes an interpolation of the data of the same type in the grid. Otherwise, it extracts the nearest value of the grid at the HIRS position.
          Description of the algorithm :

          To look for the nearest spot in the lat, lon field on input or, if sametyp is .true. makes an interpolation with only the data of the same surface type.
          To send the result into the word : valeur
          The error code is set to 1 if no close value can be found
          If the error code is 1 on several spots, the field is printed out (prn_cmeteo)
          SUBROUTINES INVOKED : prn_cmeteo
           
        41. subroutine ici_emis

        42. SYNTAX : ici_emis(datasat, vent)
          IN : in libici
          INCLUDE : ici_def.h definition of ici charts and variables
          INPUTS : datasat observation observation
          vent wind speed
          OUTPUTS : ems_surf of /cond_cal/ common in ici_def.h include
          OBJECT : to initialize the surface emissivities for the RTTOV routines.
          Description of the algorithm :

          Initialization of the emissivity values, on sea at 0.6 and on land at 0.85 (flat land) or 0.95
          Over sea: calls 2 times the routine emiss_cms,
          first for the IR emissivities which depends on the zenith angle
          second for the micro-wave channels, if the wind velocity is >0: the emissivity values depend on the wind module and on the surface temperature.
          emiss_cms is an interface with the fastem routine from the RTTOV library.
          Over land: the values are computed from a regression with the AMSU-A 1, 2 and 3.
          SUBROUTINES INVOKED : emiss_cms (in libf77rttov6)
           
        43. subroutine ici_guess

        44. see details in chapter 5.1.3
           
        45. subroutine ici_inv

        see details in chapter 5.1.4

      3. lec_previ flowchart


      4. Diagram -1: subroutine lec_previ flowchart

        Remark: routines pbgrib, pbclose, gribex, grprs0, grprs1, grprs2, grprs3, grprs4 from the ECMWF gribex library are not described in this document because they form part of the standard tools for meteorological formats.
        In the software, there is also a pseudo grib library libicigribbufr_dummy with the routines ici_open_grib, ici_read_grib and ici_gribex which do nothing. This library replaces the libicigribbufr library by changing the options in the Makefile for users who do not have the GRIB (or BUFR) library.
         

        1. subroutine lec_previ

        2. SYNTAX: lec_previ
          IN: in libici
          INCLUDE : ici_def.h definition of ici charts and variables
          INPUTS: file previ_noaaxx_yyyymmdd_hhmn.grib (grib format) or .txt (ascii format)
          OUTPUTS: common /ch_previ/ previ_mer, previ_t1000, previ_u, previ_v, previ_vent
          Common/surfnwp/ previ_tm, previ_alt
          OBJECT : to read the forecast fields required for inversion.
          Description of the algorithm :

          to open the appropriate forecasts file for the situation
          to test if it contains grib or ascii format data and to close the file
          to re-open the file using ici_read_grib (grib format) or open (ascii)
          to read each meteorological field using ici_read_grib (grib format) or lec_gmeteo + lec_cmeteo (ascii)
          to check the date of forecast field (xijc)
          to test the name and type of each field
          to fill in the previ_mer, previ_t1000, previ_u, previ_v and previ_vent variables with the correct fields, plus previ_tsurf, previ_tm and previ_alt to be used only if the surface temperature from AVHRR is not available.
          SUBROUTINES INVOKED:
          ici_fn open ici_open_grib ici_read_grib lec_gmeteo lec_cmeteo xijc close

        3. subroutine ici_open_grib

        4. SYNTAX : ici_open_grib(filename, lu, kret)
          IN : in libici
          INCLUDE : ici_def.h definition of ici charts and variables
          INPUTS : character(*) filename file name
          lu logical number
          OUTPUTS : kret =0 OK
          OBJECT : interface with the pbopen subprogram of the grib library
          SUBROUTINES INVOKED : pbopen
           
        5. subroutine ici_read_grib

        6. SYNTAX : ici_read_grib (lu, champ, iechp, iechl, kret)
          IN : in libici
          INCLUDE : ici_def.h definition of ici charts and variables
          INPUTS : lu file’s logical unit
          iechp, iechl point (lat) / line (lon) sampling
          OUTPUTS : champ decoded grib data of /champ_meteo/ structure
          Kret error code
          OBJECT : to read (pbgrib) and to decode (gribex) a grib message according to a certain sampling (presently at CMS iechp=2, iechl=2). Charts can then be printed out using the grprs0, grprs1, grprs2, grprs3, grprs4. pbgrib, gribex, grprs0, grprs1, grprs2, grprs3, grprs4 are routines from the grib library.
          To fill the grib message in the field structure
          SUBROUTINES INVOKED : pbgrib, gribex, grprs0, grprs1, grprs2, grprs3, grprs4
           
        7. subroutine lec_gmeteo

        8. SYNTAX : ici_gmeteo(iua, grille, ios)
          IN : in libici
          INCLUDE : ici_def.h definition of ici charts and variables
          INPUTS : iua ascii file logical input number
          OUTPUTS : grille of /grille_meteo/ structure
          ios error code for file reading 0=ok
          OBJECT : to read the header of a meteorological file supplied into the ASCII format (iua unit)
          Description of the algorithm :

          To read the header of the file containing the grid type and name, the date (xigj) and ending date of the field, the grid pitch and size in pixel, line.
          To compute the min and max latitudes for the grid
          To print out the grid if it is requested by parametering (prn_gmeteo)
          To file all the information items in the variable ‘grille’
          SUBROUTINES INVOKED :xigj, prn_gmeteo
           
        9. subroutine lec_cmeteo

        SYNTAX : ici_cmeteo(iua, grille, iechp, iechl, champ, ios)
        IN: in libici
        INCLUDE : ici_def.h definition of ici charts and variables
        INPUTS : iua logical unit of the ascii file
        grille definition of the grid in read mode - /grille_meteo/ structure
        iechp, iechl sampling of the field in pixel and line
        OUTPUTS : champ resulting sampled field - /champ_meteo/ structure
        ios error code for field read 0=ok
        OBJECT : to read a meteorological field in the ASCII format (iua unit) and to fill in the field variable ‘champ’ at the given resolution by means of iechp and iechl
        Description of the algorithm :

        To check if the field size does not exceed the max. size of the variable ‘champ’
        To read a field of the meteorological file, to apply a coefficient (magnitude of the unit) and the sampling to file it in the variable ‘champ’.
        To print out the field if debug parametering is requested (prn_cmeteo)
        SUBROUTINES INVOKED :prn_cmeteo

      5. ici_guess flowchart


      6. Diagram -1: subroutine ici_guess flowchart

        General purpose routines prn_p40, rec_tropo, totozone, toth2o, ici_prstn, intplog, matcov, matinv are described in chapter 5.6.
        The ici_rtplank and rt_brivg routines uses RTTOV routines. They can convert brightness temperatures into radiance temperatures and the other way round.

         

        1. subroutine ici_guess

        2. SYNTAX : ici_guess (datasat, secante, previ, dataclear, guess_pp, guess_m, dataguess_m, irejguess)
          IN : in libici
          INCLUDE : ici_def.h
          INPUTS : datasat satellite observations according to the /ici_sat/ structure
          secante secant of the satellite zenithal angle
          previ data forecast according to the /ici_previ/ structure
          environmental data of /ici_env/ structure
          OUTPUTS : dataclear cleared satellite observations, /ici_sat/ structure
          guess_pp nearest initial profile
          guess_m initial profile (guess) used in the inversion cost function
          dataguess_m satellite data (including synthetic Tbs) associated with the guess
          irejguess rejection flag :
          0 : ok
          4 : x channels with dt>threshold for guess _pp
          5 : x channels with dt>threshold for guess_m
          6 : no initial profile with (Tbsynt-Tbobs)
          mw < threshold
          7 : dmin > threshold
          8 : no selected profile
          9 : no surface temperature
          OBJECT : to clear partly cloudy observations only for TOVS. To select the nearest profile and the guess profile from the initial profiles library. To compute the satellite Tbs associated with the intial profile and the identifier part for the nearest. To send an irejguess quality flag.
          Description of the algorithm
           :
          Check the satellite Tsurf availability. Otherwise irejguess=9 + return
          1. computation of the Tb brightness temperatures from the initial library, of the inverse of the associated covariance matrix (ici_tbguess). The channels defined depend on the type of cloud type (itypbg=iclear)
          2. search for the nearest profile and for the guess profile (ici_nearest).
          If irejguess > 5 return
          otherwise
          if TOVS and itypbg= 2 cloud clearing of mid-atmosphere HIRS channels (ici_clarif)
          set itypbg=4 then stages 1 and 2 repeated with cleared channels
          if irejguess >5 return
          computation of geopotential (ici_calgeo), air mass (airmasrs ), tropopause (rec_tropo ), total ozone contents (totozone), total water vapor contents (toth2o) for the nearest and guess profiles. If a cloud layer has been detected by means of the AVHRR, computation of the cloud top pressure from the guess (ici_prstn).
          SUBROUTINES INVOKED : ici_tbguess, ici_nearest, ici_clarif, ici_calgeo, airmasrs, rec_tropo, totozone, toth2o, ici_prstn
           
        3. subroutine ici_tbguess

        4. SYNTAX : ici_tbguess (datasat, previ, secante, irejcov)
          IN : in libici
          INCLUDE : ici_def.h
          INPUTS : datasat satellite observations according to the /ici_sat/ structure
          secante secant of the satellite zenithal angle
          previ forecast data according to the /ici_previ/ structure,
          /ici_env/ structure and /cond_cal/ common in ici_def.h
          profils_noaaxx.rad radiance file of the initial library
          profils_noaaxx.tau total transmittance file of the initial library
          OUTPUTS : irejcov : 0 ok ; 1 problems
          common /ici_tb/ tb chart of initial profiles base brightness températures (all profiles and channels)
          common /guess_covtb/ covtb_m1, bg_moy, bg_sig, poscanbg, ccovtotb
          OBJECT : to compute the brightness temperatures of the profile library, associated Tb covariance matrix and its inverse
          Describing the algorithm
           :
          Read of the up and down radiances and transmittances for all the profiles of the initial library for the secant and pressure values of the situation considered.
          Warning:
          be sure that the channels used when creating the guess library are the same that those we expect to read in that run (icangues).
          Computation, for each profile, of Tb brightness temperatures for the channels that are useful for selecting the guess profile (which depends on itypbg) on the basis of the up and down radiance, of the transmittances and of surface temperature and emissivity (ici_rtplnck, intplog, ici_rtbright).
          Addition of an artificial channel (channel 103) to the set of Tbs: temperature at 1000hpa of each profile.
          Computation of the covariance matrix of the Tbs for air mass profiles for the situation (matcov).
          Weighing of non-diagonal values of the matrix by a factor 0.8.
          Computation of matrix inverse (matinv).
          SUBROUTINES INVOKED : ici_rtplnck, intplog, ici_rtbright, matcov, matinv
           
        5. subroutine ici_nearest

        6. SYNTAX : ici_nearest( datasat, previ, guess_pp, guess_m, dataguess_m, irejguess)
          IN : in libici
          INCLUDE : ici_def.h
          INPUTS : datasat satellite observations according to /ici_sat/ structure
          previ forecast data according to /ici_previ/ structure
          common /ici_tb/ tb chart of the Tbs from profile library
          common /guess_covtb/ covtb_m1, bg_moy, bg_sig, poscanbg, ccovtotb
          common /delta/ delta_tb, sigdelta_tb
          OUTPUTS : guess_pp nearest profile in the initial library with /profil40/ structure
          guess_m initial profile with /profil40/ structure
          dataguess_m initial profile satellite data (synth. Tb) with /ici_sat/ structure
          irejguess rejection code - see definition in subroutine ici_guess
          OBJECT : to search for the guess profile in the profile library by reducing to a minimum the distance between the observation and the Tbs computed by the tb_guess routine. Between 4 and 10 have to be selected among the nearest profiles, then a mean is computed to obtain the guess profile.
          For further scientific details, see enclosed scientific document [4], chapter 6.4.8.
          Describing the algorithm
           :
          Computation of a reference distance dst by using the standard deviation bg_sig from the initial library.
          if dst is negative, exit 2
          loop on profiles p from the library
          if [Tb (p,ic)- Obs(ic)] < threshold ic depends on the satellite
          distance dist(p) is computed. If dist(p) is negative, exit 2.
          End of loop
          Selection of nearest profile guess_pp (minimum dist(p)= dmin(0))
          if dmin(0) > threshold or no profile -> irejguess= 2 or 3
          maximum of 3 it iterations
          selection of profiles such as dist(p) < dmin(it) = facdis*dimin(it-1)
          if selected number > 4 -> exit the iteration
          end of iteration
          if number of selected profiles > 10 the nearest 10 are kept
          quality test on nearest profile: if there are too many channels (Tb –measured Tb) > threshold(itypbg)
          irejguess= 4
          otherwise
          update of guess_pp profile (Psol,...). The identification part of the structure will be used at a later date
          computation of guess profile guess_m on the basis of the n nearest (with a maximum of 10). The identification part is determined by the satellite data (dating, position, type of surface), Psurf from forecast, interpolation of atmospheric values at Psurf (intplog).
          Computation of tbguessm satellite data for the guess profile = mean of the Tbs of the profiles selected in the guess profile.
          Quality test of initial profile: irejguess= 5, if there are too many channels with Tbguesm-datasat.data.tb > threshold(itypbg)
          SUBROUTINES INVOKED : intplog
           
        7. subroutine ici_clarif

        SYNTAX : ici_clarif ( datasat,dataguess, dataclear)
        IN : in libici
        INCLUDE : ici_def.h
        INPUTS : datasat satellite observations. /ici_sat/ structure
        dataguess satellite data for the guess. /ici_sat/ structure
        OUTPUTS : dataclear satellite observations /ici_sat/ structure
        OBJECT : this method comes from the Psi method of the LMD. Clearing of the mid-atmosphere IR channels by means of the difference between observed micro-wave values (in datasat) and the synthic values for a guess profile (in dataguess). The micro-wave channel number depends on the number of the channel to be cleared. To do so, a first search for the guess profile has to have been carried out. This is only used for Noaa14.
         
         

      7. ici_inv flowchart


      8. Diagram -1 : subroutine ici_inv flowchart

        Routines matinv, airmasrs, ici_calgeo, rec_tropo, totozone, toth2o, ici_prstn, calal are described in chapter 5.6. Routine rttovk is in the RTTOV library.

         

        1. subroutine ici_inv

        2. SYNTAX : ici_inv ( datasat,dataguess, previ, guess, inverse, irejinv)
          IN : in libici
          INCLUDE : ici_def.h
          INPUTS : datasat /ici_sat/ structure satellite data possibly cleared
          dataguess /ici_sat/ structure predicted satellite data associated with the guess
          previ /ici_previ/ structure data forecast for the HIRS fov
          guess /profil40/ structure initial profile
          OUTPUTS : inverse /profil40/ structure inverted profile
          irejinv error code 0 = ok
          OBJECT : to perform the inversion by reducing the cost function to a minimum from a guess profile, of the satellite data and of the background covariance matrixes.
          Description of the algorithm :

          To initialize the iteration profile titer with the guess profile. titer is a variable over 57 levels:
          1-40 : temperature on the levels 41-55 : moisture on the 15 lower levels
          56 : temperature at 2m 57 : moisture at 2m
          computation of the tbiter (Tb for the titer profile) and associated matrix Kn, adjoint to the RTTOV direct model (ici_rtknoaa)
          computation of matrix Wn= GKt [KGKt + (O+F)]-1 for further details, see [4], 6.4.10. To do so, the matrix is inverted (matinv)
          computation of new profile titer= guess + Wn (datasat- tbiter -Kn (tguess-titer))
          only one iteration is imposed (for the iteration to take place, the maxiter value just has to be changed).
          The inverse structure variable is filled in wih the titer profile.
          Quality of the inverted profile is tested by comparing the dist= S (datasat - Tbiter)2
          if dist > coef* (bg_sig)2 the profile is flagged as incorrect (irejinv=1)
          computation of air mass (airmasrs), geopotential (ici_calgeo), tropopause(rec_tropo), total water vapor (toth2o) and ozone contents (totozone), cloud top pressure if its temperature is known(ici_prstn).
          If noaa15 is being processed and if the situation is clear in terms of avhrr , surface emissivity values are computed for the micro-wave channels AMSU-A1 andt 2 (ici_cal_ems).
          SUBROUTINES INVOKED
           : ici_rtknoaa, matinv, airmasrs, ici_calgeo, rec_tropo, toth2o, totozone, ici_prstn, ici_cal_ems
           
        3. subroutine ici_rtknoaa

        4. SYNTAX : ici_rtknoaa (profil, secante, nbcan, lstcan, matktb, tb)
          IN : in libf77rttov6
          INCLUDE : ici_def.h
          INPUTS : profil /profil40/ structure
          secant for sighting angle
          nbcan number of channels to be processed
          lstcan list of channels to be processed (depends on satellite and clear/cloudy type)
          OUTPUTS : matktb : matrix K for lstcan channels real matktb(maxcantb, maxlevbg)
          tb : brightness temperatures computed for the profile for the channels lstcan
          OBJECT : computation of synthetic Tbs with RTTOV for an input profile and associated matrix K, adjoint to the direct model
          Description of the algorithm :

          RTTOV calling input variables (pav, pssv,pcv) are filled in with the profile characteristics
          Profile interpolation/extrapolation of the profile from 40 to the today 43 levels of RTTOV6 (con_40_43). Computes the humidity profile in specific humidity.
          A routine of the RTTOV library (rttovk) is called for direct computation of brightness temperatures and for the computation of K adjoint matrix.
          Usng the rttovk outputs, it fills in the tb variable, it interpolates the adjoint matrix to 40 levels (and relative to mixing ratio) as used by ici_inv and fills in the matktb variable.
          SUBROUTINES INVOKED : con_40_43, rttovk
          Remark : routines con_40_43, rttovk from the RTTOV library are not described.
           
        5. subroutine ici_cal_ems

        6. SYNTAX : ici_cal_ems (profil,datasat, secante, emis)
          IN : in libf77rttov6
          INCLUDE : ici_def.h
          INPUTS : profil /profil40/ structure
          datasat observed satellite data
          secant for sighting angle
          OUTPUTS : emis emissivity values computed for the AMSUA-1 and 2 surface channels
          OBJECT : to compute the micro-wave surface emissivity values when the profile is known
          Description of the algorithm :

          To document RTTOV invoking input variables (pav, pssv,pcv) with profile characteristics
          To invoke the RTTOV model (rttov_cms) in order to compute up and down radiances.
          To compute emissivity values provided that surface temperature and AMSUA-1 and 2 channel observations are known (ici_rtplank).
          SUBROUTINES INVOKED : rttov_cms, ici_rtplank
           
        7. subroutine rttov_cms

        8. SYNTAX : rttov_cms(knpf, klapf, knav, knsav, knssv, kncv, ppres, pangl, pangs, panga, kcld, ksurf, ksat, knchpf, kchan, kprof, pav,psav, pssv, pcv, prd, ptb, prdov, prdo, prdcl, ptbcl, zbdt, zbdtr, ptau, ptaus)
          IN : in libf77rttov6
          OUTPUTS : in particular :
          Zbdt, zbdtr up and down radiances
          OBJECT : routine extracted from the RTTOV library and modified in order to retrieve up and down radiances in addition to brightness temperatures .
          SUBROUTINES INVOKED: rtint_cms
           
        9. subroutine rtint_cms

      SYNTAX : rtint_cms ( klapf, kchan, kprof, ksat, knchpf, prd, ptb, prdov, prdo, prdcl, ptbcl, ptau, ptaus, pems, pb, pba, pbs, zbdt, zbdtr, pfcld)
      IN : in libf77rttov6
      OUTPUTS : zbdt, zbdtr up and down radiances
      OBJECT : subroutine rtint extracted from the RTTOV library and modified so as to send back up and down radiances instead of brightness temperatures.

    3. BASE_METEO CREATION SOURCES

    4. They are the main ici_rs.F (for ascii format), ici_rs_bufr.F (for BUFR format), ici_analyse.F programs (and their subroutines) invoked by means of the ici_rs and ici_analyse commands that are directly invoked by means of ici_basemeteo. See diagram 4.4 that shows the flow chart of the ici_finjour command (chapter 4.2.3) which call ici_basemeteo and description of the ici_rs and ici_analyse commands (chapter 4.4).
       

        1. main program ici_rs.F

        2. SYNTAX : ici_rs
          IN : in /bin
          INCLUDE : ici_def.h
          INPUTS : file temp_yyyymmdd_hh00.txt
          OUTPUTS : common /rs_ascii/ rsa_code, rsa_nua, rsa_type, rsa_lat, rsa_lon, rsa_alt, rsa_date, rsa_nbniv, rsa_idn, rsa_p, rsa_g, rsa_t, rsa_td, rsa_fv, rsa_dv
          File temp_yyymmdd_hh00.p40
          OBJECT : read, filtering, extrapolation, coupling with an ozone profile, coding of the retrieved radio soundings in p40
          Description of the algorithm :

          Read of launch options
          Opening of the rs ascii and p40 files (ici_fn)
          Read of the ascii file header
          Loop onto radio soundings
          Read of record
          Processing of radio sounding (subroutine f_ici_rs) by means of common /rs_ascii/
          if p40 OK, write to p40 file
          otherwise, information message
          next RS
          closure of both files
          SUBROUTINES INVOKED :ici_fn, ici_f_ici_rs, prn_p40
           
        3. subroutine f_ici_rs

        4. SYNTAX : f_ici_rs (rs,ierr)
          IN : in libici
          INCLUDE : ici_def.h
          INPUTS : common /rs_ascii/ rsa_code, rsa_nua, rsa_type, rsa_lat, rsa_lon, rsa_alt, rsa_date, rsa_nbniv, rsa_idn, rsa_p, rsa_g, rsa_t, rsa_td, rsa_fv, rsa_dv
          OUTPUTS : rs : extrapolated radio sounding /profil40/ structure
          ierr return code 0 : ok
          1 - 12 : different depending on reason for rs rejection (see [4])
          OBJECT : test of ascii rs quality, exit in return with an error code if the radio sounding is considered as incorrect and change to format :profile40 type if ok.
          Description of the algorithm :

          Search for the surface and tropopause levels
          High pressure test (< 50 hPa)
          Low pressure test (> 850 hPa)
          Test on number of water vapor levels (> 6)
          Test on pressure of the last water vapor level (< 400 hPa)
          Water vapor interpolation on ICI levels (intplog)
          Water vapor filtering h2omin=0.003g/kg
          Computation of total integrated contents in water vapor (toth2o)
          Test on number of temperature levels (> 10)
          Test on pressure of last temperature level (< 50 hPa)
          Test on deviation between 2 consecutive temperature levels (< 25K)
          Test on deviation betwen 2 consecutive pressure levels < 210 between surface and 500hPa
          < 140 between 500 and 200 hPa
          < 70 hPa above 200hPa
          Temperature interpolation on ICI levels (intplog)
          if PRFL extrapolation requested, profile extrapolation by means of the PRFL method(sp_creeb)
          If MSIS extrapolation, temperature extrapolation using the MSIS method (ici_msis)
          Test on number of levels with a geopotential (> 6)
          Comparison between measured geopotential with that computed with P,T,H2O (< 30mgp) (ici_calgeo)
          Creation of the ozone profile by copying the US Standard 76 (ref32po3)
          Computation of total integrated contents in ozone totozone
          Change of cloud code (code and cloud cover in octants)
          Update of surface emissivity and surface type codes
          Computation of air mass (airmasrs)
          12 return codes are possible, all fatal.
          SUBROUTINES INVOKED : xigj, intplog, toth2o, ici_msis, sp_creeb, ici_calgeo, ref32po3, totozone, airmasrs
           
        5. main program ici_rs_bufr.F

        6. SYNTAX : ici_rs_bufr
          IN : in /bin
          INCLUDE : ici_def.h
          INPUTS : rs file in bufr format from the meteorological server
          parameters ch, iechp,iechl,minlon,minlat,maxlon,maxlat as script inputs
          OUTPUTS : file in p40 format temp_yyyymmdd_hh00.p40
          OBJECT : reads BUFR radiosonde files and converts to p40 files. Only some descriptor are recognized. The RS is interpolated and extrapolated on the 40 levels. and p40 coding of analyses.
          The main program opens the file ici_open_bufr. It calls ici_bufrex to read a BUFR message. ici_decrsbufr decodes the descriptors and initializes a p40 profile. ici_rsbufrtop40 interpolates and extrapolates the rs onto 40 levels. Currently H2O is fixed to 0.03g/Kg above 200hPa. Extrapolation of T, H20, O3 is done by PRFL.
          SUBROUTINES INVOKED :ici_open_bufr,ici_bufrex, ici_decrsbufr, ici_rsbufrtop40, ici_close_bufr
           
        7. subroutine ici_open_bufr

        8. SYNTAX : ici_open_bufr (filename, lu, mode, kret)
          IN : libicigribbufr
          INCLUDE : ici_def.h
          OBJECT : opens a bufr file according to the ‘mode’ access. Beware of the maximum length for filename (256) and for mode (10).
          SUBROUTINES INVOKED :PBOPEN
           
        9. subroutine ici_close_bufr

        10. SYNTAX : ici_close_bufr ( lu, kret)
          IN : libicigribbufr
          INCLUDE : ici_def.h
          OBJECT : closes a bufr file .
          SUBROUTINES INVOKED :PBCLOSE
           
        11. subroutine ici_bufrex

        12. SYNTAX : ici_bufrex (lu, op_list, jbuflw, kelem, ksubsets, kvals, kbuff, ksec0, ksec1, ksec2, ksec3, ksec4, ktdlst, ktdexp, cnames, cunits, values, cvals, subsets, kret)
          IN : libicigribbufr
          INCLUDE : ici_def.h
          OBJECT : reads and decodes a bufr file .
          SUBROUTINES INVOKED :pbbufr, bufrex, busel, buprs0, buprs1,buprs3 (all these subroutines belong to the bufr library).
           
        13. subroutine ici_decrsbufr

        14. SYNTAX : ici_decrsbufr (kelem, ksubsets, sset, ktdexp, values, cvals, maxlevels, nblevels, p, vss, g, t, td, d, f, rs, kret)
          IN : in libici
          INCLUDE : ici_def.h
          INPUTS : common /rs_ascii/ rsa_code, rsa_nua, rsa_type, rsa_lat, rsa_lon, rsa_alt, rsa_date, rsa_nbniv, rsa_idn, rsa_p, rsa_g, rsa_t, rsa_td, rsa_fv, rsa_dv
          OUTPUTS : rs : extrapolated radio sounding /profil40/ structure
          OBJECT : reads BUFR radiosonde files.
          SUBROUTINES INVOKED : xigj

           
        15. subroutine ici_rsbufrtop40

        16. SYNTAX : ici_rsbufrtop40 (maxlevel, nblevels, p, vss, g, t, td, d, f, rs, extr_twv, extr_ozo, limit_wv, ierr)
          IN : in libici
          INCLUDE : ici_def.h
          INPUTS : maxlev, nblevels, p,vss, g, t, td, d, f, extr_twv,extr_ozo, limit_wv
          Respectivement : max number of levels, total number of levels,,pressure, vertical sounding difference, geopetential, temperature, dew-point temperature, wind direction, wind speed, extrapolation model, for T and WV, extrapolation model for O3, limitation of WV
          OUTPUTS : rs : extrapolated radio sounding /profil40/ structure
          ierr return: code
          OBJECT : transformation of radiosonde in p40 format. 2 extrapolation possibilities (msis or prfl) depending of extr_twv, extr_ozo parameters
          if PRFL extrapolation requested, profile extrapolation by means of the PRFL method(sp_creeb)
          if MSIS extrapolation requested, temperature extrapolation by means of the MSIS method (ici_msis)
          The steps of the subroutine are really similar to f_ici_rs or f_ici_ana.
          SUBROUTINES INVOKED : intplog, sp_creeb, ici_msis, totoh2o, ici_calgeo,ref32po3, totozone, airmasrs, rectropo

           
        17. main program ici_analyse.F

        18. SYNTAX : ici_analyse
          IN : in /bin
          INCLUDE : ici_def.h
          INPUTS : ascii or grib file from the meteorological server
          parameters ch, iechp,iechl,minlon,minlat,maxlon,maxlat as script inputs
          OUTPUTS : file in p40 format analyse_yyyymmdd_hh00.p40
          OBJECT : read, filtering, extrapolation, ozone and p40 coding of analyses
          Description of the algorithm :

          Opening of analysis (ascii or grib)
          Test of file types (ascii or grib) then closure of these files
          If grib file, opening with (ici_open_grib)
          If ascii file, opening by means of ici_fn + open
          Opening of output file in p40 format (ici_fn + open)
          loop on analysis fields according to requested sampling (ici_read_grib or lec_gmeteo + lec_cmeteo)
          test on consistency of surface and analysis grids
          end of loop on the fields
          filing of fields acoording to pressure levels
          loop on grid nodes
          computation of geographical position
          copy of values in one-dimension charts
          quality test and change to p40 type (f_ici_ana)
          if p40 OK: write to p40 file
          if p40 incorrect: information message
          next node
          closure of the 2 files
          final report
          SUBROUTINES INVOKED : ici_fn, ici_open_grib, ici_read_grib, lec_gmeteo, lec_cmeteo, f_ici_ana
           
        19. subroutine f_ici_ana

      SYNTAX : f_ici_ana (p_nbniv, p_ij, p_lat, p_lon, p_alt, p_ana_tm, p_pmer, p_z1000, p_vent, p_p, p_t, p_hu, extr_twv, extr_ozo, limit_wv ,p40, ierr)
      IN: in libici
      INCLUDE : ici_def.h
      INPUTS : p_nbniv,p_ij,p_lat,p_lon,p_alt,p_ana_tm,p_pmer,p_z1000,p_vent,p_p,p_t, p_hu
      Various profile variables originating from the ascii file
      OUTPUTS : p40 p40 format file with /profil40/ structure
      ierr return code 0 : ok
      1- 8 : depending on reason for profile rejection (see [4])
      OBJECT : quality test of analyzed profile and change into format p40 type if ok.
      2 extrapolation possibilities (msis or prfl) depending of extr_twv, extr_ozo parameters
      Description of the algorithm :

      High pressure test (< 50 hPa)
      Low pressure test (> 850 hPa)
      test on number of water vapor levels (> 6)
      test on pressure of the last water vapor level (< 400 hPa)
      water vapor filtering h2omin=0.003g/kg
      computation of total water vapor integrated contents (toth2o)
      water vapor interpolation on ICI levels (intplog)
      test on number of temperature levels (> 10)
      test on pressure of last temperature level (< 50 hPa)
      temperature interpolation on ICI levels (intplog)
      if PRFL extrapolation requested, profile extrapolation by means of the PRFL method(sp_creeb)
      if MSIS extrapolation requested, temperature extrapolation by means of the MSIS method (ici_msis)
      creation of ozone profile by copying US Standard 76 (ref32po3)
      computation of total ozone integrated contents (totozone)
      test on number of geopotential levels (> 6)
      computation of geopotential by using analyzed value of Z1000 (ici_calgeo)
      update of surface type and surface emissivity codes
      computation of air mass (airmasrs)
      estimate of the tropopause (rec_tropo)
      8 possible return codes, all fatal, that should normally never happen.
      SUBROUTINES INVOKED : intplog, toth2o, sp_creeb, ici_msis, ref32po3, totozone, ici_calgeo, airmasrs, rec_tropo
       

    5. INITIAL LIBRARY CREATION SOURCES

    6. They are the main programs (ici_selecp40.F, ici_mkguess.F, ici_catguess.F, ici_convtop40.F, ici_covair.F) and their subroutines, invoked by means of the ici_baseprof command or associated commands. See diagram 4.3 that shows the ici_finjour command flowchart (chapter 4.1.3) and the description of the ici_baseprof command (chapter 4.2.2).
       

        1. main program ici_selectp40.F

        2. SYNTAX : ici_selectp40
          IN : in /bin
          INVOKED BY : ici_baseprof
          INCLUDE : ici_def.h
          INPUTS : launch options for the command

          Profiles file (e.g.: analyses analyse_yyyymmdd_0000.p40 from meteorological base)
          OUTPUTS : profiles file in profile base profils_noaaxx_yyyymmdd.p40
          OBJECT : to select some profiles by means of various methods for initial profiles database creation
          Description of the algorithm :

          To retrieve the launch options: selection type, sampling type, sampling interval n
          If the sampling type is ‘echant’, a profile is selected on n
          If the sampling type is ‘grille_lat_lon’, the profiles are selected with a grid n * n pitch
          If the sampling type is ‘sampling_distance’, each selected profile has aa minimum distance (in km) with the others.
          If the sampling type is not one of the 3 preceding types, nothing is done but the user can add his/her code.
          For the first 3 types :
          Opening of profiles input file (e.g.: 00h analyses in p40 format)
          Opening of output file
          Loop on input file profiles and write into output file of the profiles selected according to sampling
          File closure
          SUBROUTINES INVOKED : ici_fn, ici_geocart
           

        3. main program ici_mkguess.F

        4. SYNTAX : ici_mkguess
          IN : in libici
          INVOKED BY : ici_baseprof
          INCLUDE : ici_def.h
          INPUTS : launch options: file type, (low, max), nomsat
          profils_noaaxx_yymmdd.p40 profiles file of profile base
          OUTPUTS : profils_noaaxx_yymmdd.rad radiance file of profile base
          profils_noaaxx_yymmdd.tau transmittance file of profile base
          OBJECT : creation of up and down radiance file and of transmittance file from the initial library for profiles from the initial library
          Description of the algorithm :

          Read of launch options: low/max. configuration, satellite name
          Channels setup (ici_setup)
          Fast model initialization (ici_rtinit)
          Opening of the 3 files: profiles, radiances and transmittances (ici_fn + open)
          Loop on secants
          Loop on profiles
          Read of profile
          Computation of up + down radiances and transmittances for 10 psol (ici_rtmkficbg)
          End of profiles loop
          End of secants loop
          Loop on the 10 psol and the 2 up and down isens
          Write of result file for the secant
          record rad = isens + (ipsol-1)*nsens + (isec-1)*npsol*nsens nsens=1 (upwards)
          record taus = ipsol- + (isec-1)*npsol
          warning: to save space, the size of the records is equal to 170*ncanguess, where 170 is the maximun number of profiles and ncanguess the number of channels.
          end of loops
          closure of the 3 files
          SUBROUTINES INVOKED : ici_setup, ici_rtinit, ici_fn, xijc, ici_rtmkficbg
           
        5. subroutine ici_rtmkficbg

        6. SYNTAX : ici_rtmkficbg (profil, isit, nbsit, secante,rad_up, rad_down, taus)
          IN : in libf77rttov6
          INCLUDE : ici_def.h
          INPUTS : profil /profil40/ structure for the atmospheric profile being processed
          isit number of situation being processed
          nbsit maximum number of situations
          OUTPUTS : rad_up, rad_down, taus: up and down radiances and transmittances for all channels defined for the creation of the library and the 10 surface pressure values
          OBJECT : computation of up and down radiances and of total transmittances for a given profile ‘profil’. Definition of RTTOV input charts (pav, pssv, pcv,..)
          Description of the algorithm :

          Profile interpolation/extrapolation of the profile from 40 to the today 43 levels of RTTOV6 (con_40_43). Computes the humidity profile in specific humidity.
          Loop on ipsols (10)
          Computation of surface parameters :psol, tsol, h2osol, o3sol (intplog)
          Computes up and downward radiances (rttov_cms)
          End of loop
          SUBROUTINES INVOKED : intplog, rttov_cms
          rttov_cms was described in Initial Library Creation section
           
        7. main program ici_catguess.F

        8. SYNTAX : ici_catguess
          IN: in /bin
          INVOKED BY : ici_baseprof
          INCLUDE : ici_def.h
          INPUTS : launch options: irad,iuw, iudeb,iufin
          files profils_noaaxx_yyyymmdd_p40,.rad and .tau
          OUTPUTS : files profils_noaaxx.p40, .rad and .tau
          OBJECT : concatenation of "low" type rad and tau daily files to create the same file types over a longer period of time (of the ``max'' type). This becomes the initial input rolling library of the inversion. This requires a source program because the size of each record corresponds to the number of situations multiplied by the number of channels and is then different between the two types. The effective number of situations of each file to be concatenated is determined by checking that radiance of the HIRS 1 channel is higher than 0 or that HIRS8 transmittance is higher than 0.01.
          Description of the algorithm :

          Opening of output file with the length of records given by nsit_max
          Opening of input files with the length of records given by nsit_low
          For radiance file :
          Loop on the secants, ground pressure values and both directions (up and down).
          Computation of record number to be read according to secant, pressure and direction
          Loop on input files
          Read : each record corresponds to the guessr data with the nsit_low size (number of profiles)
          A guessw chart of the nsit_max size is filled in with the same information
          Write of record for guessw
          End of loop on files
          Write of record for guessw
          warning: to save space, the size of the records is equal to 1700*ncanguess, where 1700 is the maximun number nsit_max of profiles and ncanguess the number of channels.
          End of loop on secant, ground pressure and both directions.
          The same work has to be carried out for the transmittance file.
          SUBROUTINES INVOKED : ici_fn
           
        9. main program ici_convtop40.F

        10. SYNTAX : ici_convtop40
          IN : in /bin
          INVOKED BY : ici_baseprof
          INCLUDE : ici_def.h
          INPUTS : original file. E.g.: satigr or nesdispr (supplied with the application)
          OUTPUTS : same file but in p40 format. E.g.: tigr.p40 or cimss.p40
          OBJECT : conversion of a TIGR or CIMSS profile file to format 40
          Description of the algorithm :

          Read of launch options: ‘tigr’ or ‘cimss’
          Opening of TIGR or CIMSS input file and of binary output file for p40 format files
          Loop on profiles
          Read of profiles (varies with the file)
          Interpolation of the T, hum, ozo profiles up to 0.1hpa (intplog)
          For CIMSS profiles, ozone profile US76 (ref32po3) is added on and an air mass is indicated (airmasrs)
          rsp40 variable with p40 structure is filled in
          Write of rsp40 profile
          End of loop
          File closure
          Note that you can develop a similar program if you wish to use another climatological library as initial library
          SUBROUTINES INVOKED : ici_fn, intplog, xigj, ref32po3, airmasrs
           
        11. main program ici_covair.F

      SYNTAX: ici_covair
      IN: in /bin
      INVOKED BY : ici_baseprof
      INCLUDE : ici_def.h
      INPUTS : files : profils_noaaxx.p40, .rad, .tau
      OUTPUTS : binary file covair_noaaxx.mat
      OBJECT : computation of air mass covariance matrixes
      Description of the algorithm :

      Read of launch options
      Initialization of satellite related channels (ici_setup) for the correspondance between RTTOV channels and storage into rad and tau files
      RTTOV initialization (ici_rtinit)
      Opening of input files: profile, rad, tau of initial library and of output of covariance matrixes: covAir
      Read of all file profiles
      Initialization of channels required for computing the air mass covariance
      Main loop on variables : 1) air mass type; 2) secants ; 3) ground pressure
      Read of up and down radiance and of the taus for the secant values, ground pressure
      Loop on the profiles of the air mass considered
      Computation of the Tbs on the basis of radiances and transmittances (ici_rtplank, ici_rtbright)
      Storage of the variables required (channels)
      End of loop on profiles
      Computation of covariance matrix (matcov)
      Weighting of non diagonal values by 0.80
      Computation of inverse matrix (matinv)
      Write of inverse matrix, mean values and standard deviations, computing conditions
      End of loop on variables
      File closure
      SUBROUTINES INVOKED : ici_fn, ici_setup, ici_rtinit, ici_rtplank, ici_rtbright, matcaov, matinv
       

    7. CO-LOCATIONS AND STATISTICS CREATION SOURCES

      1. Co-locations

      2. The co-locations module forms a very important node in the data flow; it will be used in particular as a basis for validation and for the tuning ``return loop''. The co-location is processed for each time network (00 06 12 18) outside the "real time" because it is necessary to wait for the analysis and radio sounding files; it is launched through crontab by means of the ici_finreseau command.
        There are 2 main programs : ici_coloc.F and ici_filcoloc.F
        Routines ici_upg_p40 and ici_upg_dat are described in chapter 5.6.
         

        1. main program ici_coloc.F

        2. SYNTAX : ici_coloc
          IN: in /bin
          LAUNCHED BY: ici_finreseau
          INCLUDE : ici_def.h
          INPUTS : ici_noaaxx_yyyymmdd_nnnnn.ici inversions file
          temp*.p40, analyse*.p40 radiosoundings, analyses ‘in-situ’ profiles file
          OUTPUTS : co-location file: coloc_noaaxx_yyyymmdd_hh00.ici
          OBJECT : co-location of measured guess and inverted satellite data, of environment data (e.g.: forecasts) and of observed data (radio soundings, analyses)
          For each record the generated file contains exactly the inversion file output data (satellite data, forecasts, guess, inversion) associated with the observed profile from the ‘in-situ’ profiles file.
          Data are co-located according to 3 hierarchical criteria: cloud cover, distance and time deviation. The cloud cover is used for searching for the clearest satellite data, which means that we have a better probability that a correct surface temperature value is available; it is filed in 10% ranges. Distance is limited to 100 kilometers. Duration (limited to +/- 3 hours by the time cycles) is filed in full hours.
          WARNING: profiles and inversions are all stored in the memory. The present limit is 14,000 profiles and 10,000 inversions, which makes programming easier but increases memory occupancy for the run. 14,000 profiles are necessary for processing an analysis file of the Atour10 grid without any sampling (>13000). 10,000 inversions correspond to 3 successive passes, every two pixels and for every line. If any problem arises, parameters can be changed to the ici_coloc.F code. When any of the limits is reached, a message is send to standard error and the command continues with the number already read.
          Describing the algorithm

          Retrieval of launch options.
          Profiles file: opening, full read, closure (ici_fn)
          Inversions file: opening, full read, closure (ici_fn, ici_upg_p40, ici_upg_sat)
          Opening of co-locations file
          Computation of cartesian coordinates XYZ for profiles and inversions (geogcat)
          Loop on profiles
          Computation of profile – inversions distances
          Selection of situations at less than dmin kilometers on sea (if the search on sea fails, the search is carried out on land)
          stock of distance values for clear type for each selected data item (time deviation rounded up to the hour and 10 clear types)
          filing of satellite data by time deviation order
          filing of satellite data by order of deviation in kilometers
          filing of satellite data by clear type order from the biggest to the smallest
          write of the result
          end of loop on profiles
          closure of co-locations file
          SUBROUTINES INVOKED : ici_fn, ici_upg_p40, ici_upg_sat, geogcart
           
        3. main program ici_colocl1d.F

        4. SYNTAX : ici_colocl1d
          IN: in /bin
          LAUNCHED BY: ici_finreseau
          INCLUDE : ici_def.h
          INPUTS : hrsl1d_noaaxx_yyyymmdd_nnnnn.l1d AAPP level1d file
          temp*.p40, analyse*.p40 radiosoundings, analyses ‘in-situ’ profiles file
          OUTPUTS : co-location file: colocl1d_noaaxx_yyyymmdd_hh00.ici
          OBJECT : co-location of level1d satellite data and of observed data (radio soundings, analyses). The algorithm is similar than ici_coloc.F for the situation selection.
          SUBROUTINES INVOKED : ici_fn, ici_upg_p40, ici_upg_sat, geogcart
           
        5. subroutine geogcart

        6. SYNTAX : geogcart (lat, lon, alt, pos)
          IN: in libici
          INPUTS : lat, lon, alt latitude (rad), longitude (rad) and altitude (km) for the situation
          OUT¨PUTS: pos(3) : cartesian position (km)
          OBJECT : to convert geographic data into cartesian coordinates, using the Greenwich meridian as a reference.
          This routine should eventually disappear as it is present in the navigation tools library navtool supplied with the AAPP software.


          Diagram -1 : ici_filcoloc flowchart

           
        7. main program ici_filcoloc.F

        8. SYNTAX: program ici_filcoloc
          IN: in /bin
          INVOKED BY: ici_finreseau
          INCLUDE : ici_def.h
          INPUTS: co-locations file coloc_noaaxx_yyyymmdd.ici (copied onto a temporary directory by means of the ici_finreseau command)
          OUTPUTS: co-locations file coloc_noaaxx_yyyymmdd.ici containing the same situations as the input file
          OBJECT : to filter co-locations in case of doubt on the quality of observed in-situ profiles (mainly rs) by computing differences in brightness temperature between satellite observations and brightness temperatures computed from the ‘in-situ’ profile and by rejecting the situations for which the difference is too important in relation to a reference distance.
          Describing the algorithm

          To open co-locations file in read mode and a co-location file in write mode.
          To retrieve direct model biases from the previous run (get_refdelta)
          To initialize RTTOV (ici_rtinit) as well as the charts for the list of channels that depend on the satellite (ici_setup).
          Loop on co-locations file situations
          To check the release number and upgrade the charts if necessary (ici_upg_p40, ici_upg_sat)
          If flag iflici=0 (correct inversions)
          To compute a cloud top pressure if necessary (ici_prstn)
          To compute the deviations between the observed Tb and those computed with RTTOV for the ‘in-situ’ profile (ici_ecarttb)
          To determine the situations for which deviations are too important (ici_elimdtb)
          To flag these situations with iflici=3 and icodrej=1
          To write all situations into the output file regardless of the flags
          End of loop
          File closure
          SUBROUTINES INVOKED : ici_fn, get_refdelta, ici_rtinit, ici_setup, ici_upg_p40, ici_upg_sat, ici_prstn, ici_écarttb, ici_elimdtb
           
        9. subroutine get_refdelta

        10. SYNTAX : get_refdelta
          IN: in libici
          INCLUDE : ici_def.h
          INPUTS : delta_noaaxx yyyymmdd_yyyymmdd.txt statistics file
          OUTPUTS : common /c_ref_dtb/ ref_dtb, ref_stb: RTTOV mean error bias and standard deviation
          OBJECT : read of the file containing the ‘reference’ deltas. They are the direct model biases used during the previous runs of the inversion :
          Description of the algorithm :

          Opening of statistics file delta*.txt
          Search for MDTB, SDTB patterns and data filing into the ref_dtb, ref_stb charts, from clear situations (iclear=1) if the AVHRR is used. Otherwise, it used the statistics of the cloud class iclear=2 to fill the charts.
          File closure
          SUBROUTINES INVOKED :ici_fn
           
        11. subroutine ici_elimdtb

        12. SYNTAX : ici_elimdtb(profil, dtb, elimine)
          IN: in libici
          INCLUDE : ici_def.h
          INPUTS : profil the ‘in-situ’ profile is useless at the moment
          dtb Tb deviations between observations and synthetic Tbs from a profile
          common /c_ref_dtb/ ref_dtb, ref_stb
          OUTPUTS : elimine logical = .true. if the situation is declared as incorrect
          OBJECT : to put the ‘elimine’ logical value at .true. for the situations that are outside 3 ref_stb standard deviations of the RTTOV for several channels. Only the channels used for the inversion are considered.
          For clear cases, only 3 channels are necessary for elimine=.true.
          In other cases, 2 channels are enough.
           
        13. subroutine ici_rtnoaa

        SYNTAX : ici_rtnoaa(profil, secante, nbcan, lstcan, tb, tbcl, taus)
        IN: in libf77rttov6
        INCLUDE : ici_def.h
        INPUTS : profil ‘in-situ’ profile with /profil40/ structure
        secante 1/cos(sighting angle) of the observation
        nbcan, lstcan number and list of the channels for which the computations have been performed
        OUTPUTS: tb synthetic Tbs for the situation
        tbcl clear part of the synthetic Tbs
        taus total transmittances
        OBJECT : to compute brightness temperatures with RTTOV for ‘profil’ variable and for the lstcan list of channels :
        Description of the algorithm :

        to extrapolate the profile on the rttov6 pressure levels (today 43 levels) (con_40_43)
        to fill in the RTTOV call input variables (pav, pssv,pcv,psav) with the profile’s characteristics and the viewing or surface emissivity conditions
        to invoke the RTTOV model (rttov) in order to perform the direct computation and to fill in tb, tbcl and taus variables with RTTOV outputs and go back to ICI channel numbering
        Note that channels numbering is as follows:
        RTTOV6 hirs : 1-20 msu : 21-24 ssu : 25-27 amsu : 28 – 47
        ICI: hirs : 1-20 amsu : 21-40 msu : 21-24 avhrr : 41- 46
        SUBROUTINES INVOKED :con_40_43, rttov (routines from the RTTOV library)
         
      3. Statistics

      4. Statistics are used for software validation on the one hand, tuning on the other hand. Three main programs are involved:
        ici_monitor.F for computing all usual statistics (e.g.: brightness temperature deviations between profiles...). Results are written into a text file with identifiers.
        ici_delta.F for computing forward biases for the ICI tuning from level1d files. Results are written into a text file with identifiers.
        ici_covbg.F for computing the error covariance matrix for the initial profile. The result is located in a binary file.
         

        1. main program ici_monitor.F

        2. SYNTAX: ici_monitor
          IN: in /bin
          INVOKED BY: ici_monitor command
          INCLUDE: ici_def.h
          INPUTS: coloc_noaaxx.ici co-location type temporary files, concatenation of several co-location files according to the launch options in the ici_delta command
          OUTPUTS: statistics text file. Depending on launch options :
          statici_noaaxx_type_yyyymmdd_yyyymmdd_hhmm.txt
          statici_noaaxx_type_yyyymmdd_yyyymmdd.txt
          OBJECT : computation of statistics from the co-location files
          Description of the algorithm

          Retrieval of launch options just for writing into the result file
          Opening of co-locations file (ici_fn)
          Read of 1st situation and satellite name recovery
          Initialization of the fast radiative transfer model (ici_rtinit), of the list of channels (ici_setup).
          Loop onto co-locations
          Check of co-location file creation release number and charts upgrade if required (ici_upg_p40, ici_upg_sat)
          psurf, airsurf, cloudy parameters of observed profile = that of the inverted profile (ici_prstn)
          Computation of the means and of the standard deviations of the measured satellite temperatures as a function of channel, land/sea, clear index
          Computation of the direct model mean deviations if iclear=1 or if Tn is known (ici_ecarttb)
          as a function of the channel, land/sea, clear index
          as a function of the secant and clear index
          Computation of regression coefficients for the mean deviations of the direct model if iclear=1 (ici_reglmul)
          Computation of guess–observed profile deviations (ici_ecartprofil) for T, HU, virtual T :
          On the levels, as a function of the land/sea, clear index
          On the layers, as a function of the land/sea, clear index
          Computation of inversion - observed profile deviations (ici_ecartprofil) :
          On the levels in temperature and mixing ratio (converted in relative humidity), as a function of land/sea, clear index
          On the layers in virtual temperature, as a function of land/sea, clear index
          Computation of geopotential deviations: guess or inversion - observed (ici_ecartprofil)
          On the levels, as a function of land/sea, clear index
          On the layers, as a function of land/sea, clear index
          End of loop on co-locations
          Computation of statistics (ici_stat) and write of results for each data type :
          Identifiers in the result file are:
          Mean observed brightness temperatures TB OBS
          Brightness temperature deviations (delta) DTB, DCS
          Temperature on levels and temperature at 2m DT GUES or DT INV
          Moisture ( relative humidity) on levels and at 2m DH GUES or DH INV
          Virtual temperature on the layer DTV GUES or DTV INV
          Geopotentials on the layers G GUES or G INV
          Co-location file closure
          SUBROUTINES INVOKED : ici_fn, ici_setup, ici_upg_p40, ici_upg_sat, ici_prstn, ici_ecarttb, ici_ecartprofil, prn_icisat, prn_p40, ici_stat, ici_reglmul
           
        3. main program ici_delta.F

        4. SYNTAX: ici_delta
          IN: in /bin
          INVOKED BY: ici_delta command
          INCLUDE: ici_def.h
          INPUTS: coloc_noaaxx.ici colocl1d type temporary file, concatenation of several co-locl1d files according to the launch options in the ici_delta command
          OUTPUTS: statistics text file. Depending on launch options :
          delta_noaaxx_type_yyyymmdd_yyyymmdd_hhmm.txt
          delta_noaaxx_type_yyyymmdd_yyyymmdd.txt
          OBJECT : computation of statistics from the colocl1d files, for departures between level1d observations and RTTOV synthetic Tbs. The output files are used for the tuning.
          Identifiers in the result file are:
          Mean observed brightness temperatures TB OBS
          Brightness temperature deviations (delta) DTB, DCS
          Brightness temperature deviations after dynamic correction (deltcor) DTBC
          Statistics coefficients for computing the dynamic deltas DTBA0, DTBCOEFF and DTC
          SUBROUTINES INVOKED : ici_fn, ici_setup ici_rtinit, sec_numb, ici_upg_p40, ici_upg_sat, ici_prstn,ici_ecarttb, ici_stat, ici_reglmul
           
        5. subroutine ici_ecarttb

        6. SYNTAX : ici_ecartb(datasat, profil, dtb)
          IN: in libici
          INCLUDE : ici_def.h
          INPUTS : datasat satellite data with /ici_sat/ structure
          profil observed atmospheric profile with /profil40/ structure
          OUTPUTS : dtb differences in Tb on all channels
          OBJECT : To compute the differences between synthetic brightness temperatures of the observed profile (by analysis or radio sounding) and satellite data :
          Description of the algorithm :

          To determine IR and mw surface emissivities according to sighting angle (ici_emis)
          To determine the list of channels to be entered into RTTOV, which depends on the satellite.
          To compute the brightness temperatures with RTTOV (ici_rtnoaa)
          To compute the differences with the observations
          SUBROUTINES INVOKED :ici_emis, ici_rtnoaa
           
        7. subroutine ici_ecartprofil

        8. SYNTAX : ici_ecartprofil(pcal, pobs, dg, dgt, dt, dh, dtv, ierr)
          IN: in libici
          INCLUDE : ici_def.h
          INPUTS : pcal computed atmospheric profile /profil40/ structure
          pobs observed atmospheric profile /profil40/ structure
          OUTPUTS : dg geopotential differences on the layers
          dgt temperature differences on the layers computed from geopotentials
          dt temperature differences on the levels
          dh moisture differences on the levels in mixing ratio
          dtv virtual temperature differences on the layers
          ierr error flag 0=ok
          OBJECT : for both profiles, computation of virtual temperatures on the layers and geopotential thicknesses then of the temperatures deduced from the latter. Then differences between the profiles for each one of the output variables are computed.
           
        9. subroutine ici_regmul

        10. SYNTAX : ici_regmul(nbpt, nterm, x, y, wt, coeff, a0, cal, sig, corr, rm)
          IN: in libici
          INCLUDE : ici_def.h
          INPUTS : nbpt number of situations
          nterm number of coefficients for regression
          x here: chart of channel satellite data for regression
          y here: channels RTTOV bias for regression
          wt weights applied to each situation
          OUTPUTS : coeff multi-linear regression coefficients
          a0 constant term of the regression
          cal y values computed again
          sig standard deviations on coefficients
          corr correlation coefficient on coefficients
          rm mean correlation coefficient
          OBJECT : to compute the regression coefficients of a multivariable linear regression
          SUBROUTINES INVOKED : matinv (described in 5.6)
           
        11. subroutine ici_stat

        12. SYNTAX : ici_stat(x, moy, sig, n)
          IN: in libici
          INCLUDE : ici_def.h
          INPUTS : x values on which statistics are supposed to be computed
          n number of values
          OUTPUTS : moy mean of the x’s
          sig standard deviation on the x’s
          OBJECT : computation of mean and standard deviations on the x’s. Beforehand a test is carried out; if the x’s are equal to a missing value, they are not used in statistics.
           
        13. main program ici_covbg.F

      SYNTAX: ici_covbg
      IN: in /bin
      INVOKED BY: ici_covbg command
      INCLUDE : ici_def.h
      INPUTS: iucoloc logical unit for coloc_noaaxx.ici, co-location type file concatenation of several files according to the launch options by means of the ici_covbg command.
      OUTPUTS: iucovbg logical unit for covariance matrix according to the launch options:
      covbg_noaaxx_yyyymmdd _yyyymmdd_hhmm.mat

      covbg_noaaxx_yyyymmdd_yyyymmdd.mat
      OBJECT : to compute the error covariance matrixes of the guess profile (comparing it with the observed profile) for each type of cloud cover (clear, semi-cloudy, cloudy) and land/sea.
      Description of the algorithm

      Read of launch options (starting day, ending day, time network, type)
      Opening of co-location and covbg files
      Loop on co-locations
      Check of co-location files release number and chart upgrade if necessary (ici_upg_p40, ici_upg_sat)
      Test on type (analyse, rs, all)
      Computation of guess – observed profiles deviations in temperature and mixing ratio (ici_ecartprofil)
      Print-out of satellite data upon request (prn_icisat), as well as of the guess and observed profiles (prn_p40)
      Filing of deviations into a chart depending on land/sea and cloud cover type
      1-40 temperature deviations on all levels
      41-55 moisture deviations on the 15 lower levels
      56 temperature deviation at 2m
      57 moisture deviation at 2m
      next co-location
      co-location file closure
      computation of covariance matrix for each cloud cover and temperature type (matcov)
      write of matrix and of matrix computing conditions (land/sea and cloud cover type)
      covariance file closure
      SUBROUTINES INVOKED : ici_fn, ici_upg_p40, ici_upg_sat, ici_ecartprofil, prn_icisat, prn_p40,matcov
       


    8. INVERSION CODING SOURCES

        1. main program ici_toascii.F

        2. SYNTAX : ici_toascii
          IN: in /bin
          INVOKED BY: ici command
          INCLUDE : ici_def.h
          INPUTS: fort.62 corresponding to
          inversion type file : ici_noaaxx_yyyymmdd_hhmm_nnnnn.ici
          or co-location file: coloc_noaaxx_yyyymmdd_hhmm.ici
          OUTPUTS: fort.10 corresponding to ici_noaaxx_yyyymmdd_hhmm_nnnnn.txt in script
          OBJECT: to encode inversions or co-locations in the ascii format :
          Description of the algorithm :

          opening of input file
          read of 1st word of 1st situation: check of file type by means of the read word icimgn (=’ICO’ for co-location file)
          Loop on situations
          the reading of records depends on the file type ( inversions or co-locations)
          check of file creation release number and chart upgrade if necessary (ici_upg_p40, ici_upg_sat)
          filling in of ascii file variables
          write of formatted record
          End of loop
          SUBROUTINES INVOKED : ici_fn, ici_upg_p40, ici_upg_sat, xijg
           
        3. main program ici_tobufr.F

        4. SYNTAX : ici_tobufr
          IN: in /bin
          INVOKED BY: ici
          INCLUDE : ici_def.h
          INPUTS : binary format inversions file ici_noaaxx_yyyymmdd_hhmn_nnnnn.ici
          OUTPUTS : bufr format inversions file: ici_noaaxx_yyyymmdd_hhmn_nnnnn.bfs
          OBJECT : creates a BUFR file with an ICI binary file in input. The BUFR descriptors for ATOVS are same as ATOVS120 NESDIS.
          SUBROUTINES INVOKED : ici_fn, ici_open_bufr, ici_upg_p40, ici_upg_sat, prn_p40, codebufr_atovs, codebufr_tovs, ici_bufren
           
        5. subroutine codebufr_atovs.F

        6. SYNTAX : codebufr_atovs(isat, datasat,inversion, ktdlen, kelem, ksubsets, kvals, ksec1, ktdlst, values, cvals, kret)
          IN: in libici
          INVOKED BY: ici_tobufr.F
          INCLUDE : ici_def.h
          INPUTS : binary format inversions file ici_noaaxx_yyyymmdd_hhmn_nnnnn.ici
          OUTPUTS : bufr format inversions file: ici_noaaxx_yyyymmdd_hhmn_nnnnn.bfs
          OBJECT : encodes and writes a BUFR message for ATOVS satellite
          SUBROUTINES INVOKED : xijg
           
        7. subroutine codebufr_tovs

        8. SYNTAX : codebufr_tovs(isat, datasat, inversion, ktdlen, kelem, ksubsets, kvals, ksec1, ktdlst, values, cvals, kret)
          IN: in libici
          INVOKED BY: ici_tobufr.F
          INCLUDE : ici_def.h
          INPUTS : binary format inversions file ici_noaa14_yyyymmdd_hhmn_nnnnn.ici
          OUTPUTS : bufr format inversions file: ici_noaa14_yyyymmdd_hhmn_nnnnn.bfs
          OBJECT : encodes and writes a BUFR message for TOVS satellite.
          SUBROUTINES INVOKED : xijg, ici_tvlayers, coucheh2o
           
        9. subroutine ici_bufren

        10. SYNTAX : ici_bufrex (lu,, kelem, ksubsets, kvals, ksec1, values, cvals, itransmet, lat,lon, kret)
          IN : in libicigribbufr
          INCLUDE : ici_def.h
          OBJECT : encodes and writes a bufr file .
          SUBROUTINES INVOKED :bbuprs1, bufren, pbwrite (all these subroutines belong to the bufr library)

        11. subroutine ici_tvlayers

        12. SYNTAX : ici_tvlayers(nlayers, ptoplayert, pbotlayers, profile, tvlayers)
          IN: in libici
          INCLUDE : ici_def.h
          INPUTS : nlayers number of layers
          Pbop bottom boundary layers
          Ptop top boundary layers
          profile p40 profile
          OUTPUTS : tvlayers virtual temperatures on layers
          OBJECT : computation of virtual temperatures on layers defined by ptop and pbot. Beware, this is not working if layer boundaries are not on ICI levels.
           
        13. main program ici_togrib.F

        14. SYNTAX : ici_togrib
          IN: in /bin
          INVOKED BY: ici or crontab
          INCLUDE : ici_def.h
          INPUTS : fort.60  binary format inversions file ici_noaaxx_yyyymmdd_hhmn_nnnnn.ici
          OUTPUTS : ici.grib grib format inversions file:
          ici_noaaxx_yyyymmdd_hhmn_nnnnn.grib
          OBJECT : to encode the inversions in the grib format on the model’s levels (e.g.: for a display on Synergie). We have chosen to encode them on the ATOUR10 grid.
          Description of the algorithm :

          Opening of grib file (ici_open_grib)
          Opening of inversions file
          Loop on inversions
          Read of inversion files creation release number and charts upgrade if necessary (ici_upg_p40, ici_upg_sat)
          Storage of inverted profile data (temperature, moisture, pressure)
          Computation of relative moisture (rmtohu)
          End of loop and inversions file closure
          Creation of the grid description (date, first latitude, first longitude, grid resolution…) from parametrization
          interpolation of information at the model’s grid points for the temperature vector (ici_levels_to_fields) and creation of the grib in terms of temperature (ici_write_grib)
          interpolation of information at the model’s grid points for the moisture vector (ici_levels_to_fields) and creation of the grib in terms of moisture (ici_write_grib)
          grib closure (ici_close_grib)
          SUBROUTINES INVOKED : ici_open_grib, ici_upg_p40, ici_upg_sat, rmtohu, ici_levels_to_fields, ici_write_grib, ici_write_grib
          Routines pbopen, pbclose come from the grib library (not described)
           
        15. subroutine ici_levels_to_fields

        16. SYNTAX : ici_levels_to_fields (ninv, lat, lon, tab, type_param, type_niv, grid_lev, grid_pres, modtab)
          IN: in libici
          INCLUDE : ici_def.h
          INPUTS : tab ,ninv, lat, lon : chart to be interpolated, number of values, latitudes and longitudes of each value
          type_param, type_niv, grid_lev, grid_pres: grid definition
          OUTPUTS : modtab : chart interpolated at the grid node structure champ_meteo
          OBJECT : Interpolation of tab chart values at the model’s grid points and on the model’s levels. Done by the computation of a mean of values in a box of grid resolution, centered on grid nodes.
          SUBROUTINES INVOKED : intplog, prn_cmeteo
           
        17. subroutine ici_write_grib

        18. SYNTAX : ici_write_grib (kunit, iechp. iechl, modtab)
          IN: libicibrigbufr
          INCLUDE : ici_def.h
          INPUTS : kunit : grib’s logical number
          iechp, iechl: possible grid longitude, latitude sampling from modtab
          modtab : field interpolated at the grid node and at the model’s levels (structure /champ_meteo/)
          OUTPUTS : inversion file in grib format
          OBJECT : creation of the grib file for the input modtab sructure .
          Description of the algorithm :

          Documenting of input variables ksec1, ksec2, ksec3, ksec4 of the coding routine of the grib library (xijg)
          Loop on the levels
          Documenting of the grib’s input variables for levels with modtab input data
          Grib coding of information (gribex)
          Write of results chart in the output file (pbwrite)
          End of loop
          SUBROUTINES INVOKED : xijg, gribex, pbwrite (gribex, pbwrite sre grib routines from the grib library and are not described)
           
        19. subroutine ici_close_grib

        20. SYNTAX : ici_close_grib( lu, kret)
          IN : in libici gribbufr
          INPUTS : lu logical number
          OUTPUTS : kret =0 OK
          OBJECT : interface with the pbclose subprogram of the grib library
          SUBROUTINES INVOKED : pbclose
           
        21. main program ici_tol2.F

        22. SYNTAX : ici_tol2 program
          IN: in /bin
          INVOKED BY: no interface at present (use ici command)
          INCLUDE : ici_def.h
          INPUTS : binary format inversions file: ici_noaaxx_yyyymmdd_hhmn_nnnnn.ici
          OUTPUTS : level2 format inversions file: fort.20
          OBJECT : inversion coding in AAPP level2 output format for inversions :
          Description of the algorithm :

          Opening of level2 file in write mode and of inversions file in read mode
          1st read of the file for computing the number of records and write of the file header (wr_h_l2)
          file rewind
          loop on the records
          check of release number and charts update if necessary (ici_upg_p40, ici_upg_sat)
          call of a routine for encoding and writing each situation in level2 format (wr_rec_l2)
          end of loop
          file closure
          SUBROUTINES INVOKED :ici_fn, xijq,ici_upg_p40, ici_upg_sat, wr_h_l2, wr_rec_l2
           
        23. subroutine wr_h_l2

        24. SYNTAX : wr_h_l2 (l1ddata,ninv, annee_start, nbjour_start, mmdd_start, hhmn_start, annee_end, nbjour_end, mmdd_end, hhmn_end)
          IN: in libici
          INCLUDE : ici_def.h
          INPUTS : from the binary inversion file :
          l1ddata,ninv, annee_start, nbjour_start, mmdd_start, hhmn_start, annee_end, nbjour_end, mmdd_end, hhmn_end
          OUTPUTS : inversions file in level2 format : fort.20
          OBJECT : definition and write of header in level2 format
          SUBROUTINES INVOKED : xijq
           
        25. subroutine wr_rec_l2

        26. SYNTAX : wr_rec_l2 (l1ddata, environ, previ, guess_pp, dataguess, guess, inversion)
          IN: in libici
          INCLUDE : ici_def.h
          INPUTS : l1ddata, environ, previ, guess_pp, dataguess, guess, inversion : read data (from the binary inversion file)
          OUTPUTS : inversions file in the level2 format : fort.20
          OBJECT : definition and write of a record in the level2 format
          SUBROUTINES INVOKED : xijq
           
        27. main program ici_satem.F

        28. SYNTAX : ici_satem program
          IN: in /bin
          INVOKED BY: ici_satem command
          INCLUDE : ici_def.h
          INPUTS : binary format inversions file: ici_noaaxx_yyyymmdd_hhmn_nnnnn.ici
          OUTPUTS : inversions file in satem format:
          stm_noaaxx_yyyymmdd_hhmn_nnnnn.ii.ici, ii being worth 01 to about 10 depending on the size of the orbit and on the resolution of the inversion (each satem file only accepts 99 situations)
          OBJECT : satem coding of inversions (thicknesses over 10 layers) :
          Description of the algorithm :

          Opening of inversions file
          Read of 1st situation and opening of 1st satem file
          Loop on the read of inversions
          Check of release number and charts update if necessary (ici_upg_p40, ici_upg_sat)
          Test to see if the satem file does not contain more than 99 situations.
          If it does, the whole file is closed and a new one is opened with ii=ii+1
          Satem coding of the situation (codesatem)
          Write of the record
          End of loop
          File closure
          SUBROUTINES INVOKED : ici_upg_p40, ici_upg_sat ,codesatem
           
        29. subroutine codesatem

        30. SYNTAX : codesatem (isat, p40, nummess, chsatem, lgchsatem)
          IN: in libici
          INCLUDE : ici_def.h
          INPUTS : isat, p40 satellite number and inverted profile
          nummess : satem message number
          OUTPUTS : chsatem record in satem format
          lgchsatem record length
          OBJECT : definition and write of a record in the satem format (ascii format, thicknesses on some layers)
          SUBROUTINES INVOKED : xijc, xdjq, coucheh2o
           
        31. main program ici_p40.F

      SYNTAX : ici_p40 program
      IN: in /bin
      INVOKED BY: ici_p40 command
      INCLUDE : ici_def.h
      INPUTS : p40 format file
      OUTPUTS : standard output
      OBJECT : interactive display of a p40 format file
      SUBROUTINES INVOKED : ici_fn, prn_p40
       
       
       

    9. GRAPHIC DISPLAY SOURCES

        1. main program ici_gmtfield.F

        2. SYNTAX : ici_gmtfield
          IN: in /bin
          INVOKED BY: ici_gmt_dfield, ici_gmtret
          INCLUDE : ici_def.h
          INPUTS : fort.60  binary file of concatenated binary inversions files of successive
          passes
          fort. and fort.22: analysis p40 binary files of the 2 nearest cycles
          OUTPUTS : 3 corresponding ascii files of lat, lon, values
          OBJECT : to read the binary ICI files and time nearest analyses files and to convert in ascci format for their display with GMT.
          The value depends on the input parametes: variable type number (for temperature, humidity, thickness) , pressure level, number of analysis files.
          SUBROUTINES INVOKED: ici_fn, profile_lay
           
        3. subroutine profile_lay

        4. SYNTAX : profile_lay (prof,xlat,altitude,vap,tvcal,epais,t_epais,ierr)
          IN: in libici
          INVOKED BY: ici_gmtdfield.F
          INCLUDE : ici_def.h
          INPUTS : prof, xlat, altitude
          OUTPUTS : vap,tvcal,epais,t_epais,ierr
          OBJECT : computation of virtual temperatures on layers and geopotential thicknesses
           
        5. main program ici_gmtfield_intp.F

    SYNTAX : ici_gmtfield_intp
    IN: in /bin
    INVOKED BY: ici_gmtfield_intp
    INCLUDE : ici_def.h
    INPUTS : fort.60  ascii file of concatenated inversions files (output of ici_gmtfield.F)
    Ascii analysis files of the 2 nearest cycles (outpust of ici_gmtfield.F)
    OUTPUTS : 3 correponding ascii files on regular grid after interpolation and smoothing

    OBJECT : It reads the 3 ascii files (concatenated ascii file and time nearest analyses files), interpolates them on a regular grid of resolution res*res, makes the smoothing on the grid of res/2.* res/2. resolution, choice the time nearest field for each grid node depending of the time of the satellite observation, creates a new grided field with the differences between ICI and the nearest NWP and writes 3 ascii files for their display with GMT:

    1. ICI field on satellite lat/lon position

    2. ICI field on grid nodes

    3. ICI-NWP on grid nodes

    SUBROUTINES INVOKED: ici_fn, ici_gmt_interpol
     

          1. subroutine ici_gmt_interpol

          2. SYNTAX : ici_gmt_interpol(nrec,data,latitude,longitude,data_grid2,latgrid2,lon_grid2)
            IN: in libici
            INPUTS : common /grid/lonmin,lonmax,latmin,latmax,maxx,maxy,res
            nrec,data,latitude,longitude
            OUTPUTS : data_grid2,latgrid2,lon_grid2
            OBJECT : creation a field
            on a regular grid of resolution res* from the data table (with lat,lon from observations) then smoothing on a grid ‘data_grid2’ of resolution res/2.*res/2.
            SUBROUTINES INVOKED: ici_gmt_smoothing
             
          3. subroutine ici_gmt_smoothing

          4. SYNTAX : ici_gmt_smoothing(data_grid,data_grid2)
            IN: in libici
            INPUTS : common /grid/lonmin,lonmax,latmin,latmax,maxx,maxy,res
            data_grid at a res*res resolution
            OUTPUTS : data_grid2 at a res/2.*res/2. resolution
            OBJECT : smoothing on a grid ‘data_grid2’ of resolution res/2.*res/2by interpolation
             
          5. main program ici_gmtstatdtb.F

          6. SYNTAX : ici_gmtstatdtb
            IN: in /bin
            INVOKED BY: ici_gmtdtb
            INPUTS : fort.10  statistic file for a specific date
            OUTPUTS : fort.11: ascii files of julian instant, value for each record
            OBJECT : reads the statistical ICI file and writes in an ascci format file for its display with GMT.
            SUBROUTINES INVOKED: ici_fn, xigj
             
          7. main program ici_gmtstatrms.F

          8. SYNTAX : ici_gmtstatrms
            IN: in /bin
            INVOKED BY: ici_gmtrms
            INPUTS : fort.10  statistic file for a specific date
            OUTPUTS : fort.11: ascii files of julian instant, value for each record
            OBJECT : It reads the ICI retriaval statistical from the ICI validation file, computes the rms values from biases and standard deviations and writes them in an ascci format file for its display with GMT.
            SUBROUTINES INVOKED: ici_fn, xigj, xijg
             
          9. main program ici_gmtdate.F

          10. SYNTAX : ici_gmtdate
            IN: in /binINVOKED BY: ici_gmtdtb, ici_gmtrms
            INPUTS : datedeb, datefin: gregorian dates on the standard input
            OUTPUTS : intermediate dates on the standard output
            OBJECT : it computes intermediate dates (format dd/mm/yy) between 2 dates for their display with GMT.
            SUBROUTINES INVOKED: xdgj,xdjg,xdjc
             
          11. validation.html

    html page to display all the different graphics created with ici_web.
    IN: ${DIR_DATA}/graphique
     
     
     
     

     


      1. GENERAL PURPOSE SUBROUTINES FOR THE APPLICATION

          1. subroutine airmasrs

          2. SYNTAX : airmasrs(temp,airmas)
            IN : in libici
            INPUTS : real (40) temp profile to be filed
            common /c_airmasrs/ tmtig, tvtig,tt,ttv tmtig and tvtig : mean and standard deviation on the 40 levels for the 5 representative profiles
            OUTPUTS : airmas air mass class (between 1 and 5)
            OBJECT : definition of the air mass of an atmospheric profile (e.g.: radio sounding) between 5 possible classes by reducing to a minimum the distance between the profile and the representative profiles of the 5 classes.
            The common is initialized in a data block.
             
          3. subroutine calal

          4. SYNTAX : calal (pp,tt,rmhh,niv, alt0, xlat, iord, hh, phiphi)
            IN: in libici
            INPUTS : pp, tt, rmhh pressure, temperature and moisture (in terms of volume) for niv levels.
            iord  =0 decreasing pressure ; =1 increasing pressure
            xlat profile’s measurement latitude (deg)
            alt profile’s position altitude (m)
            OUTPUTS : hh geometric altitudes for niv levels (in m)
            phi geopotential altitudes for niv levels (in J/Kg)
            OBJECT : computation of geopotential and geometric altitudes for a given profile pp, tt, rmhh
             
          5. subroutine coucheh2o

          6. SYNTAX : coucheh2o(p40, nc, nh, ch2o)
            IN : in libici
            INCLUDE : ici_def.h
            INPUTS : p40 atmospheric profile with /profil40/ structure
            nc, nh number of layers and pressure level at the top of layers
            OUTPUTS : ch2o profile’s water vapor integrated contents (kg/m2)
            OBJECT : computation of the water vapor integrated contents for a profile p40 on nc layers, the lowest level of which is 1000hpa and the highest is nh
             
          7. subroutine ici_calgeo

          8. SYNTAX : ici_calgeo(p40, falt, geo)
            IN : in libici
            INCLUDE : ici_def.h
            INPUTS : p40 /profil40/ structure profile
            falt =1 geometric altitudes (m) ; =0 geopotential altitudes (mgp)
            OUTPUTS : geo altitudes on the 40 levels
            OBJECT : computation of geopotential altitudes (in mgp) or of geometric altitudes (in m) for each pressure level of the profile p40 from the surface pressure (surface latitude and altitude are taken into account)
            SUBROUTINES INVOKED  calal
             
          9. subroutine ici_fn

          10. SYNTAX : ici_fn (unit, filename)
            IN : in libici
            INPUTS : unit file logical number
            OUTPUTS : filename fort.unit file name
            OBJECT : useful interface for exporting the ICI package.
            Definition of : filename = ‘fort.unit’ with unit on 2 digits
             
          11. subroutine ici_msis

          12. SYNTAX : ici_msis(ij,lat,lon,press,temp)
            IN: in libici
            INCLUDE : ici_def.h
            INPUTS : ij julian instant of the profile to be extrapolated
            lat, lon latitude, longitude of the profile to be extrapolated
            press pressure level
            OUTPUTS : temp temperature for the pressure press
            OBJECT : evaluation of a temperature in a climatological way for a ‘press’ pressure level of the stratosphere, a position and an instant of the year in the statosphere. To do so, invoke routine ghp6 of the MSIS model (supplied in the ici_msis.F file but not described, see Ref 16).
            SUBROUTINES INVOKED : xijq

             
          13. subroutine sp_creeb

          14. SYNTAX : sp_ creeb(iumobi,iumeso,jour,mois, xlat,nbfumome,p,t,rm)
            IN: ici_prfl.F from libici
            INCLUDE : ici_def.h
            INPUTS : iumobi,iumeso : logical units
            jour,mois, xlat : for the requested day, month, latitude
            OUTPUTS : p,t,rm return profile
            nbfumome : number of levels of the output
            OBJECT : evaluation of a climatological profile in the stratosphere, for position and an instant of the year. To do so, invoke routine sp_lecmo, sp_lecme, sp_fusmome of the PRFL model (supplied in the ici_prfl.F file but not described, see Ref 19).
            SUBROUTINES INVOKED : sp_lecmo, sp_lecme , sp_fusmome

             
          15. subroutine ici_prstn

          16. SYNTAX: ici_prstn (profil, datasat)
            IN: in libici
            INCLUDE : ici_def.h
            INPUTS/OUTPUTS: profil atmospheric profile with structure /profil40/
            datasat satellite data with structure /ici_sat/
            OBJECT : knowing the cloud top temperature (from the avhrr), to look for the cloud top pressure and update the cloudy information of the ‘profil’ variable and the cloud top pressure of the datasat variable.
             
          17. subroutine ici_rtplanck

          18. SYNTAX: ici_rtplanck(tb, rad, latcan, nbcan)
            IN: libf77rttov6
            INCLUDE : ici_def.h
            cparam.h
            INPUTS: rad radiances
            nbcan, lstcan number and list of channels to be processed
            common c_ici_rttov6: to go from the ici channels numbering to rttov6 numbering
            OUTPUTS: tb brightness temperatures
            OBJECT : interface to RTTOV planck function (plncx).
            SUBROUTINES INVOKED : plncx
             
          19. subroutine ici_rtbright

          20. SYNTAX: ici_rtplanck(rad, tb, latcan, nbcan)
            IN: in libf77rttov6
            INCLUDE : ici_def.h
            cparam.h
            INPUTS: tb brightness temperatures
            nbcan, lstcan number and list of channels to be processed
            common c_ici_rttov6: to go from the ici channels numbering to rttov6 numbering
            OUTPUTS: rad radiances
            OBJECT : interface to RTTOV inverse planck function (brigv).
            SUBROUTINES INVOKED : brigv
             
          21. subroutine ici_upg_p40

          22. SYNTAX: ici_upg_p40(profil, no_version)
            IN: in libici
            INCLUDE : ici_def.h
            INPUTS: profil atmospheric profile with the former /profil40/ structure definition
            no_version software release number upon creation of the profil variable
            OUTPUTS: profil atmospheric profile with the new /profil40/ structure definition
            OBJECT : to be able to read older files with different conventions for certain parameters (land/sea/coast). To so, parameters are updated according to the new conventions.

          23. subroutine ici_upg_sat

          24. SYNTAX: ici_upg_sat(datasat, no_version)
            IN: in libici
            INCLUDE : ici_def.h
            INPUTS: datasat satellite data with the older /ici_sat/ structure definition
            no_version software release number upon creation of the profile variable
            OUTPUTS: datasat satellite data with the new structure definition /ici_sat/
            OBJECT : to be able to read older files with different conventions for certain parameters (land/sea/coast). To do so, parameters are updated according to the new conventions.
             
          25. subroutine intplog

          26. SYNTAX: intplog (pi,ti,pf,tf,ni,nf)
            IN: in libici
            INCLUDE : ici_def.h
            INPUTS: pi real variable: gives information on the pressure levels pi
            pi input pressure levels
            ni number of pi levels
            OUTPUTS: pf real variable: gives information on pressure levels pf
            pf output pressure levels
            nf number of pf levels
            OBJECT : pressure logarithmic interpolation and extrapolation of variable ti, from pressure levels pi to pressure levels pf.
             
          27. subroutine matcov

          28. SYNTAX: matcov(tab, cov, corr, tmoy, tsig, nval, nlev, nbs, nbc)
            IN : in libici
            INCLUDE : ici_def.h
            INPUTS: tab(nval,nlev) real chart
            nval actual number of situations in the file (max=nbs)
            nlev actual number of levels in the file (max= nbc)
            OUTPUTS: cov(nbc, nbc) covariance matrix
            corr(nbc,nbc) correlation matrix
            tmoy(nbc), tsig(nbc) means and standard deviations
            OBJECT : to compute the covariance (and correlation) matrix of the chart tab as well as its mean value and standard deviation.
            SUBROUTINES INVOKED: ici_stat
             
          29. subroutine matinv

          30. SYNTAX: matinv(a,n,m,ipivot,b,ind,pivot,ncr)
            IN: in libici
            INCLUDE : ici_def.h
            INPUTS: a(ncr,ncr) matrix before inversion
            n size of matrix (Its maximum size is ncr)
            OUTPUTS: a(ncr,ncr) matrix after inversion
            OBJECT : inversion of square matrix a (n*n actual channels)
             
          31. subroutine rec_tropo

          32. SYNTAX: rec_tropo(p40)
            IN: in libici
            INCLUDE : ici_def.h
            INPUTS: p40 input profile with structure /profil40/
            OUTPUTS: p40 same profile: the section defining the tropopause in p40 has been documented
            OBJECT : search for the tropopause (pressure, temperature, humidity) of ‘p40’ and profile update
             
          33. subroutine ref32po3

          34. SYNTAX: ref32po3(natm, t, w, o, label, iatm)
            IN: in libici
            INCLUDE : ici_def.h
            INPUTS: natm : profile number among 32 profiles (those that have been selected for computing the rttov coefficients for the ozone)
            OUTPUTS: t, w, o profile in temperature (K), moisture (g/g) and ozone (g/g)
            label description of station and date
            iatm air mass
            OBJECT : to read a profile (in data in the routine). Profile number 1 is US standard 76
             
          35. subroutine prn_p40

          36. SYNTAX: prn_p40 ( profil, iu)
            IN: in libici
            INCLUDE: ici_def.h definition of charts and ici variables
            INPUTS: profil atmospheric profile
            OBJECT : ascii print-out of an atmospheric profile of the p40 type
            if iu is negative, write on standard output (write(*,) ) in a condensed way
            otherwise on logical unit iu
            REMARK: the following routines work in a similar way:
            prn_gmeteo
            (grille,iu) a /grille_meteo/ structure is printed out
            prn_cmeteo
            (champ,iu) a /champ_meteo/ structure is printed out
            prn_iciprevi
            (previ,iu) an /ici_previ/ structure is printed out
            prn_icienv
            (env,iu) an /ici_env/ structure is printed out
            prn_icisat
            (sat,iu) an /ici_sat/ structure is printed out
            prn_histo
            (n,x,iu) computes the histogram of a chart x and prints it out

          37. real function rmtohu

          38. SYNTAX: rmtohu(p,t,rm)
            IN: in libici
            INPUTS: p,t, rm pressure, temperature, humidity (in g/g)
            OUTPUTS: rmtohu relative humidity in %
            OBJECT : to compute the relative humidity at a pressure level p, for a given temperature and humidity. Use of polynomial relations esat and esit that give the partial saturated water vapor pressure for liquid water and ice respectively.
            SUBROUTINES INVOKED : esat, esit
            REMARK : there are also :
            real function tdtohu(p,td) from dew point to relative humidity
            real function hutotd(p,t,hum) from relative humidity to dew point
            real function rmtotd(p,t,rm) from mixing ratio to dew point
            real function tdtorm(p,t,td) from dew point to mixing ratio
            real function hutorm(p,t,hum) from relative humidity to mixing ratio
             
          39. subroutine toth2o

          40. SYNTAX : toth2o(p,h,n,cnth2o)
            IN : in libici
            INPUTS: n, p, h number of levels, pressure and water vapor (in g/g) of the profile
            OUTPUTS: cnth2o water vapor integrated contents in kg/m2
            OBJECT : to compute the water vapor integrated contents for a profile
             
          41. subroutine totozone

          42. SYNTAX: totozone(pres, rmozo, np, cnttozo)
            IN: in libici
            INPUTS: np, pres, rmozo number of levels, pressure and ozone(in g/g) for the profile
            OUTPUTS: cnttozo ozone integrated contents in dobson
            OBJECT: to compute the ozone integrated contents for a profile