Skip to content

PV LIB - ECMWF - functionality is not compatible with non-global ERA5 files #817

Closed
@shall-resurety

Description

@shall-resurety

Description/Details
When working with ERA5 netCDF files which are not 'global' (i.e. lat -90 to +90 and lon -180 to +180) the pvlib function get_nearest_indices returns incorrect values due to an incorrect derivation of the grid size intervals. The appropriate grid size inside get_nearest_indices the derived ERA5 grid spacing does not correlate with the actual 0.25 degree grid spacing which is represented in all ERA5 netCDF files (geo-subset or otherwise). Ultimately this results in data being returned for the wrong lat and lon position based on a misaligned file index. This is something which could be resolved by ensuring the standard 0.25 degree value is used for the delta_lat and delta_lon values when instantiating a ECMWF object from a geo-subset netCDF file. Thank you.

*** Perhaps this should be a feature request instead but logging as a bug due to the incorrect values being returned 'silently'.

To Reproduce
*Assume you have a geo-subset (CONUS) ERA5 netCDF file path stored in the variable filePath

  met = pvlib.iotools.read_ecmwf_macc(filename  = filePath,
                                      latitude  = 34,
                                      longitude = -101.25)

Expected behavior
The ECMWF object has a lat, lon delta defined as 1.8 versus the correct 0.25 which results with incorrect row indices being used in the met data return and therefore not representing the requested lat and lon position which is input.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions