1 00:00:00,880 --> 00:00:06,080 Hello and welcome back to the second video  about GROOPS. In this video I want to show   2 00:00:06,080 --> 00:00:10,480 you the workflow of creating a  script: how do you add programs,   3 00:00:11,280 --> 00:00:15,200 how do you get data from one program to the  next and so on. In the end you will have   4 00:00:15,200 --> 00:00:22,960 a script that does multiple things to achieve  some goal you want. For this example, we want to   5 00:00:22,960 --> 00:00:30,400 do a small specific task. We want to simulate  an orbit for a low Earth orbiting satellite.   6 00:00:31,600 --> 00:00:37,360 We then want to visualize the tidal  accelerations acting on the satellite   7 00:00:38,320 --> 00:00:44,080 throughout its orbit and we want to plot this  in a map. So it's a relatively simple task,   8 00:00:44,080 --> 00:00:49,760 which can be done with a few programs in  GROOPS. I've already created a script file here,   9 00:00:51,120 --> 00:00:56,800 it's empty for now except for some global  variables, which are part of our template.   10 00:00:58,640 --> 00:01:03,040 And, yeah, so let's start. First of all we  want to add a program. You can just hit the   11 00:01:03,040 --> 00:01:07,600 "Add" button here and select one. The first  program we want to add is "SimulateOrbit".   12 00:01:08,880 --> 00:01:16,240 We have a filter here, so we type in  "simulate" and we get "SimulateOrbit".   13 00:01:16,240 --> 00:01:23,120 So this is our first program. Our program has  several settings or input and output fields.   14 00:01:24,800 --> 00:01:30,960 Here, everything marked with a red star indicates  that this is a must-set field. Everything else   15 00:01:30,960 --> 00:01:36,640 is optional to some degree or another. Some  of them have default values, others do not.   16 00:01:38,080 --> 00:01:45,040 But "outputfileOrbit" is a must-set value so  we need to provide a file where the output is   17 00:01:45,040 --> 00:01:54,400 written to. So the principle of GROOPS and GROOPS  programs is that programs possibly read data but   18 00:01:54,400 --> 00:01:59,280 they'll usually always write data to some file and  the next program then can read this data. So let's   19 00:01:59,280 --> 00:02:08,080 start with writing our orbit. We just write it  into a file called "orbit.txt" in the folder where   20 00:02:08,080 --> 00:02:16,320 the script is located. "inputfileSatelliteModel":  This is a model of the satellite, which describes   21 00:02:16,320 --> 00:02:22,720 its mass and geometry and so on. So as you can  see here, the "groopsDataDir" variable is used   22 00:02:23,520 --> 00:02:29,360 in the curly braces – and curly braces,  I'll talk about this more in the next video   23 00:02:30,800 --> 00:02:36,080 – this variable will be replaced by  the global variable "groopsDataDir".   24 00:02:37,520 --> 00:02:44,000 So I can select any satellite model. For this  video let's just use the one from GRACE-1.   25 00:02:45,360 --> 00:02:50,320 And, as you can see, in the path the beginning is  still replaced by the "groopsDataDir" variable.   26 00:02:52,000 --> 00:02:57,680 Next, we need a time series, so we need to provide  the epochs for which the orbit is simulated. As   27 00:02:57,680 --> 00:03:03,760 you can see here, this is both mandatory  and there are ellipses here. This means I   28 00:03:04,640 --> 00:03:13,280 could provide multiple fields. So "timeSeries":  We have several options to choose from. If we   29 00:03:13,280 --> 00:03:20,160 want a "uniformSampling", "uniformInterval", if we  want a "yearly" time series or whatever, or from   30 00:03:20,160 --> 00:03:24,400 an instrument file. We will stick with a  uniform sampling. We will say "timeStart":   31 00:03:25,200 --> 00:03:32,160 Here we can choose our global variables,  "timeStart" and "timeEnd". We haven't set them yet   32 00:03:32,160 --> 00:03:42,800 but we can do it, so let's say we want to simulate  our orbit for 2020-01-01 and for "timeEnd" let's   33 00:03:42,800 --> 00:03:47,520 say we want to do one day. We could enter the  date again but what we can also do is just select   34 00:03:47,520 --> 00:03:54,880 "timeStart" and add +1. The time fields are always  given in modified Julian date (MJD), so it's in   35 00:03:56,240 --> 00:04:05,600 float days. We can just select "timeStart+1"  and GROOPS will know that this "timeStart" is   36 00:04:05,600 --> 00:04:11,040 the global variable "timeStart". As you can  see, in the GUI the date already gets parsed, so   37 00:04:12,800 --> 00:04:19,520 we know it is correct. And as you can see here,  where we link to these global variables, also   38 00:04:19,520 --> 00:04:24,720 the dates are already correct. For the sampling  let's say we want to do a one-minute sampling.   39 00:04:26,880 --> 00:04:34,960 Here, "sampling" is also in days. This  is why it is entered as 1/1440. Okay,   40 00:04:34,960 --> 00:04:41,120 so we could add another "timeSeries", but this is  fine. We want to use these epochs. So this class   41 00:04:41,120 --> 00:04:46,080 "timeSeries" will create epochs from "timeStart"  to "timeEnd" with a one-minute sampling.   42 00:04:47,520 --> 00:04:55,760 Okay, "integrationConstants": We can use Kepler  parameters or "positionAndVelocity". Let's stick   43 00:04:55,760 --> 00:05:05,440 with "kepler". Let's say we want to have a  semi-major axis of around 7 000 kilometers,   44 00:05:05,440 --> 00:05:12,960 so about 700 kilometers above Earth's surface.  "eccentricity": Let's say 0. "inclination":   45 00:05:12,960 --> 00:05:18,400 let's say 85 degrees. And for the purpose of  this video, everything else: Let's set it to 0.   46 00:05:20,640 --> 00:05:26,880 But, of course, you could specify  whatever you need here. Okay, next,   47 00:05:26,880 --> 00:05:31,760 "orbitPropagator": We'll just stick with  "polynomial". There are several others:   48 00:05:31,760 --> 00:05:37,040 "euler", "rungeKutta" and so on. Let's stick  with the default one. Same with Earth rotation,   49 00:05:37,040 --> 00:05:43,840 there the default EOP rapid time series from  the IERS is selected. We are fine with that.   50 00:05:45,920 --> 00:05:53,760 "ephemerides": also fine with JPL. What we then  finally need to provide are our forces that act   51 00:05:53,760 --> 00:05:59,360 on the satellite. First of all, we need a gravity  field. So we can select "potentialCoefficients",   52 00:06:00,960 --> 00:06:09,200 and let's use the GOCO06s gravity field. It's just  a .gfc file which you can download, for example,   53 00:06:09,200 --> 00:06:15,440 from ICGEM. "maxDegree": Let's set it to 60.  So this is the spherical harmonics degree.   54 00:06:16,640 --> 00:06:26,880 For this example it doesn't really matter.  Let's keep it like that. For "tides": Let's add   55 00:06:28,240 --> 00:06:32,800 "astronomicalTides", so from planets and  so on. Let's add "earthTide". The default   56 00:06:32,800 --> 00:06:41,040 settings are fine in this case. And let's also  add "doodsonHarmonicTide", so ocean tides. As   57 00:06:41,040 --> 00:06:47,840 you can see, by default, for ocean tides FES2014b  is already selected. We are fine with that,   58 00:06:49,040 --> 00:06:55,520 we just stick to the default settings. And what  we also going to add are "miscAccelerations",   59 00:06:56,160 --> 00:07:01,920 in this case "solarRadiationPressure". This is  why we need the satellite mode,l which describes   60 00:07:01,920 --> 00:07:06,480 the surfaces of the satellite and their optical  properties, because we want to also simulate   61 00:07:07,360 --> 00:07:10,560 "miscAccelerations" in this example,  so solar radiation pressure.   62 00:07:11,360 --> 00:07:18,320 Here, all the settings are fine as well. Okay,  so this is the first program. This program will   63 00:07:18,320 --> 00:07:23,520 integrate an orbit based on the settings we chose  and it will write the output to "orbit.txt".   64 00:07:24,960 --> 00:07:29,840 Next, what we also need is  the attitude of the satellite. 65 00:07:33,520 --> 00:07:41,600 We can use a program called "SimulateStarCamera"  to simulate a basic star camera which observes   66 00:07:41,600 --> 00:07:46,160 the attitude. And this program just needs as an  input file an orbit file and as an output file...   67 00:07:47,680 --> 00:07:53,840 let's call the output file "starCamera.txt".  So it will take each epoch from this orbit   68 00:07:53,840 --> 00:07:57,840 and compute the associated star camera file. 69 00:07:59,920 --> 00:08:05,680 As you can see here in the description, the  axes of this body frame, which is simulated,   70 00:08:05,680 --> 00:08:11,360 are x = along track, y = cross track, and z  in the radial direction. We're fine with that.   71 00:08:11,360 --> 00:08:15,360 Maybe a different satellite needs a different  system, but in this case we're fine with that.   72 00:08:17,120 --> 00:08:27,680 Next, let's stimulate an accelerometer. So this  is what we wanted to do. We want to visualize   73 00:08:27,680 --> 00:08:37,040 the tidal accelerations acting on our satellite.  So we, again, need an output file, let's call it   74 00:08:37,040 --> 00:08:41,360 "accelerometer.txt". We need, again, a satellite  model. It should be the same as here, so we can   75 00:08:41,360 --> 00:08:47,760 just copy-paste it. We need an "inputfileOrbit":  We can use our orbit. We need the star camera.   76 00:08:48,560 --> 00:08:53,040 We can also provide here "earthRotation" and,  again, it's fine. "ephemerides" are again fine.   77 00:08:53,040 --> 00:09:00,400 And for the "forces": This is now which forces do  we want to simulate, only for this accelerometer.   78 00:09:00,400 --> 00:09:08,240 Here we can just use the ocean tides because we're  only interested in visualizing the ocean tides.   79 00:09:11,040 --> 00:09:15,920 In this case, we will only copy the ocean tides,  the "doodsonHarmonicTide" element from above.   80 00:09:17,600 --> 00:09:20,640 And, yeah, that's it, So  this program will generate   81 00:09:20,640 --> 00:09:26,800 or will simulate accelerometer measurements  from tidal accelerations for the orbit   82 00:09:27,840 --> 00:09:30,640 we simulated using the star camera we simulated. 83 00:09:33,280 --> 00:09:39,840 Now we have all the data we need. We just need  to visualize it, and we want to do it in a map   84 00:09:40,960 --> 00:09:44,960 in the form of a ground track. So we can  use the program "Orbit2GroundTracks",   85 00:09:49,040 --> 00:09:55,920 which does exactly what it says. It needs an  "inputfileOrbit": Let's, again, copy it from here.   86 00:09:57,280 --> 00:10:06,320 And it outputs a gridded data file. So it converts  data to a grid, which we can plot on a map. Let's   87 00:10:06,320 --> 00:10:14,160 just call it "grid.txt". Earth rotation, again,  is fine. So this program, like this, it only   88 00:10:15,120 --> 00:10:23,040 converts the orbit to a ground track. But since  we also want to visualize our accelerometer data,   89 00:10:23,040 --> 00:10:28,000 we can add an additional "inputfileInstrument".  You can see here, this is an optional file   90 00:10:28,000 --> 00:10:34,720 and it has the ellipses, so we can add one or more  files. So I can add this. We could add additional   91 00:10:34,720 --> 00:10:39,840 files. And the values from this accelerometer  file are going to get appended to the grid file.   92 00:10:40,560 --> 00:10:53,840 So it adds the columns from this file to this grid  file. Okay, so far so good. The last program is   93 00:10:54,880 --> 00:11:03,760 "PlotMap". We want to visualize our data  on a map. Let's call it "groundtrack.png". 94 00:11:05,280 --> 00:11:09,840 We will skip the title and now we can set  different "layers" here. First of all,   95 00:11:10,800 --> 00:11:19,280 so we have a reference, let's add a "coast" layer  so we can see, in the background, the continents.   96 00:11:19,280 --> 00:11:27,440 I don't particularly like lines, I prefer  to have a colored ocean. We can say   97 00:11:30,000 --> 00:11:34,080 the ocean should have the color light  blue. "landColor": We will skip it. It will   98 00:11:34,080 --> 00:11:40,400 be white or transparent. So this is our background  layer and then we can add a different layer. This   99 00:11:40,400 --> 00:11:44,960 is the same principle as any graphics program,  like Photoshop and so on. You just add layers   100 00:11:44,960 --> 00:11:53,600 and they will get visualized on top of each  other. Our next layer: We want to visualize   101 00:11:54,320 --> 00:12:01,120 our ground tracks. In this case we want to  use the layer "points". We have one position   102 00:12:01,840 --> 00:12:07,920 each minute, so we will visualize them  as points. As you can see here, we need   103 00:12:07,920 --> 00:12:12,400 an "inputfileGriddedData", which is the one we  created here, you know, with "Orbit2GroundTracks".   104 00:12:15,440 --> 00:12:21,360 As a symbol we will use a circle and the color of  the circle should be determined from the value.   105 00:12:21,360 --> 00:12:26,320 So if you set it to "" – you can, of course,  choose any color – but if you set it to "",   106 00:12:27,680 --> 00:12:29,760 the color of the circle will be determined from   107 00:12:31,040 --> 00:12:39,360 the value itself. As long as you set a color  bar, which is enabled by default. And for "data":   108 00:12:41,760 --> 00:12:46,000 You can see here on the right it says "input  columns are data0, data1, ..." one so.   109 00:12:46,640 --> 00:12:54,800 This grid file contains coordinates and then the  additional columns for the accelerometer data.   110 00:12:55,680 --> 00:13:01,520 I'll show you later how this file looks  like, but for now let's say we want to   111 00:13:01,520 --> 00:13:08,080 visualize the total acceleration. So we  can say "sqrt(data0^2+data1^2+data2^2)". 112 00:13:16,400 --> 00:13:23,360 So this is an equation. GROOPS can parse equations  and can parse mathematical expressions in most of   113 00:13:23,360 --> 00:13:30,400 the input fields. We have three columns for  x, y, and z, the accelerations along x, y,   114 00:13:30,400 --> 00:13:39,360 and z axes. And we just want to compute the  total. Something else we want to do here is,   115 00:13:40,320 --> 00:13:45,760 the values in "SimulateAccelerometer",  they get output in m/s^2,   116 00:13:47,760 --> 00:13:57,920 so it's SI units. Since these will be very small  values, we want to visualize them in nm/s^2.   117 00:14:00,800 --> 00:14:18,640 So we can just, here, multiply times one trillion.  We will convert the values to nm/s^2. You have to   118 00:14:18,640 --> 00:14:23,200 know that here in GROOPS, usually in the Plot  programs, you have to do this in the values,   119 00:14:23,200 --> 00:14:30,320 because then, later, in the color bar, we  could define our "min" and "max" in nm/s^2.   120 00:14:31,200 --> 00:14:37,360 But we will skip the "min" and "max", we  just add a label "Acceleration [nm/s^2]".   121 00:14:40,720 --> 00:14:49,200 Okay, that's pretty much it. We will leave all the  other settings to our default values. "projection"   122 00:14:49,200 --> 00:14:58,400 is fine as a Robinson projection and, yeah,...  let's see if it runs. One thing I forgot is   123 00:14:58,400 --> 00:15:02,560 I go into "options" and set "transparency"  to "no", since I'm using a black background   124 00:15:04,000 --> 00:15:06,560 in my file explorer. Okay, now let's run it.   125 00:15:09,040 --> 00:15:16,160 Everything is fine. As you can see, a command  window opens. The orbit is simulated – one minute   126 00:15:16,160 --> 00:15:25,440 sampling – tidal model can take a few seconds.  It's done. Then, next is "SimulateStarCamera",   127 00:15:25,440 --> 00:15:30,240 which finished instantly. The next  is "SimulateAccelerometer" and then   128 00:15:30,240 --> 00:15:35,120 "Orbit2Groundtracks" and "PlotMap", and it's  already done. So we close it and go to our 129 00:15:37,440 --> 00:15:44,720 directory. We can see there is now a ground track  plot created and it is basically what I expected.   130 00:15:45,280 --> 00:15:52,080 We can see a map in the background with light blue  oceans and each point is a point along the orbit.   131 00:15:52,080 --> 00:16:00,960 As we had 85 degrees of inclination it's almost  a polar orbit. It's pretty close to Earth so we   132 00:16:00,960 --> 00:16:06,320 have several revolutions for this one day. And  tidal accelerations are, of course, largest   133 00:16:07,680 --> 00:16:13,360 over the oceans, especially close to  the coast. So this is what I expected.   134 00:16:14,160 --> 00:16:18,240 Okay, that's it for this video.  In the next video we'll talk about   135 00:16:18,240 --> 00:16:22,560 the parser in GROOPS, how you can parse  global variables and other variables   136 00:16:22,560 --> 00:16:26,720 and use them in your scripts. Thanks, again,  for watching and see you in the next video!