Skip to content
Browse files

minor tweaks, like getting band number reasonable

  • Loading branch information...
1 parent 03dfb0e commit d07791d5aedab50e948d1782da37d2defdc5d999 Ray Garcia committed Aug 8, 2012
Showing with 10 additions and 8 deletions.
  1. +1 −2 py/polar2grid_modis/polar2grid/modis/__init__.py
  2. +9 −6 py/polar2grid_modis/polar2grid/modis/bt.py
View
3 py/polar2grid_modis/polar2grid/modis/__init__.py
@@ -1,4 +1,3 @@
#!/usr/bin/env python
-from .viirs_imager_to_swath import make_swaths
-from .viirs_guidebook import file_info,geo_info,read_file_info,read_geo_info
+from .bt import bright_shift
View
15 py/polar2grid_modis/polar2grid/modis/bt.py
@@ -1,15 +1,17 @@
-#!/usr/bin/env python# encoding: utf-8
+#!/usr/bin/env python
+# encoding: utf-8
"""
polar2grid.modis.bt
$Id$
Purpose: convert MODIS to Brightness Temp
-
Created by rayg Aug 2012.
Copyright (c) 2012 University of Wisconsin SSEC. All rights reserved.
"""
+
+# copypasta!
BT_FORTRAN = """
REAL FUNCTION MODIS_BRIGHT_SHIFT(RAD, BAND, UNITS)
@@ -273,7 +275,6 @@ def _coeffs(platform, offset):
tci = MODIS_COEFF_TABLE['tci_' + p][offset])
-# fundamental constants
"""
c Fundamental constants required for the monochromatic
c Planck function routines PLANCK_M, PLANC_M, BRIGHT_M, BRITE_M
@@ -295,7 +296,6 @@ def _coeffs(platform, offset):
# ... Speed of light in vacuum (meters per second)
c = 2.99792458e+8
-
# ... Boltzmann constant (Joules per Kelvin)
k = 1.3806503e-23
@@ -339,7 +339,9 @@ def bright_shift(platform, rad, band, units):
or "wavenumber" implying milliWatts per square meter per steradian per wavenumber
"""
offset = (band - 20) if (band <= 25) else (band - 21)
+ assert(offset >=0 and offset <16)
C = _coeffs(platform, offset)
+ LOG.debug('Coeffs loaded at offset %d: %s' % (offset, C))
if units == 'micron': # Watts per square meter per steradian per micron
return (micron_bt(1.0e+4 / C.cwn, rad) - C.tci) / C.tcs
@@ -351,12 +353,13 @@ def bright_shift(platform, rad, band, units):
def _test1():
from pprint import pprint
- shape = (147, 31)
+ shape = (147, 31) # arbitrary image-like
rad = np.random.ranf(shape) - 0.1
- bt = bright_shift('Terra', rad, 4, 'wavenumber')
+ bt = bright_shift('Terra', rad, 24, 'wavenumber')
pprint(bt)
+
def main():
import optparse
usage = """

0 comments on commit d07791d

Please sign in to comment.
Something went wrong with that request. Please try again.