Skip to content
Snippets Groups Projects
Commit 2d5c5dbf authored by jacques.grelet_ird.fr's avatar jacques.grelet_ird.fr
Browse files

remove returnCode

parent 06940dab
No related branches found
No related tags found
No related merge requests found
......@@ -17,7 +17,7 @@ def writeNetCDF(fileName, fe):
# create netcdf file
nc = Dataset(fileName, "w", format="NETCDF3_CLASSIC")
logging.debug(' ' + nc.data_model)
print('writing netCDF file: {}'.format(fileName))
# create dimensions
# n is number of profiles, m the max size of profiles
time = nc.createDimension("TIME", fe.n)
......@@ -35,8 +35,8 @@ def writeNetCDF(fileName, fe):
variables.append(k)
# variables.extend(fe.keys())
for key in variables:
# for each variables get the attributes list
hash = r.returnCode(key)
# for each variables get the attributes dictionary from Roscop
hash = r[key]
# _FillValue attribute must be set when variable is created
# (using fill_value keyword to createVariable)
if '_FillValue' in hash:
......@@ -73,3 +73,4 @@ def writeNetCDF(fileName, fe):
# close the netcdf file
nc.close()
print('done...')
......@@ -265,6 +265,6 @@ if __name__ == "__main__":
keys = cfg['split'][device.lower()].keys()
# in command line mode (console)
fe = process(args, cfg, device)
print("Dimensions: {} x {}".format(fe.m, fe.n))
print(fe.disp())
#print("Dimensions: {} x {}".format(fe.m, fe.n))
#print(fe.disp())
netcdf.writeNetCDF( 'output/test.nc', fe)
......@@ -27,7 +27,8 @@ class Roscop:
return 'Class Roscop, file: %s, size = %d' % (self.file, len(self))
def __getitem__(self, key):
''' overload r[key] '''
''' overload r[key]
for a given key return the values as a dictionary '''
if key not in self.__hash:
logging.error(
" Invalid key: \"{}\"".format(key))
......@@ -61,10 +62,6 @@ class Roscop:
print("%s :" % key)
print(self[key])
def returnCode(self, key):
''' for a given key return the values as a dictionary '''
return(self[key])
# read code roscop file
def read(self):
with open(self.file, 'rt') as f:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment