Skip to content
This repository has been archived by the owner on Jun 18, 2023. It is now read-only.

Config file format #30

Closed
ceholden opened this issue Aug 21, 2015 · 0 comments
Closed

Config file format #30

ceholden opened this issue Aug 21, 2015 · 0 comments

Comments

@ceholden
Copy link
Owner

Switch config file format to YAML. Primary reason for change is that YAML can automatically parse the data types in the config files. This saves me a lot of coding, is more flexible since I don't have to update a parser, and is probably gives the user more flexibility in the long term.

Target release v0.5.0 since that one doesn't work with existing config files anyway. Why update your config files for v0.5.0 only to also port to YAML in the future?

Example:

metadata:
    version: "0.5.0"

dataset:
    # Text file containing dates and images
    input_file: "/home/ceholden/Documents/yatsm/examples/p022r049_input.csv"
    # Input date format
    date_format: "%Y%j"
    # Output location
    output: "/home/ceholden/Documents/landsat_stack/p022r049/images/YATSM"
    # Output file prefix (e.g., [prefix]_[line].npz)
    output_prefix: "yatsm_r"
    # Total number of bands
    n_bands: 8
    # Mask band (e.g., Fmask)
    mask_band: 8
    # List of integer values to mask within the mask band
    mask_values: [2, 3, 4, 255]
    # Valid range of non-mask band data
    # specify 1 range for all bands, or specify ranges for each band
    valid_range: [0, 10000]
    # Indices for multi-temporal cloud masking (indexed on 1)
    green_band: 2
    swir1_band: 5
    # Use BIP image reader? If not, use GDAL to read in
    use_bip_reader: true
    # Directory location for caching dataset lines
    cache_line_dir: "/home/ceholden/Documents/landsat_stack/p022r049/images/.yatsm_cache"

produces:

In [8]: cfg = yaml.safe_load(open('p022r049_example.yaml'))

In [9]: cfg
Out[9]: 
{'dataset': {'cache_line_dir': '/home/ceholden/Documents/landsat_stack/p022r049/images/.yatsm_cache',
  'date_format': '%Y%j',
  'green_band': 2,
  'input_file': '/home/ceholden/Documents/yatsm/examples/p022r049_input.csv',
  'mask_band': 8,
  'mask_values': [2, 3, 4, 255],
  'n_bands': 8,
  'output': '/home/ceholden/Documents/landsat_stack/p022r049/images/YATSM',
  'output_prefix': 'yatsm_r',
  'swir1_band': 5,
  'use_bip_reader': True,
  'valid_range': [0, 10000]},
 'metadata': {'version': '0.5.0'}

Pretty great!

@ceholden ceholden added this to the v0.5.0 milestone Aug 21, 2015
ceholden added a commit that referenced this issue Aug 21, 2015
ceholden added a commit that referenced this issue Aug 23, 2015
ceholden added a commit that referenced this issue Aug 25, 2015
- Add min_values/max_values in place of valid_range
- CSV file has header
- Use Pandas to parse CSV (so add as requirement)
- Update examples
- Bump version
- Check for implementation of YATSM algorithm
- Put YATSM algo class in config
ceholden added a commit that referenced this issue Aug 25, 2015
ceholden added a commit that referenced this issue Aug 25, 2015
@ceholden ceholden closed this as completed Sep 9, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant