Skip to content

Commit

Permalink
global flake8 and isort reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
FlatErikk committed Apr 9, 2024
1 parent 3643c5a commit 3d8e0a1
Show file tree
Hide file tree
Showing 11 changed files with 1,167 additions and 620 deletions.
2 changes: 2 additions & 0 deletions framework/climate/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,11 @@ class GlobalClimateModelAdmin(admin.ModelAdmin):
class RegionalClimateModelAdmin(admin.ModelAdmin):
list_display = ('name_short',)


class ProcessingMethodAdmin(admin.ModelAdmin):
list_display = ('name',)


admin.site.register(CfStandardNames, CfStandardNamesAdmin)
admin.site.register(ClimateLayer, ClimateLayerAdmin)
admin.site.register(ClimateVariable, ClimateVariableAdmin)
Expand Down
33 changes: 19 additions & 14 deletions framework/climate/cdo_calls.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
from cdo import Cdo
import sys

print ('argument list', sys.argv)
from cdo import Cdo


print("argument list", sys.argv)


def slice_bbox(file, file_out, lonmin, lonmax, latmin, latmax):
cdo = Cdo()
cdo.sellonlatbox(
lonmin, lonmax, latmin, latmax, input=file, output=file_out, options="-f nc4"
)


def slice_time(file, file_out, year_from, year_to):
cdo = Cdo()
cdo.seltimestep(year_from, year_to, input=file, output=file_out, options="-f nc4")

def slice_bbox(file, file_out, lonmin, lonmax, latmin, latmax):
cdo=Cdo()
cdo.sellonlatbox(lonmin,lonmax,latmin,latmax,input=file,output=file_out,options="-f nc4")

def slice_time(file, file_out, year_from, year_to):
cdo=Cdo()
cdo.seltimestep(year_from,year_to, input=file,output=file_out,options="-f nc4")

if sys.argv[1] == "bbox":
file = sys.argv[2]
file_out = sys.argv[3]
lonmin = sys.argv[4]
lonmax = sys.argv[5]
latmin = sys.argv[6]
latmax = sys.argv[7]
latmax = sys.argv[7]
slice_bbox(file, file_out, lonmin, lonmax, latmin, latmax)

if sys.argv[1] == "time":
file = sys.argv[2]
file_out = sys.argv[3]
year_from = (int(sys.argv[4])-int(sys.argv[6])) * 360
year_from = (int(sys.argv[5])-int(sys.argv[6])) * 360
slice_time(file, file_out, year_from, year_from)
year_from = (int(sys.argv[4]) - int(sys.argv[6])) * 360
year_from = (int(sys.argv[5]) - int(sys.argv[6])) * 360
slice_time(file, file_out, year_from, year_from)
Loading

0 comments on commit 3d8e0a1

Please sign in to comment.