Skip to content

Commit

Permalink
deploy v1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
AStcherbinine committed May 10, 2022
1 parent 8867df0 commit f869d32
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
__pycache__/
*.py[cod]
*$py.class

.venv/
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,20 @@ pip3 install .
# Package importation
import spip
import numpy as np

# Genaration of a longitude/latitude grid to project the footprint
lon_array, lat_array = np.arange(0, 360.5, 0.5), np.arange(-90, 90.5, 0.5)
lon_array = np.arange(0, 360.5, 0.5)
lat_array = np.arange(-90, 90.5, 0.5)
lon_grid, lat_grid = np.meshgrid(lon_array, lat_array)

# Pixel parameters
lon_px, lat_px = # Longitude/Latitude of the pixel center [deg]
emer = # Emergence angle of the pixel on the surface [deg]
lon_subsc, lat_subsc = # Longitude/Latitude sub-spacecraft [deg]
d_Mars_sc = # Distance surface-spacraft [km]
lon_px, lat_px = 58.2, 79.3 # Longitude/Latitude of the pixel center [deg]
emer = 61.7 # Emergence angle of the pixel on the surface [deg]
lon_subsc, lat_subsc = 28.0, 24.9 # Longitude/Latitude sub-spacecraft [deg]
d_Mars_sc = 27212 # Distance surface-spacraft [km]
Rmars = spip.emm_emirs.Rmars # 3390 [km]
ifov = spip.emm_emirs.ifov_emirs # 2.7e-3 [rad]

# Generation of the mask map of the pixel footprint
#-- EMM/EMIRS spacecraft
mask_footprint = spip.emm_emirs.emirs_ifov_px_projection(
Expand All @@ -52,7 +56,7 @@ mask_footprint = spip.emm_emirs.emirs_ifov_px_projection(
)

#-- General case, cirular pixel
a, b, θ = spip.circalar_pixels.params_ellipse_fov(
a, b, θ = spip.circular_pixels.params_ellipse_fov(
lon_px,
lat_px,
emer,
Expand All @@ -62,7 +66,7 @@ a, b, θ = spip.circalar_pixels.params_ellipse_fov(
ifov
)

mask_footprint = spip.circalar_pixels.in_ellipse_spherical(
mask_footprint = spip.circular_pixels.in_ellipse_spherical(
lon_grid,
lat_grid,
Rmars,
Expand Down
14 changes: 8 additions & 6 deletions spip/emm_emirs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

## emm_emirs.py
## Created by Aurélien STCHERBININE
## Last modified by Aurélien STCHERBININE : 09/05/2022
## Last modified by Aurélien STCHERBININE : 10/05/2022

##----------------------------------------------------------------------------------------
"""Projection of an EMM/EMIRS pixel fov on Mars.
Expand All @@ -16,6 +16,8 @@
from copy import deepcopy
import os
import yaml
# Local
from . import circular_pixels

# Name of the current file
_py_file = 'emm_emirs.py'
Expand All @@ -26,15 +28,15 @@

##-----------------------------------------------------------------------------------
## Load data
with open(os.path.join(data_path, 'instruments.yml') as f_inst:
with open(os.path.join(data_path, 'instruments.yml')) as f_inst:
instruments = yaml.safe_load(f_inst)
with open(os.path.join(data_path, 'celestial_objects.yml') as f_obj:
with open(os.path.join(data_path, 'celestial_objects.yml')) as f_obj:
objects = yaml.safe_load(f_obj)

# EMIRS IFOV [rad]
ifov_emirs = u.Quantity(instruments['instruments']['emm-emirs']['ifov']).to('rad').value
# Mars radius [km]
Rmars = u.Quantity(instruments['planets']['mars']['radius']).to('km').value
Rmars = u.Quantity(objects['planets']['mars']['radius']).to('km').value

##-----------------------------------------------------------------------------------
## EMIRS pixel footprint projection
Expand Down Expand Up @@ -73,9 +75,9 @@ def emirs_ifov_px_projection(lon_grid, lat_grid, lon_px, lat_px, emer, lon_subsc
| 0 -> Outside
"""
# Compute footprint ellipse parameters
a, b, θ = params_ellipse_fov(lon_px, lat_px, emer, lon_subsc, lat_subsc, d_Mars_sc, ifov)
a, b, θ = circular_pixels.params_ellipse_fov(lon_px, lat_px, emer, lon_subsc, lat_subsc, d_Mars_sc, ifov)
# Search for grid pixels within the EMIRS footprint
mask_ellipse = in_ellipse_spherical(lon_grid, lat_grid, Rmars, a, b, lon_px, lat_px, θ)
mask_ellipse = circular_pixels.in_ellipse_spherical(lon_grid, lat_grid, Rmars, a, b, lon_px, lat_px, θ)
mask_ellipse2 = deepcopy(mask_ellipse) * 1. # bool to float
# Output
return mask_ellipse2
Expand Down

0 comments on commit f869d32

Please sign in to comment.