Skip to content

Commit

Permalink
add run_joanne.py and include in global attrs
Browse files Browse the repository at this point in the history
  • Loading branch information
Geet-George committed May 10, 2021
1 parent 1c5faa0 commit 77a89dc
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 3 deletions.
2 changes: 1 addition & 1 deletion joanne/Level_2/dicts.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def get_global_attrs(Platform, file_time, sonde_ds):
nc_global_attrs = {
"title": "EUREC4A JOANNE Level-2",
"doi": f"{joanne.data_doi}",
"created with": f"doi:{joanne.software_doi}",
"created with": f"run_joanne.py doi:{joanne.software_doi}",
"Conventions": "CF-1.8",
"campaign_id": "EUREC4A",
"project_id": "JOANNE",
Expand Down
2 changes: 1 addition & 1 deletion joanne/Level_3/dicts.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@
nc_global_attrs = {
"title": "EUREC4A JOANNE Level-3",
"doi": f"{joanne.data_doi}",
"created with": f"doi:{joanne.software_doi}",
"created with": f"run_joanne.py doi:{joanne.software_doi}",
"Conventions": "CF-1.8",
"campaign_id": "EUREC4A",
"project_id": "JOANNE",
Expand Down
2 changes: 1 addition & 1 deletion joanne/Level_4/dicts.py
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@
nc_global_attrs = {
"title": "EUREC4A JOANNE Level-4",
"doi": f"{joanne.data_doi}",
"created with": f"doi:{joanne.software_doi}",
"created with": f"run_joanne.py doi:{joanne.software_doi}",
"Conventions": "CF-1.8",
"campaign_id": "EUREC4A",
"project_id": "JOANNE",
Expand Down
67 changes: 67 additions & 0 deletions joanne/run_joanne.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import os
import joanne
import glob
from pylab import size
import joanne.Level_2.QC as qc


data_directory = "/Users/geet/Documents/JOANNE/Data/"
save_directory = "/Users/geet/Documents/JOANNE/Data/QC/"
qc_dir = os.path.join(data_directory, "QC")

jo_version = joanne.__version__

halo_status_file = sorted(glob.glob(f"{qc_dir}*HALO*{jo_version}.nc"))
p3_status_file = sorted(glob.glob(f"{qc_dir}*P3*{jo_version}.nc"))

if (len(halo_status_file) >= 1) and (len(p3_status_file) >= 1):
print("QC Status files of the current version found for both P3 and HALO")
else:
print(
"QC Status files of the current version not found for both P3 and HALO. Therefore, running QC..."
)

qc.run_qc(
data_directory=data_directory, save_directory=save_directory,
)


l2_files = sorted(glob.glob(f"{data_directory}Level_2/*{jo_version}.nc"))

no_of_l2_files = size(l2_files)

if no_of_l2_files > 1000:
print(
f"{no_of_l2_files} Level-2 files found with the current JOANNE version. Therefore not running Level-2 script again."
)
else:
print("Starting Level-2")
import joanne.Level_2.Level_2

print("Level-2 finished")


l3_files = sorted(glob.glob(f"{data_directory}Level_3/*{jo_version}.nc"))

if size(l3_files) > 0:
print(
"Level-3 file found with the current JOANNE version. Therefore not running Level-3 script again."
)
else:
print("Starting Level-3")
import joanne.Level_3.Level_3

print("Level-3 finished")


l4_files = sorted(glob.glob(f"{data_directory}Level_4/*{jo_version}.nc"))

if size(l4_files) > 0:
print(
"Level-4 file found with the current JOANNE version. Therefore not running Level-4 script again."
)
else:
print("Starting Level-4")
import joanne.Level_4.Level_4

print("Level-4 finished")

0 comments on commit 77a89dc

Please sign in to comment.