Commit 0b89ddaf authored by Cecilia Nievas's avatar Cecilia Nievas
Browse files

Round to 5 decimal places when creating the OQ input files, function write_OQ_input_file

parent ac22dcc7
......@@ -31,6 +31,8 @@ import h5py
import numpy as np
import GDE_TOOLS_general as gdet_gral
import GDE_TOOLS_world_grid as gdet_grid
import pdb
def verify_paths_are_given(gral_path, hdf5_filename, in_case, distrib_method):
"""
......@@ -436,7 +438,10 @@ def write_OQ_input_file(in_df, filename, cols_order, writemode='w', sep=','):
for i in range(0,in_df.shape[0]):
out_str= []
for colname in cols_order:
out_str.append(str(in_df[colname].values[i]))
if colname.lower()=='lon' or colname.lower()=='lat' or colname.lower()=='longitude' or colname.lower()=='latitude' or colname.lower()=='number' or colname.lower()=='structural' or colname.lower()=='night':
out_str.append('{:.5f}'.format(in_df[colname].values[i]))
else:
out_str.append(str(in_df[colname].values[i]))
out_csv.write(sep.join(out_str)+'\n')
out_csv.close()
......
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