473,564 Members | 2,759 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Data processing

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,2 9.61
20060306,1615,2 9.65
20060306,1630,2 9.69
20060306,1645,2 9.73
20060306,1700,2 9.77
20060306,1715,2 9.81
20060306,1730,2 9.81
20060306,1745,2 9.81
20060306,1800,2 9.81
20060306,1815,2 9.81
20060306,1830,2 9.81
20060306,1845,2 9.81
20060306,1900,2 9.81
20060306,1915,2 9.81
20060306,1930,2 9.81
20060306,1945,2 9.81
20060306,2000,2 9.81
20060306,2015,2 9.81
20060306,2030,2 9.81
20060306,2045,2 9.81
20060306,2100,2 9.81
20060306,2115,2 9.81
20060306,2130,2 9.81
20060306,2145,2 9.81
20060306,2200,2 9.81
20060306,2215,2 9.81
20060306,2230,2 9.81
20060306,2245,2 9.81
20060306,2300,2 9.81
20060306,2315,2 9.81
20060306,2330,2 9.81
20060306,2345,2 9.85
20060307,0000,2 9.89

Thanks.
Dave

Jul 14 '06 #1
5 2164
dm******@cox.ne t 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,2 9.61
20060306,1615,2 9.65
20060306,1630,2 9.69
20060306,1645,2 9.73
20060306,1700,2 9.77
20060306,1715,2 9.81
20060306,1730,2 9.81
20060306,1745,2 9.81
20060306,1800,2 9.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)
Jul 14 '06 #2

Richard Heathfield wrote:
dm******@cox.ne t 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,2 9.61
20060306,1615,2 9.65
20060306,1630,2 9.69
20060306,1645,2 9.73
20060306,1700,2 9.77
20060306,1715,2 9.81
20060306,1730,2 9.81
20060306,1745,2 9.81
20060306,1800,2 9.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

Jul 14 '06 #3
On 14 Jul 2006 07:44:56 -0700, dm******@cox.ne t 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
Jul 14 '06 #4
dm******@cox.ne t 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_Keit h) 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.
Jul 14 '06 #5

<dm******@cox.n etschrieb im Newsbeitrag
news:11******** **************@ p79g2000cwp.goo glegroups.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,2 9.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"){p rintf
"%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
Jul 14 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
1633
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 retail forecasting model, but looking at the spec. the base data tables have approximately 6 million records. I know this can theoretically be done...
3
2752
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 (cluster) - normally this works fine. However, on the front end, another Unix system generates and transfers files to the DotNet application...
0
1762
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 Data Processing, Data Conversion, Forms Processing, Process flow & Quality Data Entry Text, Numeric or Alphanumeric entry, Printed or Handwritten...
18
2731
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 from the experts. I feel there's a tradeoff between clear, easily readdable and extensible code on one side, and safe code providing early errors and...
8
1241
by: CedricCicada | last post by:
Greetings! Here's my script: ######## start of script class ScannerCommand: taskName = '' scanList = def __init__(self):
14
1707
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 system''. To what extent can the ``*abstract* machine'' be just that and nothing more?
2
1917
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 to work with. although very fluent in C++ etc, im still geting to grips with c#, and I think theres probably a better way to do what im trying todo...
1
7175
KevinADC
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 methods or syntax to a less experienced perl coder. I will post links to online resources you can read if necessary. Experienced perl coders might find...
0
2005
by: tavares | last post by:
(Our apologies for cross-posting. We appreciate if you kindly distribute this information by your co- workers and colleagues.) *************************************************************************** Symposium “Image Processing and Data Visualization” 2nd South-East European Conference on Computational Mechanics (SEECCM 2009) Island...
0
8106
jinu1996
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7642
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7950
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6255
agi2029
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5213
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3643
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2082
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 we have to send another system
1
1200
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.