|
From: Stephen R. <ste...@an...> - 2019-05-24 06:53:14
|
Hi Shawn,
I had a look at your problem.
There was a bug in the file_conversion.py script associated with
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
which I have fixed up. (Just in the process of updating the anuga version on github).
But I couldn't replicate the second problem. i cut and pasted your data
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
and had no problem. Might be worth sending me your text file and I'll see if there is something strange in the file causing the problem.
By the way which version of anuga are you using and on what type of machine.
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
|