<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.wiki.mohid.com/index.php?action=history&amp;feed=atom&amp;title=Mercator_Automatic_Data_Acquisition</id>
		<title>Mercator Automatic Data Acquisition - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://www.wiki.mohid.com/index.php?action=history&amp;feed=atom&amp;title=Mercator_Automatic_Data_Acquisition"/>
		<link rel="alternate" type="text/html" href="http://www.wiki.mohid.com/index.php?title=Mercator_Automatic_Data_Acquisition&amp;action=history"/>
		<updated>2026-04-04T21:18:04Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.28.0</generator>

	<entry>
		<id>http://www.wiki.mohid.com/index.php?title=Mercator_Automatic_Data_Acquisition&amp;diff=489&amp;oldid=prev</id>
		<title>Guillaume: 1 revision</title>
		<link rel="alternate" type="text/html" href="http://www.wiki.mohid.com/index.php?title=Mercator_Automatic_Data_Acquisition&amp;diff=489&amp;oldid=prev"/>
				<updated>2008-12-03T10:27:16Z</updated>
		
		<summary type="html">&lt;p&gt;1 revision&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style='vertical-align: top;' lang='en'&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan='1' style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 10:27, 3 December 2008&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan='2' style='text-align: center;' lang='en'&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Guillaume</name></author>	</entry>

	<entry>
		<id>http://www.wiki.mohid.com/index.php?title=Mercator_Automatic_Data_Acquisition&amp;diff=488&amp;oldid=prev</id>
		<title>192.168.20.111 at 14:28, 27 October 2006</title>
		<link rel="alternate" type="text/html" href="http://www.wiki.mohid.com/index.php?title=Mercator_Automatic_Data_Acquisition&amp;diff=488&amp;oldid=prev"/>
				<updated>2006-10-27T14:28:05Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;This article describes the automatic data acquisition system built to get large-scale circulation model gridded data from Mercator-Océan ftp server. [[Automatic Data Interpolation|Another article]] is written to describe the interpolation automated task for a given model.&lt;br /&gt;
&lt;br /&gt;
==Objective==&lt;br /&gt;
Every week Mercator-Océan releases a set of 63 netcdf gzipped files to their ftp site in a timestamped folder. The goal is to get these files, store them in the local network and perform data manipulation on them.&lt;br /&gt;
&lt;br /&gt;
The catch is that sometimes some files are missing at the ftp site, sometimes the connection breaks down for some reason. Hence the data acquisition system must be &amp;quot;intelligent&amp;quot; to &amp;quot;know&amp;quot; when he has fetched all the files and when he must try again a new ftp connection to fetch the missing files.&lt;br /&gt;
&lt;br /&gt;
==Technological base==&lt;br /&gt;
Perl and shell scripting, using ftp and smtp perl modules. Mohid tools to convert from netcdf to HDF5, and to interpolate. Scheduler or crontab to agend the task weekly.&lt;br /&gt;
&lt;br /&gt;
==Control flow diagram==&lt;br /&gt;
[[Image:perl_proj.jpg|center|450px|thumb|Control Flow Diagram: Yellow boxes are perl programs or shell commands, purple boxes are input/output files, blue triangles are flow control elements, dark edges show the program flow, white edges show the input/output from/to files and white losangle edges show appending output to files.]]&lt;br /&gt;
Aside is the control flow diagram and below is&lt;br /&gt;
the full batch file describing all the operations:&lt;br /&gt;
 REM CalcDate.bat&lt;br /&gt;
 :CALC&lt;br /&gt;
 perl CalculateCurrentDate.pl &amp;gt; _date.tmp&lt;br /&gt;
 IF %ERRORLEVEL% NEQ 0 GOTO CALC&lt;br /&gt;
 IF ERRORLEVEL 0 GOTO CREATE&lt;br /&gt;
 &lt;br /&gt;
 REM ftp_get.bat&lt;br /&gt;
 :CREATE&lt;br /&gt;
 more &amp;lt; _date.tmp | perl Create_ftp_address.pl &amp;gt; _ftp_address.tmp&lt;br /&gt;
 IF %ERRORLEVEL% NEQ 0 GOTO CREATE&lt;br /&gt;
 IF ERRORLEVEL 0 GOTO GET&lt;br /&gt;
 &lt;br /&gt;
 :GET&lt;br /&gt;
 more &amp;lt; _ftp_address.tmp | perl ftp_get.pl&lt;br /&gt;
 IF %ERRORLEVEL% NEQ 0 GOTO CREATE&lt;br /&gt;
 IF ERRORLEVEL 0 GOTO CHECKFILES&lt;br /&gt;
 &lt;br /&gt;
 :CHECKFILES&lt;br /&gt;
 more &amp;lt; _ftp_address.tmp &amp;gt; _Extract.tmp&lt;br /&gt;
 echo (ist_meteog-mercatorPsy2v2r1v_R\d{8})&amp;gt;&amp;gt; _Extract.tmp&lt;br /&gt;
 &lt;br /&gt;
 more &amp;lt; _Extract.tmp | perl ExtractPattern.pl  &amp;gt; _Count.tmp&lt;br /&gt;
 echo .nc.gz&amp;gt;&amp;gt; _Count.tmp&lt;br /&gt;
 &lt;br /&gt;
 more &amp;lt; _Count.tmp | perl CountFiles.pl | Checkfiles.pl&lt;br /&gt;
 IF %ERRORLEVEL% NEQ 0 GOTO CREATE&lt;br /&gt;
 IF ERRORLEVEL 0 GOTO CONVERT&lt;br /&gt;
 &lt;br /&gt;
 REM convert.bat&lt;br /&gt;
 :CONVERT&lt;br /&gt;
 more &amp;lt; _date.tmp | perl Convert.pl&lt;br /&gt;
 IF %ERRORLEVEL% NEQ 0 GOTO CONVERT&lt;br /&gt;
 IF ERRORLEVEL 0 GOTO CHECK&lt;br /&gt;
 &lt;br /&gt;
 REM interpol.bat&lt;br /&gt;
 REM Still misses ...&lt;br /&gt;
 &lt;br /&gt;
 REM check.bat&lt;br /&gt;
 :CHECK&lt;br /&gt;
 more &amp;lt; _date.tmp | perl check.pl&lt;br /&gt;
 IF %ERRORLEVEL% NEQ 0 GOTO BAD&lt;br /&gt;
 IF ERRORLEVEL 0 GOTO GOOD&lt;br /&gt;
 &lt;br /&gt;
 :BAD&lt;br /&gt;
 more mail_Bad.txt | perl smtp.pl&lt;br /&gt;
 GOTO END&lt;br /&gt;
 &lt;br /&gt;
 :GOOD&lt;br /&gt;
 more mail_Ok.txt | perl smtp.pl&lt;br /&gt;
 GOTO END &lt;br /&gt;
 &lt;br /&gt;
 :END&lt;br /&gt;
 del *.tmp&lt;br /&gt;
The command names are pretty self-explaining. The perl files are best described at their [http://www.mohid.com/hydrogroup/codecomments.xml repository] where the [[Code Comment Method|commented code]] is published. Some care was taken so most of the little perl programs could be re-used generically.&lt;br /&gt;
&lt;br /&gt;
==Comments==&lt;br /&gt;
===20061025===&lt;br /&gt;
This week two new problems rose:&lt;br /&gt;
#3 intruder files were in the ftp download folder. This makes a number of 66 downloaded instead of 63. Thus the automatic data acquisition system ends up looping endlessly until 63 arrives.&lt;br /&gt;
#The other problem is that when the ftp connection fails, the program re-hooks the ftp and continues to download the next non-existent file. The problem is that a zero bytes files exists and isn't downloaded again.&lt;br /&gt;
&lt;br /&gt;
The solutions are:&lt;br /&gt;
#Give in the ftp address file a regexp pattern for the ftp-get program to match, so it will download only the wanted files.&lt;br /&gt;
#Check, besides the existence of the file, its size also. If zero bytes then download.&lt;br /&gt;
&lt;br /&gt;
[[Category:Technology]]&lt;br /&gt;
[[Category:Operational Modeling]]&lt;br /&gt;
[[Category:Mercator]]&lt;/div&gt;</summary>
		<author><name>192.168.20.111</name></author>	</entry>

	</feed>
<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
  ga('create', 'UA-56589921-5', 'auto');
  ga('send', 'pageview');
</script>