Skip to content

Commit

Permalink
short cleanup and comments TempResultFiles climate model #62
Browse files Browse the repository at this point in the history
  • Loading branch information
FlatErikk committed Oct 16, 2024
1 parent 47cb9fd commit 6b2b207
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions framework/climate/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,16 @@ def __str__(self):


class TempResultFile(models.Model):
NUM_BANDS_TIF_LIMIT = 250
"""Model for temporary result files. At the moment these are ONLY .nc format and
some info on other formats we have generated from there (.tif, and in future .dat)
"""
# TODO:
# - cleaner handling and fields
# - integrate extent, variable(s), unit-types, (variable-types)?

# NOTE - old unused categories, remove or adapt handling
CATEGORIES = ("water_budget", "water_budget"), ("water_budget_bias", "water_budget_bias"), ("kaariba", "kaariba")

categorized_filename = models.CharField(max_length=500, unique=True, null=True)
filename = models.CharField(max_length=400, null=True)
category = models.CharField(max_length=255, choices=CATEGORIES, null=True)
Expand Down Expand Up @@ -304,10 +312,5 @@ def check_cache_version(self, version):
else:
return True

def tif_convertable(self):
if self.num_bands is None or self.num_bands > self.NUM_BANDS_TIF_LIMIT:
return False
return True

def __str__(self):
return f"[{self.category}] {str(self.filename)}"

0 comments on commit 6b2b207

Please sign in to comment.