issue209:python
                Différences
Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| issue209:python [2024/09/28 18:14] – créée auntiee | issue209:python [2024/10/01 09:20] (Version actuelle) – andre_domenech | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| - | + | **Python and Space Weather | |
| - | Python and Space Weather | + | |
| Greetings again fellow Sentient Lifeforms. Things here at landing pad 2997 on Terra STILL mostly crazy. Trying to handle everything on my plate is somewhat like trying to juggle four chainsaws, and an orange, all at the same time. (A VERY nasty mental picture, I must admit.) I mean, I’m supposed to be at least SEMI retired, but I seem to be busier than I was when I had a full time (read 70+ hours a week) job, a young family, and other professional responsibilities. Oh well, as the Barenaked Ladies once said “I wax poetic as you're waxing your legs”. We’ll move on now to this month’s offering. | Greetings again fellow Sentient Lifeforms. Things here at landing pad 2997 on Terra STILL mostly crazy. Trying to handle everything on my plate is somewhat like trying to juggle four chainsaws, and an orange, all at the same time. (A VERY nasty mental picture, I must admit.) I mean, I’m supposed to be at least SEMI retired, but I seem to be busier than I was when I had a full time (read 70+ hours a week) job, a young family, and other professional responsibilities. Oh well, as the Barenaked Ladies once said “I wax poetic as you're waxing your legs”. We’ll move on now to this month’s offering. | ||
| - | Here in Texas, we have a saying: “If you don’t like the weather, wait 10 minutes.” That’s because on any given day, the weather is so very volatile. Especially in the summertime. In order to make any plans for outside activities, things like walks, shopping, family trips, heck even walking the dog, can be impacted by the weather. Cold, hot, windy, rainy, foggy, muddy, clear… it all affects how we will spend our day or night. | + | Here in Texas, we have a saying: “If you don’t like the weather, wait 10 minutes.” That’s because on any given day, the weather is so very volatile. Especially in the summertime. In order to make any plans for outside activities, things like walks, shopping, family trips, heck even walking the dog, can be impacted by the weather. Cold, hot, windy, rainy, foggy, muddy, clear… it all affects how we will spend our day or night.** | 
| + | |||
| + | Python et la météo spatiale | ||
| + | |||
| + | Salutations encore une fois, camarades des formes de vie sensibles. Ici, sur la plateforme d' | ||
| + | |||
| + | Ici, au Texas, nous avons un dicton : « Si vous n' | ||
| - | So, yes, weather here on Terra is an important thing that we need to take into consideration before we make any decisions about what we will do today, tomorrow or even next week. There is another event that is very weather sensitive. That’s the launching of spacecraft to explore areas not on Terra, and even the return of said spacecraft. Yes, I’m talking about space, the great unknown, the ‘final frontier’. | + | **So, yes, weather here on Terra is an important thing that we need to take into consideration before we make any decisions about what we will do today, tomorrow or even next week. There is another event that is very weather sensitive. That’s the launching of spacecraft to explore areas not on Terra, and even the return of said spacecraft. Yes, I’m talking about space, the great unknown, the ‘final frontier’. | 
| Space doesn’t have rain or thunder or cold fronts or even seasonal changes, but it does have some interesting things like plasma temperatures and densities, solar wind speeds, and when you look at our star, the sun, there are Coronal Mass Ejections and solar flares and other things that can make our lives here on Terra interesting to say the least. | Space doesn’t have rain or thunder or cold fronts or even seasonal changes, but it does have some interesting things like plasma temperatures and densities, solar wind speeds, and when you look at our star, the sun, there are Coronal Mass Ejections and solar flares and other things that can make our lives here on Terra interesting to say the least. | ||
| - | Many countries have created space programs that only monitor the space weather. NASA is one of them and that’s where we will concentrate our attention for this article. | + | Many countries have created space programs that only monitor the space weather. NASA is one of them and that’s where we will concentrate our attention for this article.** | 
| - | To get started, take a look at https:// | + | Donc, oui, la météo sur Terra est un élément important que nous devons prendre en considération avant de prendre des décisions sur ce que nous ferons aujourd' | 
| + | |||
| + | L' | ||
| + | |||
| + | De nombreux pays ont créé des programmes spatiaux qui surveillent uniquement la météo spatiale. La NASA est l'un d' | ||
| + | |||
| + | |||
| + | **To get started, take a look at https:// | ||
| If you are interested in digging in, you should sign up for an API key at https:// | If you are interested in digging in, you should sign up for an API key at https:// | ||
| - | Let’s look at some of the things that DONKI can provide. | + | Let’s look at some of the things that DONKI can provide.** | 
| + | |||
| + | Pour commencer, consultez le site https:// | ||
| + | |||
| + | Si vous souhaitez approfondir la question, vous devez vous inscrire pour obtenir une clé API à l' | ||
| + | |||
| + | Voyons un peu ce que DONKI peut vous apporter. | ||
| - | In your favorite IDE, start a quick python project. Of course, we’ll need to import requests and json. Due to the amount of data that will come down, you’ll want to include pprint in your project as well. Set a variable named mykey to “DEMO_KEY”, | + | **In your favorite IDE, start a quick python project. Of course, we’ll need to import requests and json. Due to the amount of data that will come down, you’ll want to include pprint in your project as well. Set a variable named mykey to “DEMO_KEY”, | 
| You can narrow the amount of data that comes down by including a startDate and endDate in the format YYYY-MM-DD, but if you want to just get a gross overview of what the call will return, leaving out the startDate will default to 30 days prior to the current UTC date, and the endDate will default to the current UTC date. | You can narrow the amount of data that comes down by including a startDate and endDate in the format YYYY-MM-DD, but if you want to just get a gross overview of what the call will return, leaving out the startDate will default to 30 days prior to the current UTC date, and the endDate will default to the current UTC date. | ||
| Here’s (top right) what the api call would look like, including the startDate and endDate parameters… | Here’s (top right) what the api call would look like, including the startDate and endDate parameters… | ||
| + | https:// | ||
| + | |||
| + | Dans votre IDE favori, démarrez un projet python rapide. Bien sûr, nous aurons besoin d' | ||
| + | |||
| + | Vous pouvez réduire la quantité de données obtenues en incluant une date de début et une date de fin au format AAAA-MM-JJ, mais si vous souhaitez obtenir une vue d' | ||
| + | |||
| + | Voici (en haut à droite) à quoi ressemblerait l' | ||
| https:// | https:// | ||
| - | Please note, by leaving out the startDate and/or endDate could lead to way more data items than you might want to start with. So use that type of call for when you really need it. | + | |
| + | **Please note, by leaving out the startDate and/or endDate could lead to way more data items than you might want to start with. So use that type of call for when you really need it. | ||
| From here, you can query the info variable to get the fields you want. | From here, you can query the info variable to get the fields you want. | ||
| Ligne 32: | Ligne 60: | ||
| So anyway, in order to get a very gross overview of the data, I decided to query the json response for just the dictionary keys. Here’s what was returned… | So anyway, in order to get a very gross overview of the data, I decided to query the json response for just the dictionary keys. Here’s what was returned… | ||
| + | |||
| + | dict_keys([' | ||
| + | |||
| + | Veuillez noter qu'en omettant la date de début et/ou la date de fin, vous risquez d' | ||
| + | |||
| + | À partir de là, vous pouvez interroger la variable info pour obtenir les champs que vous souhaitez. | ||
| + | |||
| + | J'ai fait cela très tôt le matin du samedi 7 septembre, et j'ai obtenu 129 enregistrements de données, chaque enregistrement contenant 12 éléments et certains de ces éléments étant eux-mêmes des dictionnaires. | ||
| + | |||
| + | Quoi qu'il en soit, afin d' | ||
| dict_keys([' | dict_keys([' | ||
| - | I then wanted to see what just one record would look like. So I had it dump to the terminal via pprint. I broke the data dump into smaller pieces to make it easier to understand. Some of the data items don’t mean anything to me yet. | + | |
| + | **I then wanted to see what just one record would look like. So I had it dump to the terminal via pprint. I broke the data dump into smaller pieces to make it easier to understand. Some of the data items don’t mean anything to me yet. | ||
| {' | {' | ||
| Ligne 46: | Ligne 85: | ||
| Now for the second dictionary item in our json data. The cmeAnalyses field (below): | Now for the second dictionary item in our json data. The cmeAnalyses field (below): | ||
| - | You can see that there are many items that don’t quite compute to me, but there are two items that stand out pretty well right at first glance. Mainly the note field and the link field. If I was really interested in this event, I’d pull that link up. Remember, this is the analysis of the event, so it will be fairly specific. | + | You can see that there are many items that don’t quite compute to me, but there are two items that stand out pretty well right at first glance. Mainly the note field and the link field. If I was really interested in this event, I’d pull that link up. Remember, this is the analysis of the event, so it will be fairly specific.** | 
| - | Now we are back at the “general” data, and here we see that there were two devices that were used to look at this event as well as another link, this time a more general web page that will show any related (top right). | + | J'ai ensuite voulu voir à quoi ressemblait un seul enregistrement. J'ai donc envoyé les données au terminal par l' | 
| + | |||
| + | {' | ||
| + | |||
| + | ' | ||
| + | |||
| + | ' | ||
| + | |||
| + | Pour moi, l' | ||
| + | |||
| + | Passons maintenant au deuxième élément du dictionnaire dans nos données json. Le champ cmeAnalyses (en bas à droite). | ||
| + | |||
| + | Vous pouvez voir qu'il y a beaucoup d' | ||
| + | |||
| + | |||
| + | **Now we are back at the “general” data, and here we see that there were two devices that were used to look at this event as well as another link, this time a more general web page that will show any related (top right). | ||
| The note field is usually one of the most important to me, so I can decide to dive deeper into this report or not. | The note field is usually one of the most important to me, so I can decide to dive deeper into this report or not. | ||
| Ligne 60: | Ligne 114: | ||
| ' | ' | ||
| - | ' | + | ' | 
| + | |||
| + | Nous revenons maintenant aux données « générales », et nous voyons ici que deux appareils ont été utilisés pour examiner cet événement, | ||
| - | Finally | + | Le champ « note » est généralement l'un des plus importants pour moi, car il me permet de décider d' | 
| + | |||
| + | ' | ||
| + | |||
| + | ' | ||
| + | |||
| + | 'event is not clearly visible in SOHO LASCO C3 as it may be too faint ' | ||
| + | |||
| + | ' | ||
| + | |||
| + | ' | ||
| + | |||
| + | (Note : CME faible vu en premier dans le NW par SOHO LASCO C2 commençant à 2024-08-08T04: | ||
| + |  | ||
| + | **Finally the last batch of data fields. Here, the startTime and submissionTime fields are something I would normally look at. | ||
| ' | ' | ||
| Ligne 72: | Ligne 142: | ||
| All that having been said, the cmeAnalyses dictionary can contain multiple entries. A very good example of this occurred on May 11 of this year (2024, just in case you read this sometime in the future). I used the same methodology to get a data dump for that day again using DONKI. | All that having been said, the cmeAnalyses dictionary can contain multiple entries. A very good example of this occurred on May 11 of this year (2024, just in case you read this sometime in the future). I used the same methodology to get a data dump for that day again using DONKI. | ||
| - | url1 = f" | + | url1 = f" | 
| - | Then, once I got the data, I saved the data to a local pickle file, so I didn’t have to keep making the call. There were 5 events reported that day. I dug into the json data and near the end of the first report was a link to https:// | + | Enfin, le dernier lot de champs de données. Ici, les champs startTime et submissionTime sont des choses que je regarderais en temps normal. | 
| + | |||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | ' | ||
| + | |||
| + | Tout cela étant dit, le dictionnaire cmeAnalyses peut contenir plusieurs entrées. Un très bon exemnple de cela s'est produit le 11 mai de cette année (2024, au cas où vous liriez ceci dans le futur). J'ai utilisé la même méthodologie pour obtenir un dumping de données pour ce jour à nouveau en utilisant DONKI. | ||
| + | |||
| + | url1 = f « https:// | ||
| + | |||
| + | |||
| + | **Then, once I got the data, I saved the data to a local pickle file, so I didn’t have to keep making the call. There were 5 events reported that day. I dug into the json data and near the end of the first report was a link to https:// | ||
| Higher up in the json data for the first report, I found another link which led me to https:// | Higher up in the json data for the first report, I found another link which led me to https:// | ||
| - | That big dark purple (to my eyes) is the CME headed for that tiny yellow dot which represents Earth. Since the image is a GIF, I didn’t try to capture it just as it hits, but you can visit the above link to watch it yourself. | + | That big dark purple (to my eyes) is the CME headed for that tiny yellow dot which represents Earth. Since the image is a GIF, I didn’t try to capture it just as it hits, but you can visit the above link to watch it yourself.** | 
| + | |||
| + | Ensuite, une fois les données obtenues, je les ai sauvegardées dans un fichier local quelconque, ce qui m'a évité d' | ||
| + | |||
| + | Plus haut dans les données json du premier rapport, j'ai trouvé un autre lien qui m'a conduit vers https:// | ||
| + | |||
| + | Ce gros violet foncé (à mes yeux) est la CME qui se dirige vers le petit point jaune qui représente la Terre. Comme l' | ||
issue209/python.1727540076.txt.gz · Dernière modification : 2024/09/28 18:14 de auntiee
                
                