Skip to content

Commit

Permalink
bug regarding writing in netcdf3
Browse files Browse the repository at this point in the history
  • Loading branch information
negin513 committed Jul 20, 2021
1 parent c1b3624 commit e503179
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tools/contrib/modify_singlept_site_neon.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,11 @@ def update_metadata(nc, surf_file, neon_file, zb_flag):
nc.attrs['Updated_from'] = surf_file
nc.attrs['Updated_using'] = neon_file
if zb_flag:
nc.attrs['Updated_fields'] = ['PCT_CLAY','PCT_SAND','ORGANIC','zbedrock']
nc.attrs['Updated_fields'] = "PCT_CLAY, PCT_SAND, ORGANIC, zbedrock"
#nc.attrs['Updated_fields'] = ['PCT_CLAY','PCT_SAND','ORGANIC','zbedrock']
else:
nc.attrs['Updated_fields'] = ['PCT_CLAY','PCT_SAND','ORGANIC']
nc.attrs['Updated_fields'] = "PCT_CLAY, PCT_SAND, ORGANIC"
# nc.attrs['Updated_fields'] = ['PCT_CLAY','PCT_SAND','ORGANIC']

return nc

Expand Down Expand Up @@ -536,7 +538,9 @@ def main():
#-- update netcdf metadata
f2 = update_metadata(f2, surf_file, neon_file,zb_flag)

f2.to_netcdf(path=wfile, mode='w', format='NETCDF3_64BIT')
print (f2.attrs)
f2.to_netcdf(path=wfile, mode='w', format="NETCDF3_64BIT")


print('Successfully updated surface data file for neon site('+site_name+'):\n - '+wfile)

Expand Down

0 comments on commit e503179

Please sign in to comment.