ABI fixed grid coordinate values
Posted: Tue Aug 07, 2018 8:03 pm
Is there a way to access the satellite viewing angle of the ABI data or the actual x and y coordinate values?
Thanks,
Joleen
Thanks,
Joleen
Support and discussion of the McIDAS-V software package
https://mcidas.ssec.wisc.edu/forums/
https://mcidas.ssec.wisc.edu/forums/viewtopic.php?f=31&t=1909
Code: Select all
# setup
import math
from math import sin, cos, sqrt, atan2, radians
dataDir = 'V:/rcarp/Data/ABI/eclipse/M1/'
dataFile = 'OR_ABI-L1b-RadM1-M3C01_G16_s20172331738268_e20172331738325_c20172331738368.nc'
# dictionary for loadGrid
dataParms = dict(
filename = '%s%s' % (dataDir, dataFile),
field = 'Rad',
stride = 50,
)
# create data object with loadGrid and display data
data = loadGrid(**dataParms)
layer = activeDisplay().createLayer('Image Display', data)
# Use JPythonMethods to extract lists of lat/lons of
# each data point in the data object
ds = getDomainSet(data)
latLons = getLatLons(ds)
lats = latLons[0]
lons = latLons[1]
# This is curtosy of:
# https://stackoverflow.com/questions/19412462/
# getting-distance-between-two-points-based-on-latitude-longitude
# We're figuring out the distance between each data pixel and
# the subpoint of the satellite
distList = []
numPts = len(lats)
R = 6373.0
for x in range(0, numPts):
# lat1/lon1 are the pixels of data
lat1 = radians(lats[x])
lon1 = radians(lons[x])
# lat2/lon2 are for the satellite subpoint
lat2 = radians(0)
lon2 = radians(-75)
dlat = lat2 - lat1
dlon = lon2 - lon1
a = sin(dlat / 2)**2 + cos(lat1) * cos(lat2) * sin(dlon / 2)**2
c = 2 * atan2(sqrt(a), sqrt(1 - a))
distance = R * c
distList.append(distance)
# height of satellite in km
satHeight = 35786
# determine the satellite viewing angle by taking the arctangent
# of the opoosite (from distList) divided by satHeight
satAngles = []
for x in range(0, numPts):
ang = math.degrees(math.atan(distList[x] / satHeight))
satAngles.append(ang)
# print out lat/lon/sat viewing angles at each pixel
for x in range(0, numPts):
lat = lats[x]
lon = lons[x]
ang = satAngles[x]
print 'At %s, %s (lat,lon) the viewing angle is %s degrees' % (lat, lon, ang)
Code: Select all
# This is curtosy of:
# https://stackoverflow.com/questions/19412462/
# getting-distance-between-two-points-based-on-latitude-longitude
# We're figuring out the distance between each data pixel and
# the subpoint of the satellite
distList = []
numPts = len(lats)
R = 6373.0
# extract subpoint info from metadata
satLat = data['metadataVariables']['nominal_satellite_subpoint_lat']['value']
satLon = data['metadataVariables']['nominal_satellite_subpoint_lon']['value']
for x in range(0, numPts):
# lat1/lon1 are the pixels of data
lat1 = radians(lats[x])
lon1 = radians(lons[x])
# lat2/lon2 are for the satellite subpoint
lat2 = radians(float(satLat))
lon2 = radians(float(satLon))