Skip to content

Commit

Permalink
Issue #25 fix (#36)
Browse files Browse the repository at this point in the history
* possible fix to issue, requires more testing

* travis build fails due to include path
  • Loading branch information
wcarthur authored Aug 29, 2017
1 parent 33234a8 commit 58dd915
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
4 changes: 2 additions & 2 deletions Utilities/KPDF.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@
***************/

#include "Python.h"
/*#include "Numeric/arrayobject.h"*/
#include "arrayobject.h"
/* #include "numpy/arrayobject.h" */
#include "arrayobject.h"

#include <math.h>
#include <stdlib.h>
Expand Down
6 changes: 2 additions & 4 deletions Utilities/columns.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ def colReadCSV(configFile, dataFile, source):
cols = config.get(source, 'Columns').split(delimiter)

usecols = [i for i, c in enumerate(cols) if c != 'skip']
names = [c for c in cols if c != 'skip']
try:
data = np.genfromtxt(dataFile, dtype=None, delimiter=delimiter,
usecols=usecols, comments=None,
skip_header=numHeadingLines,
usecols=usecols, names=names, skip_header=numHeadingLines,
autostrip=True)
except IOError:
log.exception("File not found: {0}".format(dataFile))
Expand All @@ -50,6 +50,4 @@ def colReadCSV(configFile, dataFile, source):
raise TypeError(("{0} is not a string, filehandle "
"or generator.").format(dataFile))

data.dtype.names = [c for c in cols if c != 'skip']

return data
19 changes: 12 additions & 7 deletions wind/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,7 @@ def dumpGustsFromTracks(self, trackiter, windfieldPath,
for track, result in results:
log.debug("Saving data for track {0:03d}-{1:05d}"\
.format(*track.trackId))
# issue 25 flip the lat axes
gust, bearing, Vx, Vy, P, lon, lat = result

dumpfile = pjoin(windfieldPath,
Expand All @@ -492,7 +493,11 @@ def dumpGustsFromTracks(self, trackiter, windfieldPath,
'gust.{0:03d}-{1:05d}.png'.\
format(*track.trackId))
self.saveGustToFile(track.trackfile,
(lat, lon, gust, Vx, Vy, P),
(np.flipud(lat), lon,
np.flipud(gust),
np.flipud(Vx),
np.flipud(Vy),
np.flipud(P)),
dumpfile)
#self.plotGustToFile((lat, lon, gust, Vx, Vy, P), plotfile)

Expand Down Expand Up @@ -543,7 +548,7 @@ def saveGustToFile(self, trackfile, result, filename):
0: {
'name': 'lat',
'values': lat,
'dtype': 'f',
'dtype': 'float64',
'atts': {
'long_name': 'Latitude',
'standard_name': 'latitude',
Expand All @@ -554,7 +559,7 @@ def saveGustToFile(self, trackfile, result, filename):
1: {
'name': 'lon',
'values': lon,
'dtype': 'f',
'dtype': 'float64',
'atts': {
'long_name': 'Longitude',
'standard_name': 'longitude',
Expand All @@ -569,7 +574,7 @@ def saveGustToFile(self, trackfile, result, filename):
'name': 'vmax',
'dims': ('lat', 'lon'),
'values': speed,
'dtype': 'f',
'dtype': 'float32',
'atts': {
'long_name': 'Maximum 0.2-second gust wind speed',
'standard_name': 'wind_speed_of_gust',
Expand All @@ -585,7 +590,7 @@ def saveGustToFile(self, trackfile, result, filename):
'name': 'ua',
'dims': ('lat', 'lon'),
'values': Vx,
'dtype': 'f',
'dtype': 'float32',
'atts': {
'long_name': 'Eastward component of maximum wind speed',
'standard_name': 'eastward_wind',
Expand All @@ -599,7 +604,7 @@ def saveGustToFile(self, trackfile, result, filename):
'name': 'va',
'dims': ('lat', 'lon'),
'values': Vy,
'dtype': 'f',
'dtype': 'float32',
'atts': {
'long_name': 'Northward component of maximim wind speed',
'standard_name': 'northward_wind',
Expand All @@ -613,7 +618,7 @@ def saveGustToFile(self, trackfile, result, filename):
'name': 'slp',
'dims': ('lat', 'lon'),
'values': P,
'dtype': 'f',
'dtype': 'float32',
'atts': {
'long_name': 'Minimum air pressure at sea level',
'standard_name': 'air_pressure_at_sea_level',
Expand Down

0 comments on commit 58dd915

Please sign in to comment.