Batch (cron) script to automatically download HYCOM using Matlab

581 views
Skip to first unread message

ezeebop

unread,
Aug 29, 2013, 7:23:33 PM8/29/13
to HYCOM.org Forum
My apologies if this is not the correct email address for this post. If not, the moderator is free to move it.
A couple of months ago I wrote a batch (cron) script (cronjob.txt) for linux that runs a shell script (HYCOM_download.sh) that runs a Matlab script (HYCOM_download.m) every night to download the latest HYCOM data for my area. Actually, because the data is often unavailable, the Matlab script goes through all dates starting some time in the past and checks that all past data was downloaded. This system seems to have worked properly for the past couple of months.
Anyway, some time before writing these scripts I asked on the forum if anyone had already done it, and nobody raised their hand, so I am going to provide them in case anyone else finds them useful. Your feedback is welcome. Please bear in mind that I am not modifying them for general use - it is up to you to do that for your own application. They are just a guide, to maybe save someone a little time.
I only ask that you be sure to change the email address in cronjob.txt, so that I don't get notified of your job completion!
Good luck
-- John Luick
 
cronjob.txt
HYCOM_download.sh
HYCOM_download.m

Michael McDonald

unread,
Sep 3, 2013, 12:40:15 PM9/3/13
to ezeebop, HYCOM.org Forum
John,

Thanks for posting this for others to use/reference. I am going through your code and noticed a few missing dependencies not included which seem to be necessary for others to get this code operational.

1. Is there anything special being done in the "startup" matlab script you have in your home directory (/home/luickj01)? if so, then including this file would be beneficial.

2. Looks like the "LatLonTopo.mat" file is needed to run your code, otherwise it stops/bails. 

 82 fnRegional=[Pdir 'GLBa0pt08/' region '/LatLonTopo.mat'];
 83 fnGlobal=[Pdir 'GLBa0pt08/Global/LatLonTopo.mat'];

Please reply to this forum thread and include these attachments.

/mike





--
--
You received this message because you are a member of HYCOM.org
To ask a question, send an email to fo...@hycom.org
 

To unsubscribe from this group and stop receiving emails from it, send an email to forum+un...@hycom.org.

John Luick

unread,
Sep 4, 2013, 6:28:23 PM9/4/13
to fo...@hycom.org
Hi Mike,

this is my second attempt at a reply to your response. My original reply about the missing LatLonTopo.mat file seems to have disappeared without getting posted. Maybe because the file was attached and it was 99 Mbytes?
It is probably just as well because I really need to take time to create more robust and less individualised scripts (get rid of "startup" etc.) suitable for others to easily adapt. Will work on that today.
Meanwhile can you tell me if there is a handy way to make a 99 MByte file available to others via the HYCOM forum?    

John

John Luick

unread,
Sep 4, 2013, 10:59:41 PM9/4/13
to fo...@hycom.org
Please use the files in cronjob.zip instead of the ones I sent previously. As Michael pointed out they had some dependencies, and besides these zipped versions are much simplified.
Sorry I didn't do it in the first place, just rushed for time and I have learned my lesson as it would have been quicker to do it properly in the first place.
You still need a 99 Mbyte file called LatLonTopo.mat which I THOUGHT was successfully sent to the HYCOM Forum via a Google Drive, but I can't find it there now.
If someone tells me how to post a big file on the Forum then I will add LatLonTopo.mat. Meanwhile if someone wants it, they can email me at ezeebop (at) gmail.com and I will explain how to download it.
John
p.s. to the moderator: if possible please delete the individual files I posted before.


On Friday, 30 August 2013 08:53:33 UTC+9:30, John Luick wrote:
cronjob.zip

yongs...@gmail.com

unread,
Jan 8, 2014, 11:37:32 AM1/8/14
to fo...@hycom.org
 
I can't download the file. any one can help me? Thanks

John Luick

unread,
Jan 8, 2014, 4:22:10 PM1/8/14
to fo...@hycom.org
You may be looking at the 30 August post. Have a look at the 5 September post. There you will see cronjob.zip. If you have trouble with that let me know. John.

John Luick

unread,
Jan 19, 2014, 9:35:08 PM1/19/14
to fo...@hycom.org
The version of HYCOM_download_function.m in the cronjob.zip file I posted on 5 September will not work for 2014. I have added a revised version of HYCOM_download_function.m which works. (All I did was replace all the instances (except those in comments) of "2013" with "' YY '" - it may be easier for users to simply do that themselves, to their own functions, if they have modified them. Note, that is double-quote single-quote space YY space single-quote double-quote.

There was a recent question about whether scripts still run with the new updated THREDDS server. Whatever the changes are, they don't seem to bother this script.

By the way some people are apparently finding these scripts handy for downloading even if they don't use cron.

John
cronjob.zip

c.e.r.b...@gmail.com

unread,
Mar 8, 2016, 8:05:04 AM3/8/16
to HYCOM.org Forum
Hi John, 

I am looking for a script to download HYCOM data... I know this is an older post and at the time of your last message this script was still valid. Is it still? 
If so I would love to give it a try - can you tell me how to down load the LatLonTopo.mat file?

Thank you kindly, 
Charlene
Reply all
Reply to author
Forward
0 new messages