Python trumps FORTRAN

11 views
Skip to first unread message

HRM Resident

unread,
Aug 6, 2022, 2:19:52 PM8/6/22
to
This is mostly for James:

The program weather_trend.py, which you can see
and download via GitHub, is 205 lines in length, minus
comments and blank lines. It could be further reduced to
about 180 lines if the array initialization, etc., was
kept to 1-2 lines, but use 205 as the number of lines for
this comparison. The 92 data files are also available on
the same GitHib repository.

It is a menu driven program that will sort through the 92
input files of climate date, representing 2016 to 2022. These
data are then processed for mean, high and low temperature
and plots with regression lines are generated and stored on
disk in .png format.

It is platform independent. It will run in any Linux
distro, MACs and Windows equally well.

I defy anyone to replicate this capability in FORTRAN
on any platform with *double* the number of lines of code.
In fact, I suspect it would take 1000+ lines of FORTRAN and
one would need a different version of the FORTRAN code for
each platform. This is what it does:

No month selected
1 -- Select Month (Must be specified first, then pick Option 2,3,or 4))
2 -- Mean Temperature
3 -- High Temperature
4 -- Low Temperature
5 -- Exit
Enter your choice: 1
Enter month (1-12)
11
Nov selected
1 -- Select Month (Must be specified first, then pick Option 2,3,or 4))
2 -- Mean Temperature
3 -- High Temperature
4 -- Low Temperature
5 -- Exit
Enter your choice: 2
Mean temperature will be processed


No month selected
1 -- Select Month (Must be specified first, then pick Option 2,3,or 4))
2 -- Mean Temperature
3 -- High Temperature
4 -- Low Temperature
5 -- Exit
Enter your choice: 5
Exiting program with no processing

Note that the plots are shown on the screen and stored
in a directory for future reference.

Replicate this in FORTRAN in 205 lines or less,
Skipper!

--
HRM Resident

James Warren

unread,
Aug 6, 2022, 3:57:05 PM8/6/22
to
Lol. I don't think that would be much of a problem. I have libraries too
which makes the job quite small. I've done more complicated stuff in
fewer lines of code many times. :)

Your Python program kept getting bigger and bigger with every
iteration, not smaller as you predicted.


HRM Resident

unread,
Aug 6, 2022, 4:12:59 PM8/6/22
to
James Warren <jwwar...@gmail.com> wrote:

>>
>>     Replicate this in FORTRAN in 205 lines or less,
>> Skipper!
>>
>
> Lol. I don't think that would be much of a problem. I have libraries too
> which makes the job quite small. I've done more complicated stuff in
> fewer lines of code many times. :)
>
> Your Python program kept getting bigger and bigger with every
> iteration, not smaller as you predicted.
>
>
>

You have access to the data files. Do it.
Talk is cheap!

--
HRM Resident

James Warren

unread,
Aug 6, 2022, 5:59:03 PM8/6/22
to
I solve my own problems, not yours. :)

HRM Resident

unread,
Aug 6, 2022, 8:27:29 PM8/6/22
to
James Warren <jwwar...@gmail.com> wrote:

>>
>> You have access to the data files. Do it.
>> Talk is cheap!
>>
>
> I solve my own problems, not yours. :)
>

As you know, my “problem” is learning to program in
a modern, object oriented language and learn how
to use repositories like GitHub. I could write that in
a day in Pascal, and in a week in FORTRAN.

I *think* I have enough tomorrows left to make
it worth my while. It’s something to do. That’s why
I am doing it. I am not trying to solve global warming!
There are literally thousands far smarter than me
on that quest. :-)

--
HRM Resident

James Warren

unread,
Aug 6, 2022, 10:26:30 PM8/6/22
to
On 2022-08-06 9:27 PM, HRM Resident wrote:
> James Warren <jwwar...@gmail.com> wrote:
>
>>>
>>> You have access to the data files. Do it.
>>> Talk is cheap!
>>>
>>
>> I solve my own problems, not yours. :)
>>
>
> As you know, my “problem” is learning to program in
> a modern, object oriented language and learn how
> to use repositories like GitHub. I could write that in
> a day in Pascal, and in a week in FORTRAN.

A day! It's more like an hour or two. Sheesh. :)

>
> I *think* I have enough tomorrows left to make
> it worth my while. It’s something to do. That’s why
> I am doing it. I am not trying to solve global warming!
> There are literally thousands far smarter than me
> on that quest. :-)
>

Of that we can be sure. :)

Once you get that Python program working download that last 30 years
worth of data for several locations in NS from EC. Then you can be
in business.

HRM Resident

unread,
Aug 7, 2022, 7:01:51 AM8/7/22
to
James Warren <jwwar...@gmail.com> wrote:

>
> Of that we can be sure. :)
>
> Once you get that Python program working download that last 30 years
> worth of data for several locations in NS from EC. Then you can be
> in business.
>


It “works” quite well in terms of what I set as my goal.
The problem is my mentor (not you) seems to not
understand scope creep when it comes to project
management. He keeps adding features and nit
picks. This is a common problem with people who
have an engineering background. Projects never get
finished because they didn’t understand Voltaire’s
quote “Perfection is the enemy of ‘good enough’”

I have a diploma from SMU in project management
(not a degree, just a 9-month, 2-days a week program.)
They drilled that into us. You need to reign in the
engineers. The classic example of this is the “Big Dig”
tunnel is Boston. The project managers let the
engineers run much of it. It’s probably the best
example of something being over budget and vastly
late in completion because the engineers lost sight
of the project goal.

--
HRM Resident

James Warren

unread,
Aug 7, 2022, 8:05:01 AM8/7/22
to
I can agree with this. I mostly leave my programs in
a "sloppy" state because they work and will be used
only a few times - good enough for purpose.

Reply all
Reply to author
Forward
0 new messages