Skip to content

implementing forecast.plot for quadtree grid (Handling 'dh') #166

Closed
@khawajasim

Description

@khawajasim

I am working on making forecast.plot() compatible for single-resolution quadtree grids. In quadtree grid, we do not have any fixed 'dh' value. So I request a little modification in the code for replacement of dh.

In file: utils.plot, line: 863-865
bbox = region.get_bbox()
if extent is None and not set_global:
extent = [bbox[0], bbox[1], bbox[2] + region.dh, bbox[3] + region.dh]

and lines: 933-934:
lons, lats = numpy.meshgrid(numpy.append(region.xs, region.xs[-1] + region.dh), numpy.append(region.ys, region.ys[-1] + region.dh))

In above cases, dh is only used to get the last corner point of the testing region.
My suggestion is that we can change this implementation by using region.get_bbox(). Currently, this function provides bounding box based on origin points only. I suggest to change its implementation from just origins to whole testing region (origin coords + top_right coords), like I did for Quadtree for gird. Then with this modification, we can simply change above lines to:

bbox = region.get_bbox()
if extent is None and not set_global:
extent = [bbox[0], bbox[1], bbox[2], bbox[3]]

and

lons, lats = numpy.meshgrid(numpy.append(region.xs, bbox[1]), numpy.append(region.ys, bbox[3]))

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