# Medium resolution (500m) PRODUCT_MCR01_500M = "modis_crefl01_500m" PRODUCT_MCR02_500M = "modis_crefl02_500m" PRODUCT_MCR03_500M = "modis_crefl03_500m" PRODUCT_MCR04_500M = "modis_crefl04_500m" PRODUCT_MCR05_500M = "modis_crefl05_500m" PRODUCT_MCR06_500M = "modis_crefl06_500m" PRODUCT_MCR07_500M = "modis_crefl07_500m" # High resolution (250m band resolution) PRODUCT_MCR01_250M = "modis_crefl01_250m" PRODUCT_MCR02_250M = "modis_crefl02_250m" PRODUCT_MCR03_250M = "modis_crefl03_250m" PRODUCT_MCR04_250M = "modis_crefl04_250m" PRODUCTS = ProductDict() GEO_PAIRS = GeoPairDict() PAIR_INAV = viirs_module.PAIR_INAV PAIR_MNAV = viirs_module.PAIR_MNAV PAIR_1000M = modis_module.PAIR_1000M PAIR_500M = modis_module.PAIR_500M PAIR_250M = modis_module.PAIR_250M GEO_PAIRS[PAIR_INAV] = viirs_module.GEO_PAIRS[PAIR_INAV] GEO_PAIRS[PAIR_MNAV] = viirs_module.GEO_PAIRS[PAIR_MNAV] GEO_PAIRS[PAIR_1000M] = modis_module.GEO_PAIRS[PAIR_1000M] GEO_PAIRS[PAIR_500M] = modis_module.GEO_PAIRS[PAIR_500M] GEO_PAIRS[PAIR_250M] = modis_module.GEO_PAIRS[PAIR_250M] # VIIRS CREFL
RR_VAR = "rr_var" BT_90_VAR = "bt_90_var" FREQ_VAR = "freq_var" LAT_VAR = "latitude_var" LON_VAR = "longitude_var" BT_VARS = [BT_90_VAR] PRODUCT_RAIN_RATE = "mirs_rain_rate" PRODUCT_BT_90 = "mirs_btemp_90" PRODUCT_LATITUDE = "mirs_latitude" PRODUCT_LONGITUDE = "mirs_longitude" PAIR_MIRS_NAV = "mirs_nav" PRODUCTS = ProductDict() PRODUCTS.add_product(PRODUCT_LATITUDE, PAIR_MIRS_NAV, "latitude", FT_IMG, LAT_VAR, description="Latitude", units="degrees") PRODUCTS.add_product(PRODUCT_LONGITUDE, PAIR_MIRS_NAV, "longitude", FT_IMG, LON_VAR, description="Longitude", units="degrees") PRODUCTS.add_product(PRODUCT_RAIN_RATE, PAIR_MIRS_NAV, "rain_rate", FT_IMG, RR_VAR, description="Rain Rate", units="mm/hr") PRODUCTS.add_product(PRODUCT_BT_90, PAIR_MIRS_NAV, "brightness_temperature", FT_IMG, BT_90_VAR, description="Channel Brightness Temperature at 88.2GHz", units="K") GEO_PAIRS = GeoPairDict() GEO_PAIRS.add_pair(PAIR_MIRS_NAV, PRODUCT_LONGITUDE, PRODUCT_LATITUDE, 0) ### I/O Operations ### FILE_STRUCTURE = { RR_VAR: ("RR", ("scale", "scale_factor"), None, None), BT_90_VAR: ("BT", ("scale", "scale_factor"), None, 88.2), FREQ_VAR: ("Freq", None, None, None), LAT_VAR: ("Latitude", None, None, None),
from polar2grid.core import containers, roles from polar2grid.core.frontend_utils import ProductDict, GeoPairDict LOG = logging.getLogger(__name__) PRODUCT_LATITUDE = "latitude1km" PRODUCT_LONGITUDE = "longitude1km" PRODUCT_BAND1_VIS = "band1_vis" PRODUCT_BAND2_VIS = "band2_vis" PRODUCT_BAND3A_VIS = "band3a_vis" PRODUCT_BAND3B_BT = "band3b_bt" PRODUCT_BAND4_BT = "band4_bt" PRODUCT_BAND5_BT = "band5_bt" PAIR_1KM = "1km_nav" PRODUCTS = ProductDict() PRODUCTS.add_product(PRODUCT_LONGITUDE, PAIR_1KM, "longitude", readers.FT_AAPP, readers.K_LONGITUDE, description="Longitude", units="degrees") PRODUCTS.add_product(PRODUCT_LATITUDE, PAIR_1KM, "latitude", readers.FT_AAPP, readers.K_LATITUDE, description="Latitude", units="degrees") PRODUCTS.add_product(PRODUCT_BAND1_VIS, PAIR_1KM, "reflectance", readers.FT_AAPP, readers.K_BAND1, description="AVHRR Band 1 visible", units="percent", dependencies=(None,)) PRODUCTS.add_product(PRODUCT_BAND2_VIS, PAIR_1KM, "reflectance", readers.FT_AAPP, readers.K_BAND2, description="AVHRR Band 2 visible", units="percent", dependencies=(None,)) PRODUCTS.add_product(PRODUCT_BAND3A_VIS, PAIR_1KM, "reflectance", readers.FT_AAPP, readers.K_BAND3a, description="AVHRR Band 3A visible", units="percent", dependencies=(None,)) PRODUCTS.add_product(PRODUCT_BAND3B_BT, PAIR_1KM, "brightness_temperature", readers.FT_AAPP, readers.K_BAND3b, description="AVHRR Band 3B brightness temperature", units="Kelvin", dependencies=(None,)) PRODUCTS.add_product(PRODUCT_BAND4_BT, PAIR_1KM, "brightness_temperature", readers.FT_AAPP, readers.K_BAND4, description="AVHRR Band 4 brightness temperature", units="Kelvin") PRODUCTS.add_product(PRODUCT_BAND5_BT, PAIR_1KM, "brightness_temperature", readers.FT_AAPP, readers.K_BAND5, description="AVHRR Band 5 brightness temperature", units="Kelvin") GEO_PAIRS = GeoPairDict() GEO_PAIRS.add_pair(PAIR_1KM, PRODUCT_LONGITUDE, PRODUCT_LATITUDE, 0) class Frontend(roles.FrontendRole): """Polar2Grid Frontend object for handling AVHRR files.
PRODUCT_RAIN_RATE = "rain_rate" PRODUCT_BT_CHANS = "btemp_channels" PRODUCT_LATITUDE = "latitude" PRODUCT_LONGITUDE = "longitude" PRODUCT_SURF_TYPE = "surface_type" PRODUCT_SICE = "sea_ice" PRODUCT_SNOW_COVER = "snow_cover" PRODUCT_TPW = "tpw" PRODUCT_SWE = "swe" PRODUCT_CLW = "clw" PRODUCT_TSKIN = "tskin" PAIR_MIRS_NAV = "mirs_nav" PRODUCTS = ProductDict() PRODUCTS.add_product(PRODUCT_LATITUDE, PAIR_MIRS_NAV, "latitude", FT_IMG, LAT_VAR, description="Latitude", units="degrees") PRODUCTS.add_product(PRODUCT_LONGITUDE, PAIR_MIRS_NAV, "longitude", FT_IMG, LON_VAR, description="Longitude", units="degrees") PRODUCTS.add_product(PRODUCT_RAIN_RATE, PAIR_MIRS_NAV, "rain_rate", FT_IMG, RR_VAR, description="Rain Rate", units="mm/hr") PRODUCTS.add_product(PRODUCT_SURF_TYPE, PAIR_MIRS_NAV, "mask", FT_IMG, SURF_TYPE_VAR, description="Surface Type: type of surface:0-ocean,1-sea ice,2-land,3-snow") PRODUCTS.add_product(PRODUCT_BT_CHANS, PAIR_MIRS_NAV, "brightness_temperature", FT_IMG, BT_ALL_VARS, description="Channel Brightness Temperature for every channel", units="K") PRODUCTS.add_product(PRODUCT_SICE, PAIR_MIRS_NAV, "sea_ice", FT_IMG, SICE_VAR, description="Sea Ice", units="%") PRODUCTS.add_product(PRODUCT_SNOW_COVER, PAIR_MIRS_NAV, "snow_cover", FT_IMG, SNOWCOVER_VAR, description="Snow Cover", units="1") PRODUCTS.add_product(PRODUCT_TPW, PAIR_MIRS_NAV, "total_precipitable_water", FT_IMG, TPW_VAR, description="Total Precipitable Water", units="mm") PRODUCTS.add_product(PRODUCT_SWE, PAIR_MIRS_NAV, "snow_water_equivalence", FT_IMG, SWE_VAR, description="Snow Water Equivalence", units="cm") PRODUCTS.add_product(PRODUCT_CLW, PAIR_MIRS_NAV, "cloud_liquid_water", FT_IMG, CLW_VAR, description="Cloud Liquid Water", units="mm") PRODUCTS.add_product(PRODUCT_TSKIN, PAIR_MIRS_NAV, "skin_temperature", FT_IMG, TSKIN_VAR, description="skin temperature", units="K") GEO_PAIRS = GeoPairDict() GEO_PAIRS.add_pair(PAIR_MIRS_NAV, PRODUCT_LONGITUDE, PRODUCT_LATITUDE, 0)
PRODUCT_RAIN_RATE = "rain_rate" PRODUCT_BT_CHANS = "btemp_channels" PRODUCT_LATITUDE = "latitude" PRODUCT_LONGITUDE = "longitude" PRODUCT_SURF_TYPE = "surface_type" PRODUCT_SICE = "sea_ice" PRODUCT_SNOW_COVER = "snow_cover" PRODUCT_TPW = "tpw" PRODUCT_SWE = "swe" PRODUCT_CLW = "clw" PRODUCT_TSKIN = "tskin" PAIR_MIRS_NAV = "mirs_nav" PRODUCTS = ProductDict() PRODUCTS.add_product(PRODUCT_LATITUDE, PAIR_MIRS_NAV, "latitude", FT_IMG, LAT_VAR, description="Latitude", units="degrees") PRODUCTS.add_product(PRODUCT_LONGITUDE, PAIR_MIRS_NAV, "longitude", FT_IMG, LON_VAR, description="Longitude", units="degrees") PRODUCTS.add_product(PRODUCT_RAIN_RATE,
# Geolocation "Products" # These products aren't really products at the moment and should only be used as navigation for the above products PRODUCT_AERO_LAT = "aero_latitude" PRODUCT_AERO_LON = "aero_longitude" PRODUCT_COT_LAT = "cloud_latitude" PRODUCT_COT_LON = "cloud_longitude" AOD_PRODUCTS = [ PRODUCT_AOD_555, ] COT_PRODUCTS = [ PRODUCT_AVG_COT, ] PRODUCTS = ProductDict() GEO_PAIRS = GeoPairDict() PAIR_AERO_NAV = "aeronav" PAIR_COT_NAV = "cotnav" # Cool, there's no way to get rows per scan from the file GEO_PAIRS.add_pair(PAIR_AERO_NAV, PRODUCT_AERO_LON, PRODUCT_AERO_LAT, 2) GEO_PAIRS.add_pair(PAIR_COT_NAV, PRODUCT_COT_LON, PRODUCT_COT_LAT, 2) # TODO: Add description and units PRODUCTS.add_product(PRODUCT_AERO_LON, PAIR_AERO_NAV, "longitude", (guidebook.FILE_TYPE_GAERO, guidebook.FILE_TYPE_GAERO), guidebook.K_LONGITUDE) PRODUCTS.add_product(PRODUCT_AERO_LAT, PAIR_AERO_NAV, "latitude", (guidebook.FILE_TYPE_GAERO, guidebook.FILE_TYPE_GAERO), guidebook.K_LATITUDE)
# Geolocation "Products" # These products aren't really products at the moment and should only be used as navigation for the above products PRODUCT_AERO_LAT = "aero_latitude" PRODUCT_AERO_LON = "aero_longitude" PRODUCT_COT_LAT = "cloud_latitude" PRODUCT_COT_LON = "cloud_longitude" AOD_PRODUCTS = [ PRODUCT_AOD_555, ] COT_PRODUCTS = [ PRODUCT_AVG_COT, ] PRODUCTS = ProductDict() GEO_PAIRS = GeoPairDict() PAIR_AERO_NAV = "aeronav" PAIR_COT_NAV = "cotnav" # Cool, there's no way to get rows per scan from the file GEO_PAIRS.add_pair(PAIR_AERO_NAV, PRODUCT_AERO_LON, PRODUCT_AERO_LAT, 2) GEO_PAIRS.add_pair(PAIR_COT_NAV, PRODUCT_COT_LON, PRODUCT_COT_LAT, 2) # TODO: Add description and units PRODUCTS.add_product(PRODUCT_AERO_LON, PAIR_AERO_NAV, "longitude", ( guidebook.FILE_TYPE_GAERO, guidebook.FILE_TYPE_GAERO), guidebook.K_LONGITUDE) PRODUCTS.add_product(PRODUCT_AERO_LAT, PAIR_AERO_NAV, "latitude", ( guidebook.FILE_TYPE_GAERO, guidebook.FILE_TYPE_GAERO), guidebook.K_LATITUDE) PRODUCTS.add_product(PRODUCT_COT_LON, PAIR_COT_NAV, "longitude", (guidebook.FILE_TYPE_GCLDO, guidebook.FILE_TYPE_GCLDO), guidebook.K_LONGITUDE) PRODUCTS.add_product(PRODUCT_COT_LAT, PAIR_COT_NAV, "latitude", (guidebook.FILE_TYPE_GCLDO, guidebook.FILE_TYPE_GCLDO), guidebook.K_LATITUDE)
# Handle products with multiple levels later on when creating the product definitions PRODUCT_DEWPOINT = "Dewpnt" PRODUCT_WATER_MMR = "H2OMMR" PRODUCT_OZONE_VMR = "O3VMR" PRODUCT_RELHUM = "RelHum" PRODUCT_TAIR = "TAir" # geo products # This assumes that we will never process more than one instrument at a time PRODUCT_LON = "Longitude" PRODUCT_LAT = "Latitude" GEO_PAIRS = GeoPairDict() BASE_PAIR = "drrtv_nav" GEO_PAIRS.add_pair(BASE_PAIR, PRODUCT_LON, PRODUCT_LAT) PRODUCTS = ProductDict() FT_DRRTV = "file_type_drrtv" # file keys are not specified here, they are determined above in another table (from previous version of this frontend) PRODUCTS.add_product(PRODUCT_CAPE, BASE_PAIR, "CAPE", FT_DRRTV, "CAPE") PRODUCTS.add_product(PRODUCT_CO2_AMOUNT, BASE_PAIR, "co2_amount", FT_DRRTV, "CO2_Amount") PRODUCTS.add_product(PRODUCT_COT, BASE_PAIR, "cloud_optical_thickness", FT_DRRTV, "COT") PRODUCTS.add_product(PRODUCT_CTP, BASE_PAIR, "cloud_top_pressure", FT_DRRTV, "CTP") PRODUCTS.add_product(PRODUCT_CTT, BASE_PAIR, "cloud_top_temperature", FT_DRRTV, "CTT") PRODUCTS.add_product(PRODUCT_CLOUD_EMISSIVITY, BASE_PAIR, "cloud_emissivity", FT_DRRTV, "CldEmis") PRODUCTS.add_product(PRODUCT_CMASK, BASE_PAIR, "category", FT_DRRTV, "Cmask") PRODUCTS.add_product(PRODUCT_LI, BASE_PAIR, "lifted_index", FT_DRRTV,
# Handle products with multiple levels later on when creating the product definitions PRODUCT_DEWPOINT = "Dewpnt" PRODUCT_WATER_MMR = "H2OMMR" PRODUCT_OZONE_VMR = "O3VMR" PRODUCT_RELHUM = "RelHum" PRODUCT_TAIR = "TAir" # geo products # This assumes that we will never process more than one instrument at a time PRODUCT_LON = "Longitude" PRODUCT_LAT = "Latitude" GEO_PAIRS = GeoPairDict() BASE_PAIR = "drrtv_nav" GEO_PAIRS.add_pair(BASE_PAIR, PRODUCT_LON, PRODUCT_LAT) PRODUCTS = ProductDict() FT_DRRTV = "file_type_drrtv" # file keys are not specified here, they are determined above in another table (from previous version of this frontend) PRODUCTS.add_product(PRODUCT_CAPE, BASE_PAIR, "CAPE", FT_DRRTV, "CAPE") PRODUCTS.add_product(PRODUCT_CO2_AMOUNT, BASE_PAIR, "co2_amount", FT_DRRTV, "CO2_Amount") PRODUCTS.add_product(PRODUCT_COT, BASE_PAIR, "cloud_optical_thickness", FT_DRRTV, "COT") PRODUCTS.add_product(PRODUCT_CTP, BASE_PAIR, "cloud_top_pressure", FT_DRRTV, "CTP") PRODUCTS.add_product(PRODUCT_CTT, BASE_PAIR, "cloud_top_temperature", FT_DRRTV, "CTT") PRODUCTS.add_product(PRODUCT_CLOUD_EMISSIVITY, BASE_PAIR, "cloud_emissivity", FT_DRRTV, "CldEmis") PRODUCTS.add_product(PRODUCT_CMASK, BASE_PAIR, "category", FT_DRRTV, "Cmask") PRODUCTS.add_product(PRODUCT_LI, BASE_PAIR, "lifted_index", FT_DRRTV, "Lifted_Index") PRODUCTS.add_product(PRODUCT_SURFPRES, BASE_PAIR, "surface_pressure", FT_DRRTV, "SurfPres") PRODUCTS.add_product(PRODUCT_TSURF, BASE_PAIR, "surface_temperature", FT_DRRTV, "TSurf") PRODUCTS.add_product(PRODUCT_TOT_WATER, BASE_PAIR, "total_water", FT_DRRTV, "totH2O") PRODUCTS.add_product(PRODUCT_TOT_OZONE, BASE_PAIR, "total_ozone", FT_DRRTV, "totO3") # geo products