Make Matchup |

Extracts, filters, and appends satellite match-up data to a valid SeaBASS file (requires the val_extract binary executable in the OCSSW software suite to be compiled).
Note: This is a python script make_matchup which is included in the OCSSW installation (currently only available for use on the command line).

    ~/ocssw/bin$ ./make_matchup -h
    usage: make_matchup [-h] --sat_file SAT_FILE [SAT_FILE ...] --seabass_file SEABASS_FILE [SEABASS_FILE ...]
                        [--box_size BOX_SIZE] [--min_valid_sat_pix MIN_VALID_SAT_PIX]
                        [--max_time_diff MAX_TIME_DIFF] [--max_coeff_variation MAX_COEFF_VARIATION] [--slat SLAT]
                        [--elat ELAT] [--slon SLON] [--elon ELON] [--verbose] [--no_header_comment]

          This program create and output satellite matchups from a given SeaBASS file.

          REQUIRED inputs:
              1) --sat_file=        an OB.DAAC L2 (SST, SST4, IOP, or OC) satellite file
              2) --seabass_file=    a valid SeaBASS file with latitude, longitude, and date-time information as field entries.

          Notes on OPTIONAL inputs:
              1) --slat= --slon=    must be used together and will override any lat/lons in --seabass_file
              2) --elat= --elon=    must be used together and with --slon= and --slat=
                                    will override any lat/lons in --seabass_file
                                    uses a lat/lon bounding box instead of --box_size=

          Outputs:
              1) the original SeaBASS data
              AND
              2) collocated satellite products as additional columns appended to --seabass_file

          Example usage call:
             make_matchup --sat_file=[file name].nc --seabass_file=[file name].sb
             make_matchup --sat_file=[file name].nc --seabass_file=[file name].sb --slat=45.3 --slon=-157.4
             make_matchup --sat_file=[file name].nc --seabass_file=[file name].sb --slat=45.3 --elat=48.7 --slon=-157.4 --elon=-145.3

          Caveats:
            * This script is designed to work with files that have been properly
              formatted according to SeaBASS guidelines (i.e. Files that passed FCHECK).
              Some error checking is performed, but improperly formatted input files
              could cause this script to error or behave unexpectedly. Files
              downloaded from the SeaBASS database should already be properly formatted,
              however, please email seabass@seabass.gsfc.nasa.gov and/or the contact listed
              in the metadata header if you identify problems with specific files.

            * It is always HIGHLY recommended that you check for and read any metadata
              header comments and/or documentation accompanying data files. Information
              from those sources could impact your analysis.

            * Compatibility: This script was developed for Python 3.5.

    options:
      -h, --help            show this help message and exit
      --sat_file SAT_FILE [SAT_FILE ...]
                                  REQUIRED: input OB.DAAC Level-2 satellite netCDF file(s)

      --seabass_file SEABASS_FILE [SEABASS_FILE ...]
                                  REQUIRED: input SeaBASS file(s)
                                  Must be a valid SeaBASS file, passing FHCHECK with no errors.
                                  Matched-up satellite variables will be appended as additional fields to the data matrix and relevant headers.
                                  File must contain latitude and longitude and date-time expressed as FIELD entries.

      --box_size BOX_SIZE         OPTIONAL: box size of the satellite data extract made around the in situ point
                                  Valid values are odd numbers between 3 and 11, default = 5

      --min_valid_sat_pix MIN_VALID_SAT_PIX
                                  OPTIONAL: percent minimum valid satellite pixels required to create an extract
                                  Valid value: (0.0 - 100.0), default = 50.0

      --max_time_diff MAX_TIME_DIFF
                                  OPTIONAL: maximum time difference between satellite and in situ point
                                  Valid value: decimal number of hours (0 - 36 hours), default = 3

      --max_coeff_variation MAX_COEFF_VARIATION
                                  OPTIONAL: maximum coefficient of variation of satellite pixels within the satellite extract
                                  Valid value: (0.0 - 1.0), default = 0.15

      --slat SLAT                 OPTIONAL: Starting latitude, south-most boundary
                                  If used with --seabass_file, will override lats in the file
                                  Valid values: (-90,90N)

      --elat ELAT                 OPTIONAL: Ending latitude, north-most boundary
                                  If used with --seabass_file and --slat, will override lats in the file
                                  Valid values: (-90,90N)

      --slon SLON                 OPTIONAL: Starting longitude, west-most boundary
                                  If used with --seabass_file, will override lons in the file
                                  Valid values: (-180,180E)

      --elon ELON                 OPTIONAL: Ending longitude, east-most boundary
                                  If used with --seabass_file and --slon, will override lons in the file
                                  Valid values: (-180,180E)

      --verbose                   OPTIONAL: Displays reason for failed matchup for each in situ target called.

      --no_header_comment         OPTIONAL: Flag to NOT append exclusion criteria to the OFILE header. Useful when running script repeatedly.