Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changed tif creation form translate to warp #47 #57

Merged
merged 1 commit into from
Jul 23, 2024
Merged
Changes from all commits
Commits
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
9 changes: 7 additions & 2 deletions framework/climate/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,14 @@ def cache_tif_from_nc(filename_in: str, foldertype: str, temp_doc: TempResultFil
# print(f"filename_out: {filename_out}")
# print(f"filepath_in: {filepath_in}")
# print(f"filepath_out: {filepath_out}")

# Set destination spatial reference
kwargs = {"dstSRS": 'EPSG:4326'}

try:
ds = gdal.Open(filepath_in)
gdal.Translate(filepath_out, ds, format="Gtiff")
# for some reason, tif files created via translate are
# not allways working correctly in our visualization
gdal.Warp(filepath_out, filepath_in, **kwargs)
fileversion_out = os.stat(filepath_out).st_mtime
temp_doc.st_mtime_tif = fileversion_out
temp_doc.save()
Expand Down
Loading