pyresample icon indicating copy to clipboard operation
pyresample copied to clipboard

create_areas_def returns area_extent as dashed list in yaml

Open BENR0 opened this issue 5 years ago • 1 comments

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

BENR0 avatar Oct 24 '20 12:10 BENR0

If that final block of yaml you posted is the result, I'm OK with this being the default or even have it hardcoded.

djhoese avatar Oct 24 '20 12:10 djhoese