Operating environment
Xeon E5-2620 v4 (8 cores) x 2
32GB RAM
CentOS 6.8 (64bit)
openmpi-1.8.x86_64 and its-devel
mpich.x86_64 3.1-5.el6 and its-devel
gcc version 4.4.7 (And gfortran)
NCAR Command Language Version 6.3.0
WRF v3.7.Use 1.
Related bash> Implementation that synthesizes 3 files with variable columns and outputs 3 items on each line> Slow implementation and fast implementation Python implementation.
Reference http://stackoverflow.com/questions/7637957/reading-space-separated-input-in-python
combine_3files_170315.py
#!/usr/bin/env python
with open('out_val_170315') as vfp:
val = vfp.read()
with open('out_lat_170315') as afp:
lat = afp.read()
with open('out_lon_170315') as ofp:
lon = ofp.read()
for elm in zip(val.split(),lat.split(),lon.split()):
print(elm)
Even if I processed it with bash, I felt that Python was easier for the subsequent processing (filtering by latitude / longitude value, etc.), so I changed it to Python.
result
$ python combine_3files_170315.py | head
('0.00', '36.07', '131.17')
('0.00', '36.07', '131.29')
('0.00', '36.07', '131.41')
('0.00', '36.07', '131.53')
('0.00', '36.07', '131.65')
('0.00', '36.07', '131.77')
('0.00', '36.07', '131.89')
('0.00', '36.07', '132.01')
('0.00', '36.07', '132.13')
('0.00', '36.07', '132.25')
Recommended Posts