Model Manipulation

This page will describe some of the routines to view Model results

Create Model Maps

pydivide.create_model_maps(altitude, variable=None, model=None, file=None, numcontours=25, fill=False, ct='viridis', transparency=1, nearest=False, linear=True, savefig=True)[source]

Generates a .png contour map of a model at a specific altitude. These can be used as a background in map2d. The models must be downloaded manually from the SDC website: https://lasp.colorado.edu/maven/sdc/public/pages/models.html.

Parameters:
  • altitude – int Specified altitude of output map.
  • variable – str Plots specified chemical species (Appendix A).
  • model – dict Model variable produced from prior call to read_model_results.
  • file – str If model not provided (produced from read_model_results), full path to model can be set and read.
  • numContours – int Specifies number of contour lines. Default is 25.
  • fill – bool If True, fills in contour levels instead of generating lines.
  • ct – str Sets color table. Valid color tables can be found here: https://matplotlib.org/examples/color/colormaps_reference.html
  • transparency – int, float Sets transparency between [0,1] inclusive. 0 is completely transparent, and 1 is completely opaque.
  • nearest – bool If True, instead of interpolating nearby values, this returns the value of the nearest neighbor altitude.
  • linear – bool If True, performs linear interpolation between 2 altitude layers.
  • saveFig – bool If True, saves figure as .png file.
Returns:

None

Examples

>>> # Interpolate all model tracers to spacecraft trajectory using nearest neighbor interpolation.
>>> pydivide.create_model_maps(altitude=170, file = '<dir_path>/MAMPS_LS180_F130_081216.nc', variable='geo_x', saveFig=True)
_images/sample.png

Interpolate Model

pydivide.interpol_model(kp, model=None, file=None, nearest=False)[source]

Reads in MAVEN’s position from insitu, and determines the value of the models at those points.

There are 3 scenarios to interpolate: 1) MSO coordinate system with latitude/longitude/altitude 2) GEO coordinate system with latitude/longitude/altitude 3) MSO coordinate system with x/y/z NOTE: GEO x/y/z coordinate system is not allowed

In all 3 cases, everything is converted to an MSO lat/lon/alt coordinate system. For interpolation purposes, the atmosphere acts like a cube with dimensions lat*lon*alt This makes it so the interpolation is weighted more accurately. A point that is 1 degree of lat/lon away will have as much influence as a point that is 1 kilometer higher or lower

Parameters:
  • kp – struct KP insitu data structure read from file(s).
  • model – str Source of simulation data to be interpolated.
  • file – str If model not provided, can specify the full path to the model.
  • nearest – bool If True, instead of interpolating nearby values, this returns the value of the nearest neighbor altitude.
Returns:

Numpy array of data representative of what the spacecraft would have measured if it were travelling through the model

Examples

>>> # Interpolate all model tracers to the spacecraft trajectory using nearest neighbor interpolation.
>>> # results = pydivide.interpol_model(insitu, file='<dir_path>/Elew_18_06_14_t00600.nc', nearest=True)