|
From: Xiangyu L. <lu...@gm...> - 2019-05-25 03:15:01
|
Hi Steve, Yes, after the unicode U+FEFF character was removed, the text file could be used. In addition, by using the command you suggested ( python -c "import anuga; print anuga.get_version()" ), I figured out that the anuga version is " 2.0.2 ". Thank you very much for the help! Best regards, Shawn On Fri, May 24, 2019 at 7:34 PM Stephen Roberts <ste...@an...> wrote: > Hi, > > > By the way, you can determine the anuga version with > > > anuga.get_version() > > > From the command line the following should work > > > python -c "import anuga; print anuga.get_version()" > > > Cheers > > Steve > > > ============================== > Stephen Roberts > Undergraduate Convenor > Mathematical Sciences Institute > Room 4.74 Hanna Neumann Building #145 > The Australian National University > Canberra, ACT 2600 AUSTRALIA > Ph: +61 2 61254445 > CRICOS: 00120C > > ------------------------------ > *From:* Xiangyu Luo <lu...@gm...> > *Sent:* Friday, 24 May 2019 7:38:13 AM > *To:* anu...@li... > *Subject:* [Anuga-user] run-time errors with function ‘timefile2netcdf’ > > Dear AnuGA developers and users, > > If possible, could you please help with a question? Thank you. > > We intended to use the function ‘timefile2netcdf’ to convert text files > (of streamflow data) to netCDF tms files. From the ‘timefile2netcdf’ script > in file_conversion.py, we knew that in text files the time can be in > seconds (time_as_seconds=True) or in date and time (time_as_seconds=False). > We tried both of the two options for time format, and got different > run-time errors. > > ========================= > (1) time_as_seconds=True > ========================= > > The streamflow text file looks like: > > 0,0.066 > 900,0.079 > 1800,0.091 > 2700,0.105 > 3600,0.133 > … … > > The first field is time, the second field is streamflow. > > We got the following error: > --------------------------------- > Traceback (most recent call last): > File "runSpring509_inflow.py", line 154, in <module> > timefile2netcdf(strmflowFile0, quantity_names=["strmflow"], > time_as_seconds=True) > File > "/opt/oscer/software/ANUGA/2.0.2-foss-2016b/lib/python2.7/site-packages/anuga/file_conversion/file_conversion.py", > line 142, in timefile2netcdf > except Error: > NameError: global name 'Error' is not defined > --------------------------------- > > ========================== > (2) time_as_seconds=False > ========================== > > The streamflow text file looks like: > > 26/08/17 00:00:00,0.066 > 26/08/17 00:15:00,0.079 > 26/08/17 00:30:00,0.091 > 26/08/17 00:45:00,0.105 > 26/08/17 01:00:00,0.133 > … … > > The first field is date and time, the second field is streamflow. > > We got the following error: > --------------------------------- > Traceback (most recent call last): > File "runSpring509_inflow.py", line 154, in <module> > timefile2netcdf(strmflowFile0, quantity_names=["strmflow"], > time_as_seconds=False) > File > "/opt/oscer/software/ANUGA/2.0.2-foss-2016b/lib/python2.7/site-packages/anuga/file_conversion/file_conversion.py", > line 138, in timefile2netcdf > raise DataTimeError, msg > DataTimeError: First field in file USGS 08068275 Spring Ck nr > Tomball_0826-0830_datetime.txt must be date-time with format %d/%m/%y > %H:%M:%S. > I got 26/08/17 00:00:00 instead > --------------------------------- > > We already set the time format as [DD/MM/YY hh:mm:ss], but the error > message seems to say the time format is not correct. > > The suggestions and comments will be much appreciated. > > Thank you! > > Best regards, > Shawn > University of Oklahoma > United States > > |