
import cartopy.crs as ccrs
import numpy as np
import shapely


study = 'ESA project - SMARTCARB'

user_name = 'Gerrit Kuhlmann'
user_email = 'gerrit.kuhlmann@empa.ch'
user_affiliation = 'Empa Duebendorf, Switzerland'


# settings for berlin 2 (big) domain - smartcarb production run
ie       = 700
je       = 600
ke       = 60
pollon   = -170.0  # origin lon: 10.0
pollat   =   43.0  # origin lat: 47.0
dlon     = 0.01
dlat     = 0.01
startlat =  2.5
startlon = -1.4

stoplat = startlat + (je-1) * dlat
stoplon = startlon + (ie-1) * dlon

DOMAIN = shapely.geometry.Polygon([
    (startlon - 0.5 * dlon, startlat - 0.5 * dlat),
    (stoplon  + 0.5 * dlon, startlat - 0.5 * dlat),
    (stoplon  + 0.5 * dlon, stoplat  + 0.5 * dlat),
    (startlon - 0.5 * dlon, stoplat  + 0.5 * dlat)
])

rlon = np.linspace(startlon, stoplon, ie)
rlat = np.linspace(startlat, stoplat, je)

WGS84 = ccrs.PlateCarree()
ROTPOLE = ccrs.RotatedPole(pole_latitude=pollat, pole_longitude=pollon)


r_earth = 6371.0

# default vars and attrs
cosmo_vars = {
    'Sentinel_7_CO2':     ['?CO2_*', 'NO2_*', 'CO_*', 'CLCT'], # also incl. NO2/CO for same sampling
    'Sentinel_7_NO2_1km': ['NO2_*', 'CO_*', 'CLCT'],
    'Sentinel_7_NO2_2km': ['NO2_*', 'CO_*', 'CLCT'],
    'Sentinel_7_NO2_4km': ['NO2_*', 'CO_*', 'CLCT'],
    'Sentinel_5':         ['NO2_*', 'CO_*', 'CLCT']
}
cosmo_attrs = ['standard_name', 'long_name', 'units']


albedo_vars = ['Albedo_NIR', 'Albedo_SWIR']
albedo_attrs = ['standard_name', 'long_name', 'units']


# uncertianty scenarios for instruments
uncertainty_scenarios = {
    'Sentinel_7': {
        'NO2':      ['NO2_BG', 'NO2_TOT'], # total NO2 column
        'uNO2_low':  [0.15, 1e15],         # relative error, smallest error
        'uNO2_high': [0.20, 2e15],
        'CO':       ['CO_BG', 'CO_TOT'],
        'uCO_low':   [0.10, 4e17],
        'uCO_high':  [0.20, 4e17],
    },
    'Sentinel_5': {
        'NO2':      ['NO2_BG', 'NO2_TOT'],
        'uNO2':     [0.20, 1.3e15],
        'CO':       ['CO_BG', 'CO_TOT'],
        'uCO':      [0.10, 4.0e17],
    }
}





