I am working with some files that I need to do some processing with.
Essentially, these files contain rainfall reports from various
automated rain gauges. These reports are given in 15 minute intervals
and the rainfall is a running total throughout the entire file. What I
need to do is process each of the files such that I have one hourly
reading and the precipitation for that hour. So basically, I need to
subtract the amount at the top of the previous hour from the amount
from the top of the current hour. Any suggestions on how this might be
done? I have taken a basic C course, but this seems to be a little
beyond what I know. Below is a sample of the files I am working with.
20060306,1600,29.61
20060306,1615,29.65
20060306,1630,29.69
20060306,1645,29.73
20060306,1700,29.77
20060306,1715,29.81
20060306,1730,29.81
20060306,1745,29.81
20060306,1800,29.81
20060306,1815,29.81
20060306,1830,29.81
20060306,1845,29.81
20060306,1900,29.81
20060306,1915,29.81
20060306,1930,29.81
20060306,1945,29.81
20060306,2000,29.81
20060306,2015,29.81
20060306,2030,29.81
20060306,2045,29.81
20060306,2100,29.81
20060306,2115,29.81
20060306,2130,29.81
20060306,2145,29.81
20060306,2200,29.81
20060306,2215,29.81
20060306,2230,29.81
20060306,2245,29.81
20060306,2300,29.81
20060306,2315,29.81
20060306,2330,29.81
20060306,2345,29.85
20060307,0000,29.89
Thanks.
Dave 5 2157 dm******@cox.net said:
I am working with some files that I need to do some processing with.
Essentially, these files contain rainfall reports from various
automated rain gauges. These reports are given in 15 minute intervals
and the rainfall is a running total throughout the entire file. What I
need to do is process each of the files such that I have one hourly
reading and the precipitation for that hour. So basically, I need to
subtract the amount at the top of the previous hour from the amount
from the top of the current hour. Any suggestions on how this might be
done? I have taken a basic C course, but this seems to be a little
beyond what I know. Below is a sample of the files I am working with.
20060306,1600,29.61
20060306,1615,29.65
20060306,1630,29.69
20060306,1645,29.73
20060306,1700,29.77
20060306,1715,29.81
20060306,1730,29.81
20060306,1745,29.81
20060306,1800,29.81
Define an array of, say, 32 char - call it data[].
Keep reading and discarding lines until data[11] and data[12] are both '0'.
Now convert characters from 14 onwards into a double, using strtod(data +
14, NULL).
That's startval.
***TOP OF MAIN PROCESSING LOOP***
Keep reading and discarding lines until data[11]
and data[12] are both '0'. (Quit if your read fails.)
Now convert characters from 14 onwards into a double,
using strtod(data + 14, NULL).
That's endval.
Display data[0] through [12] (date and time), and endval - startval
Copy endval to startval
Return to top of main processing loop.
Done.
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999 http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Richard Heathfield wrote:
dm******@cox.net said:
I am working with some files that I need to do some processing with.
Essentially, these files contain rainfall reports from various
automated rain gauges. These reports are given in 15 minute intervals
and the rainfall is a running total throughout the entire file. What I
need to do is process each of the files such that I have one hourly
reading and the precipitation for that hour. So basically, I need to
subtract the amount at the top of the previous hour from the amount
from the top of the current hour. Any suggestions on how this might be
done? I have taken a basic C course, but this seems to be a little
beyond what I know. Below is a sample of the files I am working with.
20060306,1600,29.61
20060306,1615,29.65
20060306,1630,29.69
20060306,1645,29.73
20060306,1700,29.77
20060306,1715,29.81
20060306,1730,29.81
20060306,1745,29.81
20060306,1800,29.81
Define an array of, say, 32 char - call it data[].
Keep reading and discarding lines until data[11] and data[12] are both '0'.
Now convert characters from 14 onwards into a double, using strtod(data +
14, NULL).
That's startval.
***TOP OF MAIN PROCESSING LOOP***
Keep reading and discarding lines until data[11]
and data[12] are both '0'. (Quit if your read fails.)
Now convert characters from 14 onwards into a double,
using strtod(data + 14, NULL).
That's endval.
Display data[0] through [12] (date and time), and endval - startval
Copy endval to startval
Return to top of main processing loop.
Done.
--
Richard Heathfield
"Usenet is a strange place" - dmr 29/7/1999 http://www.cpax.org.uk
email: rjh at above domain (but drop the www, obviously)
Thanks, this is still a little over my head, but I'll give it a shot.
Dave
On 14 Jul 2006 07:44:56 -0700, dm******@cox.net wrote:
>I am working with some files that I need to do some processing with. Essentially, these files contain rainfall reports from various automated rain gauges. These reports are given in 15 minute intervals and the rainfall is a running total throughout the entire file. What I need to do is process each of the files such that I have one hourly reading and the precipitation for that hour. So basically, I need to subtract the amount at the top of the previous hour from the amount from the top of the current hour. Any suggestions on how this might be done? I have taken a basic C course, but this seems to be a little beyond what I know. Below is a sample of the files I am working with.
Read the file till you get to the top of an hour. Save the gauge
value.
Loop until end of file
Read report
If top of hour
Compute and output data for this hour
Save gauge value
Endif
Endloop
> 20060306,1600,29.61 20060306,1615,29.65 20060306,1630,29.69 20060306,1645,29.73 20060306,1700,29.77
snip
Remove del for email dm******@cox.net writes:
[snip]
Thanks, this is still a little over my head, but I'll give it a shot.
Dave
Now *that's* an attitude I'd like to see more of around here.
--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
We must do something. This is something. Therefore, we must do this.
<dm******@cox.netschrieb im Newsbeitrag
news:11**********************@p79g2000cwp.googlegr oups.com...
>I am working with some files that I need to do some processing with.
Essentially, these files contain rainfall reports from various
automated rain gauges. These reports are given in 15 minute intervals
and the rainfall is a running total throughout the entire file. What I
need to do is process each of the files such that I have one hourly
reading and the precipitation for that hour. So basically, I need to
subtract the amount at the top of the previous hour from the amount
from the top of the current hour. Any suggestions on how this might be
done? I have taken a basic C course, but this seems to be a little
beyond what I know. Below is a sample of the files I am working with.
20060306,1600,29.61
Thanks.
Dave
Hi Dave
With awk this is done in one line of script :
awk -F"," "{min=substr($2,2,2); if(min=="00"){printf
"%s,%s,%2.2f\n",o1,o2,$3-o3; o1=$1;o2=$2;03=$3}}" inputfile
It's not tested, because ist late in the evening (here in vienna).
Are You working with MS WIN* or with UNIX or LINUX ?
If you need more information ( how to get awk for your PC, ....)
drop me a line and I will answer your question and complete the script.
Regards
Reinhard
Reinhard dot skarbal at aon dot at This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: ml |
last post by:
My employers currently use Access for processing large volumes of data
for reporting and simple modelling, which involves a lot of make
table/update queries etc.
I have been asked to work on a...
|
by: Shmulik |
last post by:
I have an application written in C# that creates a queue of items to
process, connects via a TCP connection to a server on a Unix box, and
then passes data files to the Unix box for processing...
|
by: bpo_ccs |
last post by:
We are into BPO and Software development business for past six and
half years. We are looking for the following any kind of business
from your end.
Back Office Process
Data Entry, Large Volume...
|
by: Joel Hedlund |
last post by:
Hi!
The question of type checking/enforcing has bothered me for a while, and
since this newsgroup has a wealth of competence subscribed to it, I
figured this would be a great way of learning...
|
by: CedricCicada |
last post by:
Greetings!
Here's my script:
######## start of script
class ScannerCommand:
taskName = ''
scanList =
def __init__(self):
| |
by: Bob Nelson |
last post by:
Does the current ISO standard for the C Programming language mention the
term ``computer'' anywhere in the document? The ``Committee Draft'' dated
January 1999 refers to only to a ``data processing...
|
by: colin |
last post by:
Hi,
Im tidying up some code ive written wich atm is all in the main form.
its working reasonably well, uses zedgraph wich is nice,
but i need to tidy it up as its become increasingly difficult...
|
by: KevinADC |
last post by:
Introduction
In part one we discussed the default sort function. In part two we will discuss more advanced techniques you can use to sort data. Some of the techniques might introduce unfamiliar...
|
by: tavares |
last post by:
(Our apologies for cross-posting.
We appreciate if you kindly distribute this information by your co-
workers and colleagues.)
...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |