Skip to content
Snippets Groups Projects

Fix cams aot download before 2017

Closed Alexandre Fiche requested to merge fix_cams_aot_download_before_2017 into develop
@@ -123,7 +123,7 @@ def download_files(dt, file_type, t_hour, step, path_out, cams_src="cams", api_c
cams_repo = "cams-global-atmospheric-composition-forecasts"
params = {
# common params
"step": "0",
# "step": "0",
"type": "forecast",
"data_format": "netcdf_legacy",
"date": date,
@@ -146,7 +146,7 @@ def download_files(dt, file_type, t_hour, step, path_out, cams_src="cams", api_c
# Recupere AOT a 550nm pour BC, SS, SU, DU, OM
# Et (si possible p. CAMS46r1) AM, NI
path_aot = get_path_cams(path_out, "AOT", cams_src, cams_file_suffix)
params_aot = get_params_aot(params, cams_src)
params_aot = get_params_aot(params, cams_src, dt)
server.retrieve(
cams_repo,
params_aot,
@@ -255,7 +255,7 @@ def get_params_mr(params, cams_src):
return params_mr
def get_params_aot(params, cams_type):
def get_params_aot(params, cams_type, date):
models = [
"dust_aerosol_optical_depth_550nm",
"sea_salt_aerosol_optical_depth_550nm",
@@ -275,10 +275,10 @@ def get_params_aot(params, cams_type):
"secondary_organic_aerosol_optical_depth_550nm",
])
params_aot = params.copy()
params_aot.update({
# add specific params
"variable": models,
})
params_aot.update({"variable": models})
# Change leadtime_hour (0 to 1) for date before 24/01/2017
if date < datetime(2017, 1, 25):
params_aot.update({"leadtime_hour": "1"})
return params_aot
@@ -407,7 +407,7 @@ if __name__ == "__main__":
# Surface : AOT (aerosol optical thickness)
# Pressure : RH (relative humidity)
# Model : MR (mixing ratios)
ftype = {"surface": True, "pressure": True, "model": True}
ftype = {"surface": True, "pressure": False, "model": False}
# Create directories
from StartMaja.Common import FileSystem
@@ -429,15 +429,18 @@ if __name__ == "__main__":
# TODO Si camsdownload avec option reanlysis et rean plus dispo -> erreur
for t in range(len(time)):
# No CAMS at 12:00 before 21 june 2016 (cams 41r1)
if time[t] == "12" and cams_src == "cams" and date < datetime(2016, 6, 21):
continue
print(time[t])
aot, rh, mr = download_files(
date, ftype, time[t], step_choice, args.write_dir, cams_src, config_api
)
# # Conversion to MAJA DBL/HDR format
RawCAMSArchive.process_one_file(
args.archive_dir, aot, rh, mr, cams_src, args.platform
)
if not args.keep:
os.remove(aot)
os.remove(mr)
os.remove(rh)
# RawCAMSArchive.process_one_file(
# args.archive_dir, aot, rh, mr, cams_src, args.platform
# )
# if not args.keep:
# os.remove(aot)
# os.remove(mr)
# os.remove(rh)
Loading