Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions nowcasting_dataset/data_sources/fake/coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,28 @@ def create_random_point_coordinates_osgb(


def make_random_image_coords_osgb(
size: int, x_center_osgb: Optional = None, y_center_osgb: Optional = None
size: int,
x_center_osgb: Optional = None,
y_center_osgb: Optional = None,
km_spaceing: Optional[int] = 4,
):
"""Make random coords for image. These are ranges for the pixels"""
"""
Make random coords for image. These are ranges for the pixels

Args:
size: The size of the coordinates to make
x_center_osgb: center coord for x (in osgb)
y_center_osgb: center coord for y (in osgb)
km_spaceing: the km spacing between the coordinates.

Returns: X,Y random coordinates [OSGB]
"""

ONE_KILOMETER = 10**3

# 4 kilometer spacing seemed about right for real satellite images
x = 4 * ONE_KILOMETER * np.array((range(0, size)))
y = 4 * ONE_KILOMETER * np.array((range(size, 0, -1)))
x = km_spaceing * ONE_KILOMETER * np.array((range(0, size)))
y = km_spaceing * ONE_KILOMETER * np.array((range(size, 0, -1)))

return add_uk_centroid_osgb(
x, y, x_center_osgb=x_center_osgb, y_center_osgb=y_center_osgb, first_value_center=False
Expand Down