Re: [Matplotlib-users] open ascii grid data and plot

2012-03-25 Thread questions anon
excellent, thanks, that worked and was able to plot using matplotlib without ending up with the logical_or error. thanks everyone On Thu, Mar 22, 2012 at 3:59 AM, Goyo wrote: > El día 21 de marzo de 2012 01:03, questions anon > > > f=np.genfromtxt(inputfile, skip_header=6, dtype=None, names=True

Re: [Matplotlib-users] open ascii grid data and plot

2012-03-21 Thread Goyo
El día 21 de marzo de 2012 01:03, questions anon > f=np.genfromtxt(inputfile, skip_header=6, dtype=None, names=True) I don't think you should be using dtype=None if you wand a 2D array. Also the names=True thing makes no sense to me since there isn't a row with field names. Try just this and I gu

Re: [Matplotlib-users] open ascii grid data and plot

2012-03-20 Thread questions anon
thanks for all of your responses. I agree with Benjamin that I have two issues, and firstly I need to figure out importing the text to a 2d array before plotting. I can take this question elsewhere but will run it by you first: My problem seems to be that when I use np.genfromtxt it imports my 2d a

Re: [Matplotlib-users] open ascii grid data and plot

2012-03-20 Thread Benjamin Root
On Mon, Mar 19, 2012 at 5:28 PM, questions anon wrote: > So when I add "np.logical_or" to the beginning of the script it makes no > difference to the error message that I receive. > > I have tried reshaping the array but I receive an error message of: > Traceback (most recent call last): > File

Re: [Matplotlib-users] open ascii grid data and plot

2012-03-19 Thread questions anon
So when I add "np.logical_or" to the beginning of the script it makes no difference to the error message that I receive. I have tried reshaping the array but I receive an error message of: Traceback (most recent call last): File "", line 1, in f.reshape(691,886) ValueError: total size of ne

Re: [Matplotlib-users] open ascii grid data and plot

2012-03-15 Thread Goyo
El día 15 de marzo de 2012 05:14, questions anon escribió: > I think my error is from the np.genfromtxt because I just checked the size > of my data and it appears in 1D rather than 2D. This is unsurprising since your file has just one row of data. I overlooked that because the weird error messag

Re: [Matplotlib-users] open ascii grid data and plot

2012-03-14 Thread questions anon
I think my error is from the np.genfromtxt because I just checked the size of my data and it appears in 1D rather than 2D. if I try taking out 'skip_header' I end up with this error: Traceback (most recent call last): File "d:\BoMdata\plotrainfall.py", line 63, in f=np.genfromtxt(inputfile,

Re: [Matplotlib-users] open ascii grid data and plot

2012-03-14 Thread questions anon
Thanks for responding. It is 'sort of' good to know that it can't be explained as I just thought it was my incompetency! I tried the np rather than N but that made no differences. thanks again On Thu, Mar 15, 2012 at 7:48 AM, Benjamin Root wrote: > > > On Tue, Mar 13, 2012 at 4:23 PM, questions

Re: [Matplotlib-users] open ascii grid data and plot

2012-03-14 Thread Benjamin Root
On Tue, Mar 13, 2012 at 4:23 PM, questions anon wrote: > also I have tried running it on a different computer and the same error > occurred > > > On Wed, Mar 14, 2012 at 8:22 AM, questions anon > wrote: > >> thanks for looking into this Goyo. >> The complete code: >> >> >> import numpy as N >> im

Re: [Matplotlib-users] open ascii grid data and plot

2012-03-13 Thread questions anon
also I have tried running it on a different computer and the same error occurred On Wed, Mar 14, 2012 at 8:22 AM, questions anon wrote: > thanks for looking into this Goyo. > The complete code: > > > import numpy as N > import matplotlib.pyplot as plt > from numpy import ma as MA > from mpl_toolk

Re: [Matplotlib-users] open ascii grid data and plot

2012-03-13 Thread questions anon
thanks for looking into this Goyo. The complete code: import numpy as N import matplotlib.pyplot as plt from numpy import ma as MA from mpl_toolkits.basemap import Basemap import os shapefile="E:/GIS_layers/DSE_REGIONS" inputfile=r"d:/BoMdata/r19000117.txt" outputfolder=r"d:/BoMdata/outputfolder"

Re: [Matplotlib-users] open ascii grid data and plot

2012-03-13 Thread Goyo
El día 12 de marzo de 2012 23:25, questions anon escribió: [...] > > Is this how the data should look when it has been imported from an ascii to > a numpy array? I can't see anything obiously wrong in your code or your data --I did not dive too deep into it though. What is weird is the traceback:

Re: [Matplotlib-users] open ascii grid data and plot

2012-03-12 Thread questions anon
Thanks for responding. I do think the error is with how I prepare the data (importing as a numpy array) because I have used matplotlib a million time with no problems. Maybe I should be taking this question elsewhere about importing the data but thought I would add some more info. The data in the t

Re: [Matplotlib-users] open ascii grid data and plot

2012-03-08 Thread Benjamin Root
On Wednesday, March 7, 2012, questions anon wrote: > Hi all, > I am still having a problem with the same code. I am not sure if maybe the problem is how I read the data in as numpy.genfromtxt > Is there a step I need to take to convert the data to numpy array to then read into matplotlib? Sorry f

Re: [Matplotlib-users] open ascii grid data and plot

2012-03-08 Thread Paul Hobson
In my GIS experience, rasters don't have prj files. That's something that seems to be pretty specific to ESRI shapefiles. Point is, I don't think that's going to help you. All of the basemap examples use netcdf files. I think your path of least resistance right now is to figure out how to convert

Re: [Matplotlib-users] open ascii grid data and plot

2012-03-07 Thread questions anon
Hi all, I am still having a problem with the same code. I am not sure if maybe the problem is how I read the data in as numpy.genfromtxt Is there a step I need to take to convert the data to numpy array to then read into matplotlib? Thanks On Fri, Mar 2, 2012 at 11:49 AM, questions anon wrote: >

Re: [Matplotlib-users] open ascii grid data and plot

2012-03-01 Thread questions anon
python, numpy through enthought - Python 2.7.2 |EPD 7.1-1 (32-bit)| (default, Jul 3 2011, 15:13:59) [MSC v.1500 32 bit (Intel)] on win32 imports at the top of the script: import numpy as N import matplotlib.pyplot as plt from numpy import ma as MA from mpl_toolkits.basemap import Basemap import o

Re: [Matplotlib-users] open ascii grid data and plot

2012-03-01 Thread Jean-Baptiste Marquette
Le 29 févr. 2012 à 23:29, questions anon a écrit : > I have a txt file (with an associated prj file) containing gridded weather > data. > Firstly how can I open this file and convert it to a numpy array? You should have a look on ATpy package : http://atpy.github.com/ Cheers JB

Re: [Matplotlib-users] open ascii grid data and plot

2012-02-29 Thread Benjamin Root
On Wednesday, February 29, 2012, questions anon wrote: > I have had some progress reading in the data but am unsure how to create > lats and lons from the info I have (see above). > the error I am receiving is: > > Traceback (most recent call last): > File "d:\plotrainfall.py", line 40, in >

Re: [Matplotlib-users] open ascii grid data and plot

2012-02-29 Thread questions anon
I have had some progress reading in the data but am unsure how to create lats and lons from the info I have (see above). the error I am receiving is: Traceback (most recent call last): File "d:\plotrainfall.py", line 40, in CS = map.contourf(x,y, f, 15,cmap=plt.cm.jet) File "C:\Python27\l

[Matplotlib-users] open ascii grid data and plot

2012-02-29 Thread questions anon
I have a txt file (with an associated prj file) containing gridded weather data. Firstly how can I open this file and convert it to a numpy array? and then how to plot in matplotlib, paticularly how to use the lat, lon and nrows,ncols. ncols=886 nrows=691 longitude west=111.975, east=156.275 latitu