This repository has been archived by the owner on Aug 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move dynamic checking of which datasets a City supports to a DB field
The current dynamic check is not working very well. It checks for the presence of map cells and reports their dataset names, but doesn't check the values for those cells. In practice, this means that a location without LOCA data will be reported as supporting LOCA data, as the ingest will create LOCA cells, but fill them with NaN (not a number) values. Since checking the values in each cell would be computationally expensive, we've instead moved the list of supported datasets to be stored in the database. A future enhancement (#823) will ensure that this is properly set for every existing city. Closes #822
- Loading branch information
Showing
6 changed files
with
70 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from django.contrib import admin | ||
|
||
from climate_data.models import City | ||
|
||
|
||
class CityAdmin(admin.ModelAdmin): | ||
exclude = ('_geog',) | ||
|
||
|
||
admin.site.register(City, CityAdmin) |
31 changes: 31 additions & 0 deletions
31
django/climate_change_api/climate_data/migrations/0066_auto_20180627_2016.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# -*- coding: utf-8 -*- | ||
# Generated by Django 1.10.8 on 2018-06-27 20:16 | ||
from __future__ import unicode_literals | ||
|
||
import climate_data.models | ||
import django.contrib.postgres.fields | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('climate_data', '0065_scenario_alias'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterModelOptions( | ||
name='city', | ||
options={'verbose_name_plural': 'cities'}, | ||
), | ||
migrations.AddField( | ||
model_name='city', | ||
name='datasets', | ||
field=django.contrib.postgres.fields.ArrayField(base_field=models.CharField(choices=[('LOCA', 'LOCA'), ('NEX-GDDP', 'NEX-GDDP')], max_length=48), default=climate_data.models.get_datasets, size=2), | ||
), | ||
migrations.AlterField( | ||
model_name='climatedataset', | ||
name='name', | ||
field=models.CharField(choices=[('LOCA', 'LOCA'), ('NEX-GDDP', 'NEX-GDDP')], max_length=48, unique=True), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters