Commit 7b22b8ad authored by ARCHER's avatar ARCHER

version attr

parent 3eb6c46f
......@@ -144,7 +144,6 @@ def writeLight(fname,data,date,meta=None):
"""
# version number
names_mapping = OrderedDict([
('owiLon' , 'lon'),
('owiLat' , 'lat'),
......@@ -170,8 +169,15 @@ def writeLight(fname,data,date,meta=None):
('owiElevationAngle' , 'elevation_angle'),
('owiIncidenceAngle' , 'incidence_angle'),
])
# global attrs
global_attrs = [ 'sourceProduct' , 'missionName', 'polarisation', 'footprint','l2ProcessingUtcTime']
# global attrs (None mean no name translation )
global_attrs = OrderedDict([
('sourceProduct' , None ),
('missionName', None ),
('polarisation', 'polarization' ),
('footprint' , None ),
('l2ProcessingUtcTime' , None ),
('owiAlgorithmVersion', 'version' )
])
attrs = ['long_name','units','valid_range','flag_values','flag_meanings']
# overwrite meta
meta_over = {
......@@ -212,10 +218,12 @@ def writeLight(fname,data,date,meta=None):
nc.institution = 'IFREMER/CLS'
nc.reference = 'Mouche Alexis, Chapron Bertrand, Knaff John, Zhao Yuan, Zhang Biao, Combot Clement (2019). Copolarized and Cross‐Polarized SAR Measurements for High‐Resolution Description of Major Hurricane Wind Structures: Application to Irma Category 5 Hurricane. Journal Of Geophysical Research-oceans, 124(6), 3905-3922. https://doi.org/10.1029/2019JC015056'
nc.measurementDate = date.strftime("%Y-%m-%dT%H:%M:%SZ")
#nc.version = "???" # TODO : add version string
for global_attr in global_attrs:
for global_attr in global_attrs.keys():
map_global_attr = global_attrs[global_attr]
if map_global_attr is None:
map_global_attr = global_attr
try:
setattr(nc, global_attr, meta[global_attr])
setattr(nc, map_global_attr, meta[global_attr])
except:
logger.warning('skipping missing attr %s' % global_attr)
time = nc.createVariable('time',np.int32,dimensions=('time')) # np.int32 induce 2038 bug, but is compatible with nc3
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment