-
-
Save mvandenburgh/6c9b284b6bf2b684b43236fe0da35a93 to your computer and use it in GitHub Desktop.
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
from tempfile import TemporaryFile | |
from django.core.files import File | |
from django.db import transaction | |
from django.urls import reverse | |
import djclick as click | |
import requests | |
from rgd.models import ChecksumFile | |
from rgd_imagery.models import Image, ImageSet, Raster | |
from rgd_imagery.tasks import task_populate_raster | |
@click.command() | |
def reproduce_file_path_bug(): | |
filename = 'buildings-to-dsm/buildings_to_dsm_CLS.tif' | |
resp = requests.get('https://data.kitware.com/api/v1/item/61e5c7ce4acac99f42575dc0/download') | |
with TemporaryFile() as fd: | |
fd.write(resp.content) | |
chksm_file = ChecksumFile.objects.create(name=filename, file=File(fd)) | |
img = Image.objects.create(file=chksm_file) | |
img_set = ImageSet.objects.create(name=filename) | |
img_set.images.set([img]) | |
Raster.objects.create(name=filename, image_set=img_set) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment