Skip to content

Commit

Permalink
Improve overview for viirs and overview_sun
Browse files Browse the repository at this point in the history
Signed-off-by: Adam.Dybbroe <a000680@c20671.ad.smhi.se>
  • Loading branch information
Adam.Dybbroe committed Oct 12, 2015
1 parent 39f10f5 commit 627b028
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 22 deletions.
3 changes: 1 addition & 2 deletions mpop/instruments/modis.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2010, 2014.
# Copyright (c) 2010, 2014, 2015.

# SMHI,
# Folkborgsvägen 1,
Expand Down Expand Up @@ -29,7 +29,6 @@
"""This modules describes the modis instrument.
It provides MODIS specific methods for RGB-compositing.
"""
import numpy as np

import mpop.imageo.geo_image as geo_image
from mpop.instruments.visir import VisirCompositer
Expand Down
12 changes: 10 additions & 2 deletions mpop/instruments/viirs.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2010, 2011, 2012, 2013, 2014.
# Copyright (c) 2010, 2011, 2012, 2013, 2014, 2015.

# Author(s):

Expand Down Expand Up @@ -46,7 +46,7 @@ class ViirsCompositer(VisirCompositer):

instrument_name = "viirs"

def overview(self, stretch='crude', gamma=1.6):
def overview(self, stretch='linear', gamma=1.6):
"""Make an Overview RGB image composite from VIIRS
channels.
"""
Expand All @@ -70,6 +70,14 @@ def overview(self, stretch='crude', gamma=1.6):

overview.prerequisites = set(['M05', 'M07', 'M15'])

def overview_sun(self, stretch='linear', gamma=1.6):
"""Make an Overview RGB image composite from VIIRS
channels. Sun-zenith correction is implicit for VIIRS
"""
return self.overview(stretch=stretch, gamma=gamma)

overview_sun.prerequisites = overview.prerequisites

def hr_overview(self):
"""Make a high resolution Overview RGB image composite
from the VIIRS I-bands only - 375 meter resolution.
Expand Down
28 changes: 10 additions & 18 deletions mpop/instruments/visir.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (c) 2010, 2011, 2012, 2013, 2014.
# Copyright (c) 2010, 2011, 2012, 2013, 2014, 2015.

# Author(s):

Expand Down Expand Up @@ -33,10 +33,12 @@
except ImportError:
sza = None

#pylint: disable=W0612
# pylint: disable=W0612
# remove warnings for unused prerequisites


class VisirCompositer(Compositer):

"""Compositer for Visual-IR instruments
"""

Expand Down Expand Up @@ -141,9 +143,8 @@ def overview(self, stretch='crude', gamma=1.6):

overview.prerequisites = set([0.635, 0.85, 10.8])



def overview_sun(self, stretch='crude', gamma=1.6):
# def overview_sun(self, stretch='crude', gamma=1.6):
def overview_sun(self, stretch='linear', gamma=1.6):
"""Make an overview RGB image composite normalising with cosine to the
sun zenith angle.
"""
Expand All @@ -161,7 +162,7 @@ def overview_sun(self, stretch='crude', gamma=1.6):
red = np.ma.masked_where(sunzmask, self[0.635].data / costheta)
green = np.ma.masked_where(sunzmask, self[0.85].data / costheta)
blue = -self[10.8].data

img = geo_image.GeoImage((red, green, blue),
self.area,
self.time_slot,
Expand All @@ -177,8 +178,6 @@ def overview_sun(self, stretch='crude', gamma=1.6):

overview_sun.prerequisites = set([0.635, 0.85, 10.8])



def night_overview(self, stretch='histogram', gamma=None):
"""Make an overview RGB image composite using IR channels.
Expand All @@ -198,7 +197,6 @@ def night_overview(self, stretch='histogram', gamma=None):

night_overview.prerequisites = set([3.75, 10.8, 12.0])


def natural(self, stretch=None, gamma=1.8):
"""Make a Natural Colors RGB image composite.
Expand Down Expand Up @@ -267,7 +265,6 @@ def airmass(self):

airmass.prerequisites = set([6.7, 7.3, 9.7, 10.8])


def vis06(self):
"""Make a black and white image of the VIS 0.635um channel.
Expand Down Expand Up @@ -381,7 +378,7 @@ def red_snow(self):
Linear stretch without clipping.
"""
self.check_channels(0.635, 1.63, 10.8)
self.check_channels(0.635, 1.63, 10.8)

ch1 = self[0.635].check_range()
ch2 = self[1.63].check_range()
Expand All @@ -393,7 +390,7 @@ def red_snow(self):
fill_value=(0, 0, 0),
mode="RGB")

img.enhance(stretch = "crude")
img.enhance(stretch="crude")

return img

Expand Down Expand Up @@ -427,12 +424,10 @@ def convection(self):
(0, 55),
(-70, 20)))


return img

convection.prerequisites = set([0.635, 1.63, 3.75, 6.7, 7.3, 10.8])


def dust(self):
"""Make a Dust RGB image composite.
Expand Down Expand Up @@ -466,7 +461,6 @@ def dust(self):

dust.prerequisites = set([8.7, 10.8, 12.0])


def ash(self):
"""Make a Ash RGB image composite.
Expand Down Expand Up @@ -498,7 +492,6 @@ def ash(self):

ash.prerequisites = set([8.7, 10.8, 12.0])


def fog(self):
"""Make a Fog RGB image composite.
Expand Down Expand Up @@ -602,5 +595,4 @@ def cloudtop(self, stretch=(0.005, 0.005), gamma=None):

cloudtop.prerequisites = set([3.75, 10.8, 12.0])

#pylint: enable=W0612

# pylint: enable=W0612

0 comments on commit 627b028

Please sign in to comment.