Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
754f28a
Initial shot
frodre Mar 12, 2026
7c5b4c5
Make fine coords required
frodre Mar 13, 2026
c7f58d9
Fine coords required for paired data
frodre Mar 13, 2026
563b57a
Mesh with previous updates in refactor pr
frodre Mar 17, 2026
f4218dd
Simplify event downscaler coordinate in run()
frodre Mar 17, 2026
68cab61
use batch latlon coardinates for coarse
frodre Mar 17, 2026
83ca043
Make fine coord loader public
frodre Mar 17, 2026
794a7d4
BatchLatLon coord access consistency
frodre Mar 17, 2026
b542080
linting
frodre Mar 17, 2026
5add727
Add no coords checkpoint with path test
frodre Mar 17, 2026
36e80db
Small tweaks
frodre Mar 17, 2026
b19c9d6
Add load_fine_coords_from_path test
frodre Mar 17, 2026
7acf87c
Update fme/downscaling/models.py
frodre Mar 18, 2026
eba2749
Update fme/downscaling/models.py
frodre Mar 18, 2026
2c25f1d
Update fme/downscaling/models.py
frodre Mar 18, 2026
81e4eb8
use latlon coords .to method for device fix
frodre Mar 18, 2026
325d324
Redo based on Anna's comments
frodre Mar 19, 2026
1fac745
Remove from_state docstring
frodre Mar 19, 2026
3ef1613
Move all state loading cases into static inputs code
frodre Mar 19, 2026
36e8101
Remove unused function from fme.downscaling.data
frodre Mar 19, 2026
3f95457
fine_coords -> full_fine_coords
frodre Mar 19, 2026
6c9fcf7
Remove duplicated tests from models.py
frodre Mar 19, 2026
4b58b86
Minor fixes
frodre Mar 19, 2026
7e36f55
Fix imports
frodre Mar 19, 2026
a85fb05
Final cleanup
frodre Mar 19, 2026
b1ee3d4
Merge branch 'main' into feature/downscaling-model-fine-coords
frodre Mar 19, 2026
bedd276
Add coordinate validation and use training data as a fallback vs. sta…
frodre Mar 20, 2026
a9dbae3
Updates based on discussion w/ Anna
frodre Mar 21, 2026
46670ff
Merge branch 'main' into feature/downscaling-model-fine-coords
frodre Mar 21, 2026
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
2 changes: 1 addition & 1 deletion fme/core/coordinates.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ def __eq__(self, other) -> bool:
def __repr__(self) -> str:
return f"LatLonCoordinates(\n lat={self.lat},\n lon={self.lon}\n"

def to(self, device: str) -> "LatLonCoordinates":
def to(self, device: str | torch.device) -> "LatLonCoordinates":
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To make my VSCode linter happy

return LatLonCoordinates(
lon=self.lon.to(device),
lat=self.lat.to(device),
Expand Down
7 changes: 6 additions & 1 deletion fme/downscaling/data/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@
PairedBatchItem,
PairedGriddedData,
)
from .static import StaticInput, StaticInputs, load_static_inputs
from .static import (
StaticInput,
StaticInputs,
load_fine_coords_from_path,
load_static_inputs,
)
from .utils import (
BatchedLatLonCoordinates,
ClosedInterval,
Expand Down
7 changes: 6 additions & 1 deletion fme/downscaling/data/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@
PairedBatchData,
PairedGriddedData,
)
from fme.downscaling.data.utils import ClosedInterval, adjust_fine_coord_range
from fme.downscaling.data.utils import (
ClosedInterval,
adjust_fine_coord_range,
get_latlon_coords_from_properties,
)
from fme.downscaling.requirements import DataRequirements


Expand Down Expand Up @@ -529,6 +533,7 @@ def build(
dims=example.fine.latlon_coordinates.dims,
variable_metadata=variable_metadata,
all_times=all_times,
fine_coords=get_latlon_coords_from_properties(properties_fine),
)

def _get_sampler(
Expand Down
11 changes: 7 additions & 4 deletions fme/downscaling/data/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,13 @@ def __init__(
f"expected lon_min < {self.lon_interval.start + 360.0}"
)

self._lats_slice = self.lat_interval.slice_of(self._orig_coords.lat)
self._lons_slice = self.lon_interval.slice_of(self._orig_coords.lon)
# Used to subset the data in __getitem__
self._lats_slice = self.lat_interval.slice_from(self._orig_coords.lat)
self._lons_slice = self.lon_interval.slice_from(self._orig_coords.lon)

self._latlon_coordinates = LatLonCoordinates(
lat=self._orig_coords.lat[self._lats_slice],
lon=self._orig_coords.lon[self._lons_slice],
lat=self.lat_interval.subset_of(self._orig_coords.lat),
lon=self.lon_interval.subset_of(self._orig_coords.lon),
)
self._area_weights = self._latlon_coordinates.area_weights

Expand Down Expand Up @@ -337,6 +339,7 @@ class PairedGriddedData:
dims: list[str]
variable_metadata: Mapping[str, VariableMetadata]
all_times: xr.CFTimeIndex
fine_coords: LatLonCoordinates

@property
def loader(self) -> DataLoader[PairedBatchItem]:
Expand Down
Loading
Loading