Skip to content

Commit

Permalink
Merge branch 'restructured_workflow' of github.com:aiidaplugins/aiida…
Browse files Browse the repository at this point in the history
…-flexpart into restructured_workflow
  • Loading branch information
Fernandez Vilanova, Lucas committed Jul 24, 2024
2 parents 607a7ff + 3db0b1f commit 71e0509
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
5 changes: 1 addition & 4 deletions aiida_flexpart/data/nc_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ def __init__(self, filepath=None, remote_path=None, g_att=None, nc_dimensions=No
filename = os.path.basename(filepath)
self.set_remote_path(remote_path)
self.set_filename(filename)


self.set_global_attributes(g_att,
nc_dimensions)
self.set_global_attributes(g_att,nc_dimensions)

def set_filename(self, val):
self.base.attributes.set("filename", val)
Expand Down
15 changes: 4 additions & 11 deletions aiida_flexpart/workflows/inspect.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from netCDF4 import Dataset

NetCDF = DataFactory("netcdf.data")
#/project/s1302/shenne/PARIS/obs_for_ELRIS_20240604

def check(nc_file,version):
"""
Expand All @@ -26,12 +25,8 @@ def check(nc_file,version):
return False
return True

def validate_version(nc_file):
if 'history' in nc_file.attributes['global_attributes'].keys():
return 'history'
elif 'created' in nc_file.attributes['global_attributes'].keys():
return 'created'
return None
def validate_history(nc_file):
return True if 'history' in nc_file.attributes['global_attributes'].keys() else None

@calcfunction
def store(remote_dir,file):
Expand All @@ -47,19 +42,17 @@ def store(remote_dir,file):
for a in nc_file.ncattrs():
global_att[a] = repr(nc_file.getncattr(a))

#do check
node = NetCDF(str(temp_path),
remote_path = str(remote_path),
computer = remote_dir.computer,
g_att = global_att,
nc_dimensions = nc_dimensions
)

if validate_version(node) == None:
if validate_history(node) == None:
return
elif check(node,validate_version(node)):
elif check(node,"history"):
return node
return

class InspectWorkflow(WorkChain):
@classmethod
Expand Down

0 comments on commit 71e0509

Please sign in to comment.