1
$\begingroup$

I'm trying to build this thing. Shows photos of the DSCVR EPIC


See the images here: https://epic.gsfc.nasa.gov/

However I found out that the earth isn't always the same size in the photos, probably because of orbits, and the crop in the code is a fixed size, clipping the earth!

Trying to come up with an elegant solution I was trying to use the coordinate data given with the photos. For example;

"dscovr_j2000_position": {
    "x": 229545.55027,
    "y": -1273500.383955,
    "z": -714182.581123
},

This presented me with distance information! Eg: 1478022 km. I also know the diameter of the earth, 12.742 km.

However, I don't really know how to use this information of the telescope to get to the size in pixels of the earth in the image.

According to the documents it has a FOV of 0.62 degrees and a 2048px sensor with 15um pixels. Earth should be within 0.45 to 0.53 deg.

$\endgroup$
1
  • 1
    $\begingroup$ What part are you having trouble with? You'd just divide the FOV by the sensor size in pixels to get degrees per pixel. You seem to have all of the other info. $\endgroup$ Feb 20, 2023 at 23:01

1 Answer 1

1
$\begingroup$

Okay, yes. I was thinking too complicated. Sometimes the solutions are just high school maths.

Basic trigonometry:

image with = distance * tan( field of view / 2 ) * 2

distances in km

Example:

16232 km = 1.5 million km * tan( 0.62 / 2 ) * 2

Using this you can calculate the crop factor using the planet diameter: 12742 / 16232 = 0.785.

Results (3px border):

original_epic_1b_20230219010436 cropped_epic_1b_20230219010436

Resulting python for those interested:

def calculateDistanceFromMetadata(imagejson):
    """Calculate distance from the sattelite to earth in km from j2000 coordinates"""
    x = imagejson['dscovr_j2000_position']['x']
    y = imagejson['dscovr_j2000_position']['y']
    z = imagejson['dscovr_j2000_position']['z']
    # Pythagoras
    distanceKM = math.sqrt((x*x)+(y*y)+(z*z))
    return distanceKM

def calculateCropFactorBasedOnDistance(distanceKM):
    """Calculate the ratio image size vs earth size using known constants"""
    # Basic trigoniometry: photo size in km = distance * tan( fov in degrees / 2 ) * 2
    fieldWidth_km = (distanceKM * math.tan(math.radians(camera_fov_deg) / 2)) * 2
    object_field_ratio = planet_diameter_km / fieldWidth_km
    return object_field_ratio
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.