From 21e9a431004105c356123a8be9411b4af76a6103 Mon Sep 17 00:00:00 2001 From: thopri <thopri@noc.ac.uk> Date: Mon, 17 Aug 2020 15:39:48 +0100 Subject: [PATCH] added NCML templace to Tide output --- inputs/namelist_cmems.bdy | 10 +- pynemo/nemo_bdy_extr_tm3.py | 2 +- pynemo/output_NCML/NEMO_tide_U.ncml | 53 ++++++++++ pynemo/output_NCML/NEMO_tide_V.ncml | 53 ++++++++++ pynemo/output_NCML/NEMO_tide_Z.ncml | 53 ++++++++++ pynemo/profile.py | 27 +++-- pynemo/tide/nemo_bdy_tide_ncgen.py | 155 ++++++++++++++++------------ 7 files changed, 269 insertions(+), 84 deletions(-) create mode 100644 pynemo/output_NCML/NEMO_tide_U.ncml create mode 100644 pynemo/output_NCML/NEMO_tide_V.ncml create mode 100644 pynemo/output_NCML/NEMO_tide_Z.ncml diff --git a/inputs/namelist_cmems.bdy b/inputs/namelist_cmems.bdy index 415d4f6..ae34aac 100755 --- a/inputs/namelist_cmems.bdy +++ b/inputs/namelist_cmems.bdy @@ -93,18 +93,18 @@ ln_mask_file = .false. ! =T : read mask from file cn_mask_file = 'mask.nc' ! name of mask file ! (if ln_mask_file=.TRUE.) - ln_dyn2d = .true. ! boundary conditions for + ln_dyn2d = .false. ! boundary conditions for ! barotropic fields - ln_dyn3d = .true. ! boundary conditions for + ln_dyn3d = .false. ! boundary conditions for ! baroclinic velocities - ln_tra = .true. ! boundary conditions for T and S + ln_tra = .false. ! boundary conditions for T and S ln_ice = .false. ! ice boundary condition nn_rimwidth = 9 ! width of the relaxation zone !------------------------------------------------------------------------------ ! unstructured open boundaries tidal parameters !------------------------------------------------------------------------------ - ln_tide = .false. ! =T : produce bdy tidal conditions + ln_tide = .true. ! =T : produce bdy tidal conditions sn_tide_model = 'fes' ! Name of tidal model (fes|tpxo) clname(1) = 'M2' ! constituent name clname(2) = 'S2' @@ -122,7 +122,7 @@ !clname(14) = '2N2' !clname(15) = 'MU2' ln_trans = .false. ! interpolate transport rather than velocities - ln_tide_checker = .true. ! run tide checker on PyNEMO tide output + ln_tide_checker = .false. ! run tide checker on PyNEMO tide output sn_ref_model = 'fes' ! which model to check output against (FES only) !------------------------------------------------------------------------------ ! Time information diff --git a/pynemo/nemo_bdy_extr_tm3.py b/pynemo/nemo_bdy_extr_tm3.py index 034dc0f..ad9a62b 100644 --- a/pynemo/nemo_bdy_extr_tm3.py +++ b/pynemo/nemo_bdy_extr_tm3.py @@ -921,7 +921,7 @@ class Extract: f_out = self.settings['dst_dir']+self.settings['fn']+ \ '_bdy'+self.g_type.upper()+ '_y'+str(year)+'m'+'%02d' % month+'.nc' - ncml_out = glob(self.settings['ncml_out']+'/*'+str(self.g_type.upper())+'.ncml') + ncml_out = glob(self.settings['ncml_out']+'/*'+'output_'+str(self.g_type.upper())+'.ncml') if len(ncml_out) == 0: raise RuntimeError('NCML out file for grid '+str(self.g_type.upper())+' missing, please add into NCML directory') ncml_out = ncml_out[0] diff --git a/pynemo/output_NCML/NEMO_tide_U.ncml b/pynemo/output_NCML/NEMO_tide_U.ncml new file mode 100644 index 0000000..c27e702 --- /dev/null +++ b/pynemo/output_NCML/NEMO_tide_U.ncml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2"> + <dimension name="y" orgName="y" /> + <dimension name="x" orgName="x" /> + <dimension name="yb" orgName="yb" /> + <dimension name="xb" orgName="xb" /> + <dimension name="time_counter" orgName="time_counter" isUnlimited="true" /> + <attribute name="institution" value="National Oceanography Centre, Livepool, U.K." /> + <variable name="bdy_msk" orgName="bdy_msk" shape="y x" type="float"> + <attribute name="short_name" value="bdy_msk" /> + <attribute name="units" value="unitless" /> + <attribute name="long_name" value="Structured boundary mask" /> + </variable> + <variable name="nav_lat" orgName="nav_lat" shape="y x" type="float"> + <attribute name="axis" value="Latitude" /> + <attribute name="short_name" value="nav_lat" /> + <attribute name="units" value="degrees_east" /> + <attribute name="long_name" value="Latitude" /> + </variable> + <variable name="nav_lon" orgName="nav_lon" shape="y x" type="float"> + <attribute name="axis" value="Longitude" /> + <attribute name="short_name" value="nav_lon" /> + <attribute name="units" value="degrees_east" /> + <attribute name="long_name" value="Longitude" /> + </variable> + <variable name="nbidta" orgName="nbidta" shape="yb xb" type="int"> + <attribute name="short_name" value="nbidta" /> + <attribute name="units" value="unitless" /> + <attribute name="long_name" value="Bdy i indices" /> + </variable> + <variable name="nbjdta" orgName="nbjdta" shape="yb xb" type="int"> + <attribute name="short_name" value="nbjdta" /> + <attribute name="units" value="unitless" /> + <attribute name="long_name" value="Bdy j indices" /> + </variable> + <variable name="nbrdta" orgName="nbrdta" shape="yb xb" type="int"> + <attribute name="short_name" value="nbrdta" /> + <attribute name="units" value="unitless" /> + <attribute name="long_name" value="Bdy discrete distance" /> + </variable> + <variable name="u1" orgName="u1" shape="yb xb" type="float"> + <attribute name="units" value="m/s" /> + <attribute name="short_name" value="u1" /> + <attribute name="long_name" value="Tidal east velocity: cosine" /> + <attribute name="grid" value="bdyU" /> + </variable> + <variable name="u2" orgName="u2" shape="yb xb" type="float"> + <attribute name="units" value="m/s" /> + <attribute name="short_name" value="u2" /> + <attribute name="long_name" value="Tidal east velocity: sine" /> + <attribute name="grid" value="bdyU" /> + </variable> +</netcdf> \ No newline at end of file diff --git a/pynemo/output_NCML/NEMO_tide_V.ncml b/pynemo/output_NCML/NEMO_tide_V.ncml new file mode 100644 index 0000000..38dc658 --- /dev/null +++ b/pynemo/output_NCML/NEMO_tide_V.ncml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2"> + <dimension name="y" orgName="y" /> + <dimension name="x" orgName="x" /> + <dimension name="yb" orgName="yb" /> + <dimension name="xb" orgName="xb" /> + <dimension name="time_counter" orgName="time_counter" isUnlimited="true" /> + <attribute name="institution" value="National Oceanography Centre, Livepool, U.K." /> + <variable name="bdy_msk" orgName="bdy_msk" shape="y x" type="float"> + <attribute name="short_name" value="bdy_msk" /> + <attribute name="units" value="unitless" /> + <attribute name="long_name" value="Structured boundary mask" /> + </variable> + <variable name="nav_lat" orgName="nav_lat" shape="y x" type="float"> + <attribute name="axis" value="Latitude" /> + <attribute name="short_name" value="nav_lat" /> + <attribute name="units" value="degrees_east" /> + <attribute name="long_name" value="Latitude" /> + </variable> + <variable name="nav_lon" orgName="nav_lon" shape="y x" type="float"> + <attribute name="axis" value="Longitude" /> + <attribute name="short_name" value="nav_lon" /> + <attribute name="units" value="degrees_east" /> + <attribute name="long_name" value="Longitude" /> + </variable> + <variable name="nbidta" orgName="nbidta" shape="yb xb" type="int"> + <attribute name="short_name" value="nbidta" /> + <attribute name="units" value="unitless" /> + <attribute name="long_name" value="Bdy i indices" /> + </variable> + <variable name="nbjdta" orgName="nbjdta" shape="yb xb" type="int"> + <attribute name="short_name" value="nbjdta" /> + <attribute name="units" value="unitless" /> + <attribute name="long_name" value="Bdy j indices" /> + </variable> + <variable name="nbrdta" orgName="nbrdta" shape="yb xb" type="int"> + <attribute name="short_name" value="nbrdta" /> + <attribute name="units" value="unitless" /> + <attribute name="long_name" value="Bdy discrete distance" /> + </variable> + <variable name="v1" orgName="v1" shape="yb xb" type="float"> + <attribute name="units" value="m/s" /> + <attribute name="short_name" value="v1" /> + <attribute name="long_name" value="Tidal north velocity: cosine" /> + <attribute name="grid" value="bdyV" /> + </variable> + <variable name="v2" orgName="v2" shape="yb xb" type="float"> + <attribute name="units" value="m/s" /> + <attribute name="short_name" value="v2" /> + <attribute name="long_name" value="Tidal north velocity: sine" /> + <attribute name="grid" value="bdyV" /> + </variable> +</netcdf> \ No newline at end of file diff --git a/pynemo/output_NCML/NEMO_tide_Z.ncml b/pynemo/output_NCML/NEMO_tide_Z.ncml new file mode 100644 index 0000000..db96b6c --- /dev/null +++ b/pynemo/output_NCML/NEMO_tide_Z.ncml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8"?> +<netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2"> + <dimension name="y" orgName="y" /> + <dimension name="x" orgName="x" /> + <dimension name="yb" orgName="yb" /> + <dimension name="xb" orgName="xb" /> + <dimension name="time_counter" orgName="time_counter" isUnlimited="true" /> + <attribute name="institution" value="National Oceanography Centre, Livepool, U.K." /> + <variable name="bdy_msk" orgName="bdy_msk" shape="y x" type="float"> + <attribute name="short_name" value="bdy_msk" /> + <attribute name="units" value="unitless" /> + <attribute name="long_name" value="Structured boundary mask" /> + </variable> + <variable name="nav_lat" orgName="nav_lat" shape="y x" type="float"> + <attribute name="axis" value="Latitude" /> + <attribute name="short_name" value="nav_lat" /> + <attribute name="units" value="degrees_east" /> + <attribute name="long_name" value="Latitude" /> + </variable> + <variable name="nav_lon" orgName="nav_lon" shape="y x" type="float"> + <attribute name="axis" value="Longitude" /> + <attribute name="short_name" value="nav_lon" /> + <attribute name="units" value="degrees_east" /> + <attribute name="long_name" value="Longitude" /> + </variable> + <variable name="nbidta" orgName="nbidta" shape="yb xb" type="int"> + <attribute name="short_name" value="nbidta" /> + <attribute name="units" value="unitless" /> + <attribute name="long_name" value="Bdy i indices" /> + </variable> + <variable name="nbjdta" orgName="nbjdta" shape="yb xb" type="int"> + <attribute name="short_name" value="nbjdta" /> + <attribute name="units" value="unitless" /> + <attribute name="long_name" value="Bdy j indices" /> + </variable> + <variable name="nbrdta" orgName="nbrdta" shape="yb xb" type="int"> + <attribute name="short_name" value="nbrdta" /> + <attribute name="units" value="unitless" /> + <attribute name="long_name" value="Bdy discrete distance" /> + </variable> + <variable name="z1" orgName="z1" shape="yb xb" type="float"> + <attribute name="units" value="m" /> + <attribute name="short_name" value="z1" /> + <attribute name="long_name" value="Tidal elevation: cosine" /> + <attribute name="grid" value="bdyT" /> + </variable> + <variable name="z2" orgName="z2" shape="yb xb" type="float"> + <attribute name="units" value="m" /> + <attribute name="short_name" value="z2" /> + <attribute name="long_name" value="Tidal elevation: sine" /> + <attribute name="grid" value="bdyT" /> + </variable> +</netcdf> \ No newline at end of file diff --git a/pynemo/profile.py b/pynemo/profile.py index 3d0d9e5..49a49ad 100644 --- a/pynemo/profile.py +++ b/pynemo/profile.py @@ -37,6 +37,7 @@ import numpy as np from PyQt5.QtWidgets import QMessageBox from calendar import monthrange import sys +from glob import glob #Local imports @@ -650,30 +651,36 @@ def write_tidal_data(setup_var, dst_coord_var, grid, tide_cons, cons): setup_var.settings['fn']+ \ '_bdytide_'+const_name+'_grd_'+ \ val['nam'].upper()+'.nc' - + + ncml_out = glob(setup_var.settings['ncml_out'] + '/*' + 'tide_'+str(val['nam'].upper()) + '.ncml') + if len(ncml_out) == 0: + raise RuntimeError( + 'NCML out tide file for grid ' + str(val['nam'].upper()) + ' missing, please add into NCML directory') + ncml_out = ncml_out[0] + nemo_bdy_tide_ncgen.CreateBDYTideNetcdfFile(fout_tide, val['nx'], dst_coord_var.lonlat['t']['lon'].shape[1], dst_coord_var.lonlat['t']['lon'].shape[0], val['des']+tide_con, - setup_var.settings['fv'], key.upper()) + setup_var.settings['fv'], key.upper(),ncml_out) ncpop.write_data_to_file(fout_tide, val['nam']+'1', - cons['cos'][val['nam']][indx]) + cons['cos'][val['nam']][indx],ncml_out) ncpop.write_data_to_file(fout_tide, val['nam']+'2', - cons['sin'][val['nam']][indx]) + cons['sin'][val['nam']][indx],ncml_out) ncpop.write_data_to_file(fout_tide, 'bdy_msk', - dst_coord_var.bdy_msk) + dst_coord_var.bdy_msk,ncml_out) ncpop.write_data_to_file(fout_tide, 'nav_lon', - dst_coord_var.lonlat['t']['lon']) + dst_coord_var.lonlat['t']['lon'],ncml_out) ncpop.write_data_to_file(fout_tide, 'nav_lat', - dst_coord_var.lonlat['t']['lat']) + dst_coord_var.lonlat['t']['lat'],ncml_out) ncpop.write_data_to_file(fout_tide, 'nbidta', - grid[key].bdy_i[val['ind'], 0]+1) + grid[key].bdy_i[val['ind'], 0]+1,ncml_out) ncpop.write_data_to_file(fout_tide, 'nbjdta', - grid[key].bdy_i[val['ind'], 1]+1) + grid[key].bdy_i[val['ind'], 1]+1,ncml_out) ncpop.write_data_to_file(fout_tide, 'nbrdta', - grid[key].bdy_r[val['ind']]+1) + grid[key].bdy_r[val['ind']]+1,ncml_out) # Iterate over constituents diff --git a/pynemo/tide/nemo_bdy_tide_ncgen.py b/pynemo/tide/nemo_bdy_tide_ncgen.py index f6701f3..9a832b5 100644 --- a/pynemo/tide/nemo_bdy_tide_ncgen.py +++ b/pynemo/tide/nemo_bdy_tide_ncgen.py @@ -7,8 +7,9 @@ Creates Tide netcdf file ready for population from netCDF4 import Dataset import datetime import logging +from pynemo import nemo_ncml_parse as ncml_parse -def CreateBDYTideNetcdfFile(filename, N,I,J,h,fv,grd): +def CreateBDYTideNetcdfFile(filename, N,I,J,h,fv,grd,ncml_out): gridNames = ['T', 'U', 'V'] # Dimension Lengths @@ -21,106 +22,124 @@ def CreateBDYTideNetcdfFile(filename, N,I,J,h,fv,grd): ncid = Dataset(filename, 'w', clobber=True, format='NETCDF4') #define dimensions - dimxbID = ncid.createDimension('xb',xb_len) - dimybID = ncid.createDimension('yb',yb_len) - dimxID = ncid.createDimension('x', x_len) - dimyID = ncid.createDimension('y', y_len) + xb = ncml_parse.dst_dims(ncml_out, 'xb') + dimxbID = ncid.createDimension(xb,xb_len) + yb = ncml_parse.dst_dims(ncml_out, 'yb') + dimybID = ncid.createDimension(yb,yb_len) + x = ncml_parse.dst_dims(ncml_out, 'x') + dimxID = ncid.createDimension(x, x_len) + y = ncml_parse.dst_dims(ncml_out, 'y') + dimyID = ncid.createDimension(y, y_len) + + #define variable + lon_var = ncml_parse.dst_var(ncml_out, 'nav_lon') + varlonID = ncid.createVariable(lon_var['name'], lon_var['type'], (lon_var['shape'][0], lon_var['shape'][1], )) + lat_var = ncml_parse.dst_var(ncml_out, 'nav_lat') + varlatID = ncid.createVariable(lat_var['name'], lat_var['type'], (lat_var['shape'][0], lat_var['shape'][1], )) - #define variable - varlonID = ncid.createVariable('nav_lon','f4',('y','x',)) - varlatID = ncid.createVariable('nav_lat','f4',('y','x',)) - - if grd =='T': - varmskID = ncid.createVariable('bdy_msk','f4',('y','x',),fill_value=fv) - varz1ID = ncid.createVariable('z1','f4',('yb','xb',),fill_value=fv) - varz2ID = ncid.createVariable('z2','f4',('yb','xb',),fill_value=fv) + bdy_msk = ncml_parse.dst_var(ncml_out, 'bdy_msk') + varmskID = ncid.createVariable(bdy_msk['name'], bdy_msk['type'], (bdy_msk['shape'][0], bdy_msk['shape'][1],),fill_value=fv) + z1 = ncml_parse.dst_var(ncml_out,'z1') + varz1ID = ncid.createVariable(z1['name'],z1['type'],(z1['shape'][0],z1['shape'][1],),fill_value=fv) + z2 = ncml_parse.dst_var(ncml_out,'z2') + varz2ID = ncid.createVariable(z2['name'],z2['type'],(z2['shape'][0],z2['shape'][1],),fill_value=fv) + elif grd == 'U': - varmskID = ncid.createVariable('bdy_msk', 'f4', ('y', 'x',), fill_value=fv) - varu1ID = ncid.createVariable('u1','f4',('yb','xb',),fill_value=fv) - varu2ID = ncid.createVariable('u2','f4',('yb','xb',),fill_value=fv) + bdy_msk = ncml_parse.dst_var(ncml_out, 'bdy_msk') + varmskID = ncid.createVariable(bdy_msk['name'], bdy_msk['type'], (bdy_msk['shape'][0], bdy_msk['shape'][1],),fill_value=fv) + u1 = ncml_parse.dst_var(ncml_out,'u1') + varu1ID = ncid.createVariable(u1['name'],u1['type'],(u1['shape'][0],u1['shape'][1],),fill_value=fv) + u2 = ncml_parse.dst_var(ncml_out,'u2') + varu2ID = ncid.createVariable(u2['name'],u2['type'],(u2['shape'][0],u2['shape'][1],),fill_value=fv) elif grd == 'V': - varmskID = ncid.createVariable('bdy_msk', 'f4', ('y', 'x',), fill_value=fv) - varv1ID = ncid.createVariable('v1','f4',('yb','xb',),fill_value=fv) - varv2ID = ncid.createVariable('v2','f4',('yb','xb',),fill_value=fv) + bdy_msk = ncml_parse.dst_var(ncml_out, 'bdy_msk') + varmskID = ncid.createVariable(bdy_msk['name'], bdy_msk['type'], (bdy_msk['shape'][0], bdy_msk['shape'][1],),fill_value=fv) + v1 = ncml_parse.dst_var(ncml_out,'v1') + varv1ID = ncid.createVariable(v1['name'],v1['type'],(v1['shape'][0],v1['shape'][1],),fill_value=fv) + v2 = ncml_parse.dst_var(ncml_out,'v2') + varv2ID = ncid.createVariable(v2['name'],v2['type'],(v2['shape'][0],v2['shape'][1],),fill_value=fv) else : logging.error("Unknown Grid input") - varnbiID = ncid.createVariable('nbidta','i4',('yb','xb',)) - varnbjID = ncid.createVariable('nbjdta','i4',('yb','xb',)) - varnbrID = ncid.createVariable('nbrdta','i4',('yb','xb',)) + nbidta = ncml_parse.dst_var(ncml_out,'nbidta') + varnbiID = ncid.createVariable(nbidta['name'], nbidta['type'], (nbidta['shape'][0], nbidta['shape'][1], )) + nbjdta = ncml_parse.dst_var(ncml_out,'nbjdta') + varnbjID = ncid.createVariable(nbjdta['name'], nbjdta['type'], (nbjdta['shape'][0], nbjdta['shape'][1], )) + nbrdta = ncml_parse.dst_var(ncml_out, 'nbrdta') + varnbrID = ncid.createVariable(nbrdta['name'], nbrdta['type'], (nbrdta['shape'][0], nbrdta['shape'][1], )) #Global Attributes ncid.file_name = filename ncid.creation_date = str(datetime.datetime.now()) ncid.history = h - ncid.institution = 'National Oceanography Centre, Livepool, U.K.' + ncid.institution = ncml_parse.dst_glob_attrib(ncml_out,'institution') #Longitude axis attributes - varlonID.axis = 'Longitude' - varlonID.short_name = 'nav_lon' - varlonID.units = 'degrees_east' - varlonID.long_name = 'Longitude' + varlonID.axis = ncml_parse.dst_var_attrib(ncml_out,lon_var['name'],'axis') + varlonID.short_name = ncml_parse.dst_var_attrib(ncml_out,lon_var['name'],'short_name') + varlonID.units = ncml_parse.dst_var_attrib(ncml_out,lon_var['name'],'units') + varlonID.long_name = ncml_parse.dst_var_attrib(ncml_out,lon_var['name'],'long_name') #Latitude axis attributes - varlatID.axis = 'Latitude' - varlatID.short_name = 'nav_lat' - varlatID.units = 'degrees_east' - varlatID.long_name = 'Latitude' + varlatID.axis = ncml_parse.dst_var_attrib(ncml_out,lat_var['name'],'axis') + varlatID.short_name = ncml_parse.dst_var_attrib(ncml_out,lat_var['name'],'short_name') + varlatID.units = ncml_parse.dst_var_attrib(ncml_out,lat_var['name'],'units') + varlatID.long_name = ncml_parse.dst_var_attrib(ncml_out,lat_var['name'],'long_name') #nbidta attributes - varnbiID.short_name = 'nbidta' - varnbiID.units = 'unitless' - varnbiID.long_name = 'Bdy i indices' + varnbiID.short_name = ncml_parse.dst_var_attrib(ncml_out,nbidta['name'],'short_name') + varnbiID.units = ncml_parse.dst_var_attrib(ncml_out,nbidta['name'],'units') + varnbiID.long_name = ncml_parse.dst_var_attrib(ncml_out,nbidta['name'],'long_name') #nbjdta attributes - varnbjID.short_name = 'nbjdta' - varnbjID.units = 'unitless' - varnbjID.long_name = 'Bdy j indices' + varnbjID.short_name = ncml_parse.dst_var_attrib(ncml_out,nbjdta['name'],'short_name') + varnbjID.units = ncml_parse.dst_var_attrib(ncml_out,nbjdta['name'],'units') + varnbjID.long_name = ncml_parse.dst_var_attrib(ncml_out,nbjdta['name'],'long_name') #nbrdta attributes - varnbrID.short_name = 'nbrdta' - varnbrID.units = 'unitless' - varnbrID.long_name = 'Bdy discrete distance' + varnbrID.short_name = ncml_parse.dst_var_attrib(ncml_out,nbrdta['name'],'short_name') + varnbrID.units = ncml_parse.dst_var_attrib(ncml_out,nbrdta['name'],'units') + varnbrID.long_name = ncml_parse.dst_var_attrib(ncml_out,nbrdta['name'],'long_name') + if grd == 'T' : - - varmskID.short_name = 'bdy_msk' - varmskID.units = 'unitless' - varmskID.long_name = 'Structured boundary mask' + varmskID.short_name = ncml_parse.dst_var_attrib(ncml_out,varmskID.name,'short_name') + varmskID.units = ncml_parse.dst_var_attrib(ncml_out,varmskID.name,'units') + varmskID.long_name = ncml_parse.dst_var_attrib(ncml_out,varmskID.name,'long_name') - varz1ID.units = 'm' - varz1ID.short_name = 'z1' - varz1ID.long_name = 'tidal elevation: cosine' - varz1ID.grid = 'bdyT' + varz1ID.units = ncml_parse.dst_var_attrib(ncml_out,varz1ID.name,'units') + varz1ID.short_name = ncml_parse.dst_var_attrib(ncml_out,varz1ID.name,'short_name') + varz1ID.long_name = ncml_parse.dst_var_attrib(ncml_out,varz1ID.name,'long_name') + varz1ID.grid = ncml_parse.dst_var_attrib(ncml_out,varz1ID.name,'grid') - varz2ID.units = 'm' - varz2ID.short_name = 'z2' - varz2ID.long_name = 'tidal elevation: sine' - varz2ID.grid = 'bdyT' + varz2ID.units = ncml_parse.dst_var_attrib(ncml_out,varz2ID.name,'units') + varz2ID.short_name = ncml_parse.dst_var_attrib(ncml_out,varz2ID.name,'short_name') + varz2ID.long_name = ncml_parse.dst_var_attrib(ncml_out,varz2ID.name,'long_name') + varz2ID.grid = ncml_parse.dst_var_attrib(ncml_out,varz2ID.name,'grid') elif grd == 'U' : - varu1ID.units = 'm/s' - varu1ID.short_name = 'u1' - varu1ID.long_name = 'tidal east velocity: cosine' - varu1ID.grid = 'bdyU' + varu1ID.units = ncml_parse.dst_var_attrib(ncml_out,varu1ID.name,'units') + varu1ID.short_name = ncml_parse.dst_var_attrib(ncml_out,varu1ID.name,'short_name') + varu1ID.long_name = ncml_parse.dst_var_attrib(ncml_out,varu1ID.name,'long_name') + varu1ID.grid = ncml_parse.dst_var_attrib(ncml_out,varu1ID.name,'grid') - varu2ID.units = 'm/s' - varu2ID.short_name = 'u2' - varu2ID.long_name = 'tidal east velocity: sine' - varu2ID.grid = 'bdyU' + varu2ID.units = ncml_parse.dst_var_attrib(ncml_out,varu2ID.name,'units') + varu2ID.short_name = ncml_parse.dst_var_attrib(ncml_out,varu2ID.name,'short_name') + varu2ID.long_name = ncml_parse.dst_var_attrib(ncml_out,varu2ID.name,'long_name') + varu2ID.grid = ncml_parse.dst_var_attrib(ncml_out,varu2ID.name,'grid') elif grd == 'V': - varv1ID.units = 'm/s' - varv1ID.short_name = 'v1' - varv1ID.long_name = 'tidal north velocity: cosine' - varv1ID.grid = 'bdyV' + varv1ID.units = ncml_parse.dst_var_attrib(ncml_out,varv1ID.name,'units') + varv1ID.short_name = ncml_parse.dst_var_attrib(ncml_out,varv1ID.name,'short_name') + varv1ID.long_name = ncml_parse.dst_var_attrib(ncml_out,varv1ID.name,'long_name') + varv1ID.grid = ncml_parse.dst_var_attrib(ncml_out,varv1ID.name,'grid') - varv2ID.units = 'm/s' - varv2ID.short_name = 'v2' - varv2ID.long_name = 'tidal north velocity: sine' - varv2ID.grid = 'bdyV' + varv2ID.units = ncml_parse.dst_var_attrib(ncml_out,varv2ID.name,'units') + varv2ID.short_name = ncml_parse.dst_var_attrib(ncml_out,varv2ID.name,'short_name') + varv2ID.long_name = ncml_parse.dst_var_attrib(ncml_out,varv2ID.name,'long_name') + varv2ID.grid = ncml_parse.dst_var_attrib(ncml_out,varv2ID.name,'grid') else : logging.error('Unknown Grid') -- GitLab