mattkjames7 / PyGeopack

Wrapper for geopack-08 used for the Tsyganenko magnetic field models
GNU General Public License v3.0
11 stars 2 forks source link

Explanation of Input parameters for TraceField class #5

Closed sterfrag closed 4 years ago

sterfrag commented 4 years ago

Hello,

i would like some further explanations (if you may) concerning the inputs of TraceField class. What do you mean by "x, y and z can either be scalars, or arrays of coordinates in Re". Also from what i get, the input parameters are GSM by default. Does this mean that i have to provide coordinates in GSM coordinate system? My initial point for example has in geodetic coordinates (lat=80, lon=180 and alt=1500km). Also i do not get what Re means. Does it perhaps mean that the input are cartesian coordinates in GSM coordinate system?

Forgive me if my question is wrong or silly.

mattkjames7 commented 4 years ago

Hi sterfrag,

Don't worry, your questions are not silly at all!

So the inputs x, y and z are indeed Cartesian coordinates. Each one can either be a scalar (so you are performing a single trace) or an array (so multiple traces starting from different locations). The units of x, y and z are in Re (Earth radii) so 1 Re ~ 6371 km.

The routine accepts three different coordinate systems for input via the CoordIn keyword. By default CoordIn = 'GSM', but it could also be set to either 'SM' or 'GSE'. The same is true for the output coordinates, which can be specified using the CoordOut keyword.

For your example, you would need to convert geodetic coordinates to one of the three Cartesian systems above. I don't think there is a function that does that directly in this module (this could be a feature request that I would be happy to implement), though you could do the following:

  1. Use the GEOtoMAG function to convert geodetic lat and lon to magnetic lat and lon,
  2. Convert MAG lat, lon and altitude to Cartesian MAG coordinates,
  3. Use the MAGtoGSE function to convert MAG to GSE coordinates,
  4. Finally run the trace using the GSE coordinates and by setting CoordIn='GSE'.

I hope that helps. Cheers!

sterfrag commented 4 years ago

Thanks a lot for your fast answer Matt. This was extremely helpful.

mattkjames7 commented 4 years ago

Not a problem!