Skip to content

Commit

Permalink
hot fix on surface model input dims
Browse files Browse the repository at this point in the history
  • Loading branch information
grantbuster committed Jun 21, 2023
1 parent bb1a30c commit 98aa00b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
9 changes: 7 additions & 2 deletions sup3r/models/abstract.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,16 @@ def input_dims(self):
"""Get dimension of model generator input. This is usually 4D for
spatial models and 5D for spatiotemporal models. This gives the input
to the first step if the model is multi-step. Returns 5 for linear
models."""
models.
Returns
-------
int
"""
if hasattr(self, '_gen'):
return self._gen.layers[0].rank
elif hasattr(self, 'models'):
return self.models[0]._gen.layers[0].rank
return self.models[0].input_dims
else:
return 5

Expand Down
14 changes: 11 additions & 3 deletions sup3r/models/surface.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# -*- coding: utf-8 -*-
"""Special models for surface meteorological data."""
import os
import json
import logging
from inspect import signature
from fnmatch import fnmatch
import numpy as np
from PIL import Image
Expand Down Expand Up @@ -149,6 +146,17 @@ def _get_s_enhance(topo_lr, topo_hr):

return int(se0)

@property
def input_dims(self):
"""Get dimension of model generator input. This is always 4 for an
input array of shape: (n_obs, spatial_1, spatial_2, n_features)
Returns
-------
int
"""
return 4

@property
def feature_inds_temp(self):
"""Get the feature index values for the temperature features."""
Expand Down

0 comments on commit 98aa00b

Please sign in to comment.