Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

Commit fa471de

Browse files
Merge pull request #604 from openclimatefix/issue/add-fake-km-option
Issue/add fake km option
2 parents 38e5b35 + d5ba87b commit fa471de

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

nowcasting_dataset/data_sources/fake/coordinates.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,28 @@ def create_random_point_coordinates_osgb(
2020

2121

2222
def make_random_image_coords_osgb(
23-
size: int, x_center_osgb: Optional = None, y_center_osgb: Optional = None
23+
size: int,
24+
x_center_osgb: Optional = None,
25+
y_center_osgb: Optional = None,
26+
km_spaceing: Optional[int] = 4,
2427
):
25-
"""Make random coords for image. These are ranges for the pixels"""
28+
"""
29+
Make random coords for image. These are ranges for the pixels
30+
31+
Args:
32+
size: The size of the coordinates to make
33+
x_center_osgb: center coord for x (in osgb)
34+
y_center_osgb: center coord for y (in osgb)
35+
km_spaceing: the km spacing between the coordinates.
36+
37+
Returns: X,Y random coordinates [OSGB]
38+
"""
2639

2740
ONE_KILOMETER = 10**3
2841

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

3346
return add_uk_centroid_osgb(
3447
x, y, x_center_osgb=x_center_osgb, y_center_osgb=y_center_osgb, first_value_center=False

0 commit comments

Comments
 (0)