Commit 6209befb authored by Christoph Heim's avatar Christoph Heim
Browse files

Hopefully last updates from mistral

parent 517a0b1e
......@@ -81,7 +81,7 @@ if __name__ == '__main__':
'PP']
# missing: TQV, CLCL, CLCT, and in NICAM-3.5 also SST
# missing: PS
#var_names = ['MSLP']
var_names = ['TQI']
"""
......@@ -97,7 +97,7 @@ if __name__ == '__main__':
# model resolutions [km] of simulations
ress = [7, 3.5]
ress = [7]
ress = [3.5]
#ress = [3.5]
# date range
first_date = datetime(2016,8,1)
......
......@@ -139,6 +139,7 @@ if __name__ == '__main__':
'LWUTOA', 'SWNDTOA',
'TQC', 'TQI', 'TQV',
'CLCT', 'PPCONV', 'PPGRID'],
'2D':['TQV'],
'3D':['U', 'P', 'V'],
'3D':['P'],
......@@ -164,7 +165,7 @@ if __name__ == '__main__':
var_names = var_namess[run_var_type]
#ress = [7.5, 3.75]
ress = [7.5]
#ress = [7.5]
ress = [3.75]
i_bash_output = 0
......
......@@ -97,6 +97,7 @@ if __name__ == '__main__':
'TQC', 'TQI', 'TQV',
'CLCL', 'CLCT', 'PPCONV', 'PPGRID']
# missing: P (derive with PS and vertical grid)
var_names = ['V']
"""
parallel tasks:
......
......@@ -4,7 +4,7 @@
description: Extract lat-lon box of data from model GEOS.
author: Christoph Heim
date created: 09.07.2019
date changed: 27.02.2020
date changed: 01.04.2020
usage: arguments:
1st: n jobs for multiprocessing pool
"""
......@@ -15,13 +15,13 @@ from datetime import datetime, timedelta
from multiprocessing import Pool
from pathlib import Path
from cdo import Cdo
from package.utilities import Timer, cdo_mergetime
from package.utilities import Timer, cdo_mergetime, write_grid_file
from namelist import domain, padding
from functions import paste_dir_names
###############################################################################
def sellatlon_GEOS(inp_file, out_file, dt, box, options, var_name, var_dict,
res):
res, target_grid):
TM = Timer()
file_code = '{}km_{}_{:%Y%m%d%H%M}'.format(res, var_name, dt)
......@@ -33,6 +33,8 @@ def sellatlon_GEOS(inp_file, out_file, dt, box, options, var_name, var_dict,
else:
print('\t\t'+file_code)
tmp_file = '{}.tmp'.format(out_file)
# cdo
TM.start('cdo')
ofile = cdo.sellonlatbox(
......@@ -42,7 +44,11 @@ def sellatlon_GEOS(inp_file, out_file, dt, box, options, var_name, var_dict,
str(box['vert1'])+
' -selname,'+var_dict[var_name]['key']+
' '+inp_file),
output=out_file)
output=tmp_file)
ofile = cdo.remapbil(target_grid, input=tmp_file, output=out_file)
os.remove(tmp_file)
TM.stop('cdo')
......@@ -75,9 +81,8 @@ if __name__ == '__main__':
'SLHFLX', 'SSHFLX',
'TQC', 'TQI', 'TQV',
'PP']
#var_names = ['PP']
# missing: SST CLCL CLCT
#var_names = ['P']
#var_names = ['V']
"""
parallel tasks:
......@@ -95,15 +100,18 @@ if __name__ == '__main__':
#last_date = datetime(2016,8,1)
#first_date = datetime(2016,8,1)
#last_date = datetime(2016,8,10)
#last_date = datetime(2016,8,8)
#first_date = datetime(2016,8,11)
#last_date = datetime(2016,8,20)
#first_date = datetime(2016,8,9)
#last_date = datetime(2016,8,16)
#first_date = datetime(2016,8,21)
#last_date = datetime(2016,8,30)
#first_date = datetime(2016,8,17)
#last_date = datetime(2016,8,24)
#first_date = datetime(2016,8,31)
#first_date = datetime(2016,8,25)
#last_date = datetime(2016,9,1)
#first_date = datetime(2016,9,2)
#last_date = datetime(2016,9,9)
# options for computation
......@@ -215,6 +223,11 @@ if __name__ == '__main__':
shutil.rmtree(out_tmp_dir)
Path(out_tmp_dir).mkdir(parents=True, exist_ok=True)
# target grid on which to interpolate the model output
target_grid = os.path.join('grids','latlon_{}km_dom_{}'.format(
res, domain['code']))
write_grid_file(box, target_grid, res)
# find times and files that should be extracted
# and prepare arguments for function
args = []
......@@ -242,7 +255,7 @@ if __name__ == '__main__':
out_file = os.path.join(out_tmp_dir,
var_name+'_{:%Y%m%d%H%M}'.format(dt)+'.nc')
args.append( (inp_file, out_file, dt, box, options, var_name,
var_dict, res) )
var_dict, res, target_grid) )
# run function serial or parallel
if n_tasks > 1:
......
......@@ -121,7 +121,7 @@ if __name__ == '__main__':
'CLCT', 'PP']
# missing: P (given in model output (vertical levels))
# missing: SST
#var_names = ['PS', 'TQI', 'TQV', 'CLCT']
var_names = ['SWDSFC']
"""
parallel tasks:
......
gridtype = lonlat
xsize = 2336
ysize = 1780
xname = lon
xlongname = "longitude"
xunits = "degrees_east"
yname = lat
ylongname = "latitude"
yunits = "degrees_north"
xfirst = -45
xinc = 0.027
yfirst = -30
yinc = 0.027
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment