SlideServe
Menu
Préférences
© SlideServe · v2026

Understanding the "IF" Statement in Meteorology: A Dive into 3D Counter Usage

sileas avatar
11 diapositives · 242 Views · Jul 26, 2014

This article delves into the practical application of the "IF" statement in meteorological programming using Fortran. It outlines the use of counters I, J, and K to define spatial dimensions (west-east, north-south, up-down) essential for meteorological calculations. The discussion includes how loops are structured in Fortran 77, highlighting the significance of statement labels, which were critical in earlier programming practices. By detailing computations in 3D space through nested loops, this work aims to bridge the gap between traditional methods and modern programming.

Understanding the "IF" Statement in Meteorology: A Dive into 3D Counter Usage - slide 1
01 / 11Understanding the "IF" Statement in Meteorology: A Dive into 3D Counter Usage
1 / 17

Télécharger la présentation

Understanding the "IF" Statement in Meteorology: A Dive into 3D Counter Usage
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. MET 50 A bit more on… Repetitive EXECUTION

  2. The “IF” statement In Meteorology, it is common to use the letters I,J,K to denote counters. “I” is the counter to tell us where we are west  east “J” is the counter to tell us where we are north  south “K” is the counter to tell us where we are up  down MET 50, FALL 2011, CHAPTER 4 PART 2

  3. The “IF” statement I=1 could be Greenwich I=2 would be east of Greenwich (say 100 km east) I=3 would be 100 km further east etc. I=IMAX would be west of Greenwich (say 100 km west) J=1 could be the south pole J=2 would be north of the south pole (say 100 km north) J=3 would be 100 km further north etc. J=JMAX would be the north pole K=1 could be the ground K=2 would be above that (say 1 km above) K=3 would be 1 km further up etc. K=KMAX could be the top of atmosphere MET 50, FALL 2011, CHAPTER 4 PART 2

  4. The “IF” statement And then, you would see loops like this: DO I = 1, IMAX DO J = 1, JMAX DO K = 1, KMAX (important meteorological calculations) ENDDO ENDDO ENDDO MET 50, FALL 2011, CHAPTER 4 PART 2

  5. The “IF” statement How does this look in “old” Fortran 77 code??? DO 10 I = 1, IMAX (important meteorological calculations) 10 CONTINUE MET 50, FALL 2011, CHAPTER 4 PART 2

  6. The “IF” statement How does this look in “old” Fortran 77 code??? DO 10 I = 1, IMAX (important meteorological calculations) 10 CONTINUE Here, “10” is a statement label – something which has mostly vanished in Fortran 90. A statement label can have any integer value from 1 to 9999. MET 50, FALL 2011, CHAPTER 4 PART 2

  7. The “IF” statement Statement label goes in columns 2-5. Why??? Because we used to use cards, and columns 1-6 on the cards were special! MET 50, FALL 2011, CHAPTER 4 PART 2

  8. The “IF” statement History lesson…cards… MET 50, FALL 2011, CHAPTER 4 PART 2

  9. The “IF” statement DO 10 I = 1, IMAX (important meteorological calculations) 10 CONTINUE So this says: Starting @ 1st line, and going until I = IMAX (same as Fortran 90) Perform the computations inside the loop. Once I = IMAX, don’t loop back – instead, “continue” on from statement # 10. MET 50, FALL 2011, CHAPTER 4 PART 2

  10. The “IF” statement In 3D? DO 10 I = 1, IMAX DO 20 J = 1, JMAX DO 30 K = 1, KMAX (important meteorological calculations) 30 CONTINUE 20 CONTINUE 10 CONTINUE MET 50, FALL 2011, CHAPTER 4 PART 2

  11. The “IF” statement Where… DO 10 I = 1, IMAX DO 20 J = 1, JMAX DO 30 K = 1, KMAX (important meteorological calculations) 30 CONTINUE 20 CONTINUE 10 CONTINUE column 7+ etc. etc. MET 50, FALL 2011, CHAPTER 4 PART 2