Skip to content

scaling.py Numpy function arg bug #2614

@vfilter

Description

@vfilter

Describe the bug

pos = coordinates * np.array(m_per_deg_lat, m_per_deg_lon)
has a bug where longitude gets passed as a second arg to np.array. The second arg for np.array is the dtype however.

pos = coordinates * np.array(m_per_deg_lat, m_per_deg_lon)

What will happen with the current implementation is that m_per_deg_lat will be silently used as a multiplier for both axes.

# resulting broadcast
lat * m_per_deg_lat
lon * m_per_deg_lat   # <- this is wrong. it should be using the lon instead

Expected behavior
Correct implementation is as follows:

pos = coordinates * np.array([m_per_deg_lat, m_per_deg_lon])

This could also affect the unit tests, but I didn't check.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions