From: <mar...@li...> - 2012-02-07 15:31:10
|
Hi, it worked this time! Actually, it's kind of strange, because I had already tried to comma separate the numbers, and the white lines you saw where just due to email formatting. However, apart from using commas, I also tried to cancel the last point, as you suggested. That was automatically inserted by Grass GIS, which I use to handle GIS data. This time the code produced no error related to the .csv file. In the end, this worked: 686007.82,923006.11 686145.11,923006.11 686145.11,923145.11 686003.91,923145.60 Thank you very much for your help! I can now work to the following errors my code produced! Marco On 02/07/2012 04:17 PM, Stephen Roberts wrote: > Maybe > > 686007.82,923006.11 > > 686145.11,923006.11 > > 686145.11,923145.11 > > 686003.91,923145.60 > > causes an error because of the empty lines. Should be > > 686007.82,923006.11 > 686145.11,923006.11 > 686145.11,923145.11 > 686003.91,923145.60 > > Cheers > Steve > > On 8/02/2012 2:15 AM, mar...@li... wrote: >> Hi, thank you for your promptness. >> >> I have tried to run the code varying some format characteristics; >> amongst them I tried to separate the values by commas, like the >> following: >> >> 686007.82,923006.11 >> >> 686145.11,923006.11 >> >> 686145.11,923145.11 >> >> 686003.91,923145.60 >> >> 686007.82,923006.11 >> >> But that just produced a slightly different error message: >> >> File >> "/usr/lib/python2.6/dist-packages/anuga/geometry/polygon.py", line >> 802, in read_polygon >> >> polygon.append([float(fields[0]), float(fields[1])]) >> >> ValueError: empty string for float() >> >> >> The only .csv example I could find on the manual regards a gauge >> location (gauges.csv). I tried to follow those formatting guidelines, >> producing this: >> >> easting,northing,elevation >> >> 686007.82,923006.11,0 >> >> 686145.11,923006.11,0 >> >> 686145.11,923145.11,0 >> >> 686003.91,923145.60,0 >> >> 686007.82,923006.11,0 >> >> but I still get errors: >> >> File >> "/usr/lib/python2.6/dist-packages/anuga/geometry/polygon.py", line >> 802, in read_polygon >> >> polygon.append([float(fields[0]), float(fields[1])]) >> >> ValueError: invalid literal for float(): easting >> >> Thus I am still hanging on it. Any other advice? >> >> Thank you so much, anyway! >> >> Marco >> >> >> >> >> >> >> On 02/07/2012 03:44 PM, Michael Simon wrote: >>> Marco !! >>> >>> Very briefly without checking your case seriously. Sorry, but try >>> this one. >>> >>> You need to create an ASCII-File with "Comma" delimiter. >>> >>> Does it help? >>> >>> Regards >>> >>> Mike >>> -----Ursprüngliche Nachricht----- >>> Von: mar...@li... [mailto:mar...@li...] >>> Gesendet: Dienstag, 7. Februar 2012 14:54 >>> An: anu...@li... >>> Betreff: [Anuga-user] csv formatting issue >>> >>> Hi All, >>> >>> I'm an Anuga User since a few days only, and I'm trying to set up a >>> simple >>> simulation, using real terrain data. >>> At the moment I'm concerned with file formats. I'm using Grass GIS >>> to export >>> my simulation domain boundary as a polygon in csv format, but I get >>> a Python >>> error concerning the way the csv file is formatted. >>> The extent file just contains the following lines (I have erased >>> many pieces >>> of information Grass adds when exporting, but I used to get errors >>> even with >>> the raw exported file): >>> 686007.82 923006.11 >>> 686145.11 923006.11 >>> 686145.11 923145.11 >>> 686003.91 923145.6 >>> 686007.82 923006.11 >>> >>> and this is what I get on terminal: >>> >>> File "/usr/lib/python2.6/dist-packages/anuga/geometry/polygon.py", >>> line 802, in read_polygon >>> polygon.append([float(fields[0]), float(fields[1])]) >>> ValueError: invalid literal for float(): 686007.82 923006.11 >>> >>> I have no experience in Python Programming, but it clearly looks >>> like an >>> issue connected with the way the csv file is formatted (maybe missing >>> headers, separators, ...). >>> >>> Could anyone post the content of a .csv file containing the correct >>> information needed to describe a polygon? >>> Thanks in advance, >>> Marco >>> >>> ---------------------------------------------------------------------------- >>> >>> -- >>> Keep Your Developer Skills Current with LearnDevNow! >>> The most comprehensive online learning library for Microsoft >>> developers is >>> just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, >>> MVC3, Metro >>> Style Apps, more. Free future releases when you subscribe now! >>> http://p.sf.net/sfu/learndevnow-d2d >>> _______________________________________________ >>> Anuga-user mailing list >>> Anu...@li... >>> https://lists.sourceforge.net/lists/listinfo/anuga-user >>> >>> . >>> >> >> ------------------------------------------------------------------------------ >> >> Keep Your Developer Skills Current with LearnDevNow! >> The most comprehensive online learning library for Microsoft developers >> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3, >> Metro Style Apps, more. Free future releases when you subscribe now! >> http://p.sf.net/sfu/learndevnow-d2d >> _______________________________________________ >> Anuga-user mailing list >> Anu...@li... >> https://lists.sourceforge.net/lists/listinfo/anuga-user > > |