pytroll / pytroll/pyresample

create_areas_def returns area_extent as dashed list in yaml

Open
#307 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
385
Forks
102
Avg merge
4d 2h
Merged PRs (30d)
9

Description

Problem description

This is not a technical but rather an optical problem. When an area definition is dumped using create_areas_def to yaml it for example looks like this:

test:
  description: test
  projection:
    a: 6378169.0
    b: 6356583.800000001
    lon_0: 0.0
    h: 35785831.0
    proj: geos
  shape:
    height: 1752
    width: 2916
  area_extent:
    lower_left_xy:
    - 339045.5577000007
    - 4365586.606293421
    upper_right_xy:
    - 1068143.5270000007
    - 4803645.4685065895
    units: m

This can be loaded fine with load_area and is totally equivalent to the style where the extents are actual lists (see below). So this may be just a matter of choice but it would be nice if the user had the option to choose the style. This can easily be achieved if default_flow_style=None is passed to yaml.dump. To be able to use this create_areas_def should take **kwargs and pass them to ordered_dump.

Expected Output
test:
  description: test
  projection:
    a: 6378169.0
    b: 6356583.800000001
    lon_0: 0.0
    h: 35785831.0
    proj: geos
  shape:
    height: 1752
    width: 2916
  area_extent:
    lower_left_xy: [339045.5577000007, 4365586.606293421]
    upper_right_xy: [1068143.5270000007, 4803645.4685065895]
    units: m
Actual Result, Traceback if applicable
Versions of Python, package at hand and relevant dependencies

pyresample: 1.16
yaml: 5.3.1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading create_areas_def and ordered_dump, then check how load_area handles the generated YAML. Confirm that options passed to create_areas_def can control the serialized list style without changing the existing load_area behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.