Skip to content
Snippets Groups Projects
Commit 79377696 authored by jacques Grelet's avatar jacques Grelet
Browse files

don't work

parent 2226f6ca
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,7 @@ PRLF;int32;profile number;;1;;;;;;%4d;99999;;;Station number, a station could be ...@@ -4,7 +4,7 @@ PRLF;int32;profile number;;1;;;;;;%4d;99999;;;Station number, a station could be
PROFILE;int32;profile number;;1;;;;;;%4d;99999;;;Station number, a station could be have more than one cast;;;;; PROFILE;int32;profile number;;1;;;;;;%4d;99999;;;Station number, a station could be have more than one cast;;;;;
LATITUDE;float32;latitude of measurement;latitude;degrees_north;;;;;;;;Y;;;;;;WGS84;urn:ogc:crs:EPSG::4326 LATITUDE;float32;latitude of measurement;latitude;degrees_north;;;;;;;;Y;;;;;;WGS84;urn:ogc:crs:EPSG::4326
LONGITUDE;float32;longitude of measurement;longitude;degrees_east;;;;;;;;X;;;;;;WGS84;urn:ogc:crs:EPSG::4327 LONGITUDE;float32;longitude of measurement;longitude;degrees_east;;;;;;;;X;;;;;;WGS84;urn:ogc:crs:EPSG::4327
TIME;float64;time of measurement;time;days since 1950-01-01T00:00:00Z;Relative julian days with decimal part (as parts of the day);;;0;90000;%6.6d;;T;;;;;;; TIME;float64;time of measurement;time;days since 1950-01-01T00:00:00Z;Relative julian days with decimal part (as parts of the day);;;0.0;90000.0;%6.6f;;T;;;;;;;
ETDD;float32;ellapsed time;;1;;;;0;90000;%9.5f;;;;;;;;; ETDD;float32;ellapsed time;;1;;;;0;90000;%9.5f;;;;;;;;;
DEPH;float32;depth of measurement;depth;meter;;;down;0;9000;%7.2f;1E+36;Z;;;;;;;urn:ogc:crs:EPSG::5831 DEPH;float32;depth of measurement;depth;meter;;;down;0;9000;%7.2f;1E+36;Z;;;;;;;urn:ogc:crs:EPSG::5831
DEPTH;float32;depth of measurement;depth;meter;;;down;0;9000;%7.2f;1E+36;Z;;;;;;;urn:ogc:crs:EPSG::5831 DEPTH;float32;depth of measurement;depth;meter;;;down;0;9000;%7.2f;1E+36;Z;;;;;;;urn:ogc:crs:EPSG::5831
......
...@@ -7,8 +7,10 @@ from physicalParameter import Roscop ...@@ -7,8 +7,10 @@ from physicalParameter import Roscop
def writeNetCDF(fileName, fe): def writeNetCDF(fileName, fe):
data = {} data = {}
dims = ['TIME', 'LATITUDE', 'LONGITUDE', 'DEPTH'] dims = ['TIME', 'LATITUDE', 'LONGITUDE']
vars = dims.copy() variables = dims.copy()
dims_4d = dims.copy()
dims_4d = dims_4d.append('DEPTH')
# move to main after tests # move to main after tests
r = Roscop("code_roscop.csv") r = Roscop("code_roscop.csv")
...@@ -30,8 +32,10 @@ def writeNetCDF(fileName, fe): ...@@ -30,8 +32,10 @@ def writeNetCDF(fileName, fe):
# create variables # create variables
# add dimensions before variables list # add dimensions before variables list
for k in fe.keys: for k in fe.keys:
vars.append(k) variables.append(k)
for key in vars: # variables.extend(fe.keys())
print(variables)
for key in variables:
# for each variables get the attributes list # for each variables get the attributes list
hash = r.returnCode(key) hash = r.returnCode(key)
# _FillValue attribute must be set when variable is created # _FillValue attribute must be set when variable is created
...@@ -43,8 +47,13 @@ def writeNetCDF(fileName, fe): ...@@ -43,8 +47,13 @@ def writeNetCDF(fileName, fe):
else: else:
fillvalue = None fillvalue = None
# create the variable # create the variable
data[key] = nc.createVariable( print(key)
key, dtype(hash['types']).char, dims, fill_value=fillvalue) if any(key in item for item in dims):
data[key] = nc.createVariable(
key, dtype(hash['types']).char, (key,), fill_value=fillvalue)
else:
data[key] = nc.createVariable(
key, dtype(hash['types']).char, dims_4d, fill_value=fillvalue)
# remove from the dictionary # remove from the dictionary
hash.pop('types') hash.pop('types')
# create dynamically variable attributes # create dynamically variable attributes
...@@ -52,5 +61,5 @@ def writeNetCDF(fileName, fe): ...@@ -52,5 +61,5 @@ def writeNetCDF(fileName, fe):
setattr(data[key], k, hash[k]) setattr(data[key], k, hash[k])
# debug # debug
for key in vars: for key in variables:
print(data[key]) print(data[key])
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