I'm obligated to let you know I've cross posted this on stack overflow earlier today but decided after some comments that I this question is probably less one of code and more one of the mathematics involved.
Basically, these two points are at different lats and lons and as I stated I want to find the amount of something between them. The tricky thing to me is that the model data I'm working with is gridded so I need to be able to account for the amount of something along a line at the lat and lons at which that line cuts through said grid. I guess that infers that the value I get will come from the length of the vector present in each cell.
My question can be visualized like this:3D Grid
Ultimately, I'd like to be able to create a program (within any programming language honestly) that could find the amount of "something" between two points in a 3D grid. If you would like specifics of my problem, the bottom altitude is the surface, the top grid is the "top of the atmosphere". The bottom point is a measurement device looking at the sun during a certain time of day (and therefore having a certain zenith and azimuth angle). I want to find the NO2 between that measurement device and the "top of the atmosphere" which in my grid is just the top altitude level (of which there are 25 levels).
Hopefully my question is beneficial to the forum as well as asked in such a way that it is helpful!
Best, Taylor
This is more or less the 3D analog for a problem that I have provided an answer before. Here is how to do it for your case. I will use $x,y,z$ coordinates for simplicity: