nansat.mappers package

Submodules

nansat.mappers.envisat module

class nansat.mappers.envisat.Envisat

Bases: object

Methods/data shared between Envisat mappers

This class is needed to read awkward N1 format of ENVISAT Mostly it support reading of variables from ADS (additional data sets) which are TIE_POINTS_ADS (MERIS) or GEOLOCATION_GRID_ADS (ASAR)

allADSParams = {'ASA_': {'list': {'first_line_incidence_angle': {'dataType': gdal.GDT_Float32, 'offset': 113, 'units': 'deg'}, 'first_line_lats': {'dataType': gdal.GDT_Int32, 'offset': 157, 'units': '(10)^-6 deg'}, 'first_line_longs': {'dataType': gdal.GDT_Int32, 'offset': 201, 'units': '(10)^-6 deg'}, 'first_line_samp_numbers': {'dataType': gdal.GDT_Float32, 'offset': 25, 'units': ''}, 'first_line_slant_range_times': {'dataType': gdal.GDT_Float32, 'offset': 69, 'units': 'ns'}, 'last_line_incidence_angle': {'dataType': gdal.GDT_Float32, 'offset': 367, 'units': 'deg'}, 'last_line_lats': {'dataType': gdal.GDT_Int32, 'offset': 411, 'units': '(10)^-6 deg'}, 'last_line_longs': {'dataType': gdal.GDT_Int32, 'offset': 455, 'units': '(10)^-6 deg'}, 'last_line_samp_numbers': {'dataType': gdal.GDT_Int32, 'offset': 279, 'units': ''}, 'last_line_slant_range_times': {'dataType': gdal.GDT_Float32, 'offset': 323, 'units': 'ns'}, 'num_lines': {'dataType': gdal.GDT_Int16, 'offset': 13, 'units': ''}}, 'name': 'DS_NAME="GEOLOCATION GRID ADS        "\n', 'width': 11}, 'MER_': {'list': {'DME altitude': {'dataType': gdal.GDT_Int32, 'offset': 581, 'units': 'm'}, 'DME latitude corrections': {'dataType': gdal.GDT_Int32, 'offset': 1149, 'units': '(10)^-6 deg'}, 'DME longitude corrections': {'dataType': gdal.GDT_Int32, 'offset': 1433, 'units': '(10)^-6 deg'}, 'DME roughness': {'dataType': gdal.GDT_UInt32, 'offset': 865, 'units': 'm'}, 'latitude': {'dataType': gdal.GDT_Int32, 'offset': 13, 'units': '(10)^-6 deg'}, 'longitude': {'dataType': gdal.GDT_Int32, 'offset': 297, 'units': '(10)^-6 deg'}, 'mean sea level pressure': {'dataType': gdal.GDT_UInt16, 'offset': 3137, 'units': 'hPa'}, 'meridional winds': {'dataType': gdal.GDT_Int16, 'offset': 2995, 'units': 'm*s-1'}, 'relative humidity': {'dataType': gdal.GDT_UInt16, 'offset': 3421, 'units': '%'}, 'sun azimuth angles': {'dataType': gdal.GDT_Int32, 'offset': 2001, 'units': '(10)^-6 deg'}, 'sun zenith angles': {'dataType': gdal.GDT_UInt32, 'offset': 1717, 'units': '(10)^-6 deg'}, 'total ozone': {'dataType': gdal.GDT_UInt16, 'offset': 3279, 'units': 'DU'}, 'viewing azimuth angles': {'dataType': gdal.GDT_Int32, 'offset': 2569, 'units': '(10)^-6 deg'}, 'viewing zenith angles': {'dataType': gdal.GDT_UInt32, 'offset': 2285, 'units': '(10)^-6 deg'}, 'zonal winds': {'dataType': gdal.GDT_Int16, 'offset': 2853, 'units': 'm*s-1'}}, 'name': 'DS_NAME="Tie points ADS              "\n', 'width': 71}}
structFmt = {gdal.GDT_Int16: '>h', gdal.GDT_UInt16: '>H', gdal.GDT_Int32: '>i', gdal.GDT_UInt32: '>I', gdal.GDT_Float32: '>f'}
lonlatNames = {'ASA_': ['first_line_longs', 'first_line_lats'], 'MER_': ['longitude', 'latitude']}
setup_ads_parameters(filename, gdalMetadata)

Select set of params and read offset of ADS

read_offset_from_header(gadsDSName)

Read offset of ADS from text header.

Find a location of gadsDSName. Adjust the location with textOffset and read the text at the location. Convert the text to integer and set it into offsetDict.

Returns

offsetDict – offset of DS, size of DS, number of records, size of record

Return type

dictionary

read_binary_line(offset, fmtString, length)

Read line with binary data at given offset

Open file Read values of given size, at given offset, given times Convert to list of values of given format and return

Parameters
  • offset (int, start of reading) –

  • fmtString (str, data type format) –

  • lentgh (number of values to read) –

Returns

binaryValues – values which are read from the file. the number of elements is length

Return type

list

read_scaling_gads(indeces)

Read Scaling Factor GADS to get scalings of MERIS L1/L2

Parameters
  • filename (string) –

  • indeces (list) –

Return type

list

get_array_from_ADS(adsName)

Create VRT with a band from Envisat ADS metadata

Read offsets of the <adsName> ADS. Read 2D matrix of binary values from ADS from file. Read last line ADS (in case of ASAR). Zoom array with ADS data to <zoomSize>. Zooming is needed to create smooth matrices. Array is zoomed to small size because it is stred in memory. Later the VRT with zoomed array is VRT.get_resized_vrt() in order to match the size of the Nansat onject. Create VRT from the ADS array.

Parameters

adsName (str) – name of variable from ADS to read. should match allADSParams

Returns

adsVrt – vrt with a band created from ADS array

Return type

VRT

create_VRT_from_ADS(adsName, zoomSize=500)

Create VRT with a band from Envisat ADS metadata

Read offsets of the <adsName> ADS. Read 2D matrix of binary values from ADS from file. Zoom array with ADS data to <zoomSize>. Zooming is needed to create smooth matrices. Array is zoomed to small size because it is stred in memory. Later the VRT with zoomed array is VRT.get_resized_vrt() in order to match the size of the Nansat object.

Create VRT from the ADS array.

Parameters
  • adsName (str) – name of variable from ADS to read. should match allADSParams

  • zoomSize (int, optional, 500) – size, to which original matrix from ADSR is zoomed using scipy.zoom

Returns

adsVrt

Return type

VRT, vrt with a band created from ADS array

get_ads_vrts(gdalDataset, adsNames, zoomSize=500, step=1, **kwargs)

Create list with VRTs with zoomed and resized ADS arrays

For given names of variables (which should match self.allADSParams):

Get VRT with zoomed ADS array Get resized VRT

Parameters
  • gdalDataset (GDAL Dataset) – input dataset

  • adsNames (list with strings) – names of varaiables from self.allADSParams[‘list’]

  • zoomSize (int, 500) – size to which the ADS array will be zoomed by scipy.zoom

  • step (int, 1) – step, at which data will be given

Returns

adsVRTs – list with resized VRT with zoomed arrays

Return type

list with VRT

add_geolocation_from_ads(gdalDataset, zoomSize=500, step=1)

Add geolocation domain metadata to the dataset

Get VRTs with zoomed arrays of lon and lat Create geolocation object and add to the metadata

Parameters
  • gdalDataset (GDAL Dataset) – input dataset

  • zoomSize (int, optional, 500) – size, to which the ADS array will be zoomed using scipy array of this size will be stored in memory

  • step (int) – step of pixel and line in GeolocationArrays. lat/lon grids are generated at that step

  • Modifies

  • --------

  • metadata (Adds Geolocation Array) –

nansat.mappers.globcolour module

class nansat.mappers.globcolour.Globcolour

Bases: object

Mapper for GLOBCOLOR L3M products

varname2wkv = {'BBP_mean': 'volume_backscattering_coefficient_of_radiative_flux_in_sea_water_due_to_suspended_particles', 'CDM_mean': 'volume_absorption_coefficient_of_radiative_flux_in_sea_water_due_to_dissolved_organic_matter', 'CHL1_mean': 'mass_concentration_of_chlorophyll_a_in_sea_water', 'CHL2_mean': 'mass_concentration_of_chlorophyll_a_in_sea_water', 'KD490_mean': 'volume_attenuation_coefficient_of_downwelling_radiative_flux_in_sea_water', 'L412_mean': 'surface_upwelling_spectral_radiance_in_air_emerging_from_sea_water', 'L443_mean': 'surface_upwelling_spectral_radiance_in_air_emerging_from_sea_water', 'L490_mean': 'surface_upwelling_spectral_radiance_in_air_emerging_from_sea_water', 'L510_mean': 'surface_upwelling_spectral_radiance_in_air_emerging_from_sea_water', 'L531_mean': 'surface_upwelling_spectral_radiance_in_air_emerging_from_sea_water', 'L555_mean': 'surface_upwelling_spectral_radiance_in_air_emerging_from_sea_water', 'L620_mean': 'surface_upwelling_spectral_radiance_in_air_emerging_from_sea_water', 'L670_mean': 'surface_upwelling_spectral_radiance_in_air_emerging_from_sea_water', 'L681_mean': 'surface_upwelling_spectral_radiance_in_air_emerging_from_sea_water', 'L709_mean': 'surface_upwelling_spectral_radiance_in_air_emerging_from_sea_water', 'PAR_mean': 'surface_downwelling_photosynthetic_radiative_flux_in_air'}
make_rrsw_meta_entry(nlwMetaEntry)

Make metaEntry for calculation of Rrsw

nansat.mappers.hdf4_mapper module

class nansat.mappers.hdf4_mapper.HDF4Mapper(x_size=1, y_size=1, metadata=None, nomem=False, **kwargs)

Bases: nansat.vrt.VRT

find_metadata(iMetadata, iKey, default='')

Find metadata which has similar key

Parameters
  • iMetadata (dict) – input metadata, usually gdalMetadata

  • iKey (str) – key to search for

  • default (str) – default value

nansat.mappers.mapper_aapp_l1b module

class nansat.mappers.mapper_aapp_l1b.Mapper(filename, gdalDataset, gdalMetadata, **kwargs)

Bases: nansat.vrt.VRT

VRT with mapping of WKV for AVHRR L1B output from AAPP

nansat.mappers.mapper_aapp_l1c module

class nansat.mappers.mapper_aapp_l1c.Mapper(filename, gdalDataset, gdalMetadata, **kwargs)

Bases: nansat.vrt.VRT

VRT with mapping of WKV for AVHRR L1C output from AAPP

nansat.mappers.mapper_amsr2_l1r module

class nansat.mappers.mapper_amsr2_l1r.Mapper(filename, gdalDataset, gdalMetadata, GCP_STEP=20, MAX_LAT=90, MIN_LAT=50, resolution='low', **kwargs)

Bases: nansat.vrt.VRT

Mapper for AMSR-2 L1 data

nansat.mappers.mapper_amsr2_l3 module

class nansat.mappers.mapper_amsr2_l3.Mapper(filename, gdalDataset, gdalMetadata, **kwargs)

Bases: nansat.vrt.VRT

Mapper for Level-3 AMSR2 data from https://gcom-w1.jaxa.jp

freqs = [6, 7, 10, 18, 23, 36, 89]

nansat.mappers.mapper_amsre_uham_leadfraction module

class nansat.mappers.mapper_amsre_uham_leadfraction.Mapper(filename, gdalDataset, gdalMetadata, **kwargs)

Bases: nansat.vrt.VRT

nansat.mappers.mapper_arome module

class nansat.mappers.mapper_arome.Mapper(*args, **kwargs)

Bases: nansat.mappers.mapper_netcdf_cf.Mapper

nansat.mappers.mapper_asar module

class nansat.mappers.mapper_asar.Mapper(filename, gdalDataset, gdalMetadata, **kwargs)

Bases: nansat.vrt.VRT, nansat.mappers.envisat.Envisat

VRT with mapping of WKV for ASAR Level 1

See also

http

//envisat.esa.int/handbooks/asar/CNTR6-6-9.htm#eph.asar.asardf.asarrec.ASAR_Geo_Grid_ADSR

nansat.mappers.mapper_ascat module

class nansat.mappers.mapper_ascat.Mapper(filename, gdal_dataset, metadata, quartile=0, *args, **kwargs)

Bases: nansat.mappers.scatterometers.Mapper

Nansat mapper for ASCAT

times()

Get times from time variable

nansat.mappers.mapper_aster_l1a module

class nansat.mappers.mapper_aster_l1a.Mapper(filename, gdalDataset, gdalMetadata, GCP_COUNT=10, bandNames=['VNIR_Band1', 'VNIR_Band2', 'VNIR_Band3N'], bandWaves=[560, 660, 820], **kwargs)

Bases: nansat.vrt.VRT

Mapper for ASTER L1A VNIR data

nansat.mappers.mapper_aster_l1b module

nansat.mappers.mapper_case2reg module

class nansat.mappers.mapper_case2reg.Mapper(filename, gdalDataset, gdalMetadata, wavelengths=[None, 413, 443, 490, 510, 560, 620, 665, 681, 709, 753, None, 778, 864], **kwargs)

Bases: nansat.mappers.mapper_generic.Mapper

Mapping for the BEAM/Visat output of Case2Regional algorithm

nansat.mappers.mapper_cmems module

nansat.mappers.mapper_cmems.get_gcmd_keywords_mapping()
class nansat.mappers.mapper_cmems.Mapper(*args, **kwargs)

Bases: nansat.mappers.mapper_netcdf_cf.Mapper

time_coverage()

nansat.mappers.mapper_csks module

class nansat.mappers.mapper_csks.Mapper(filename, gdalDataset, gdalMetadata, **kwargs)

Bases: nansat.vrt.VRT

VRT with mapping of WKV for Cosmo-Skymed

nansat.mappers.mapper_ecmwf_metno module

class nansat.mappers.mapper_ecmwf_metno.Mapper(*args, **kwargs)

Bases: nansat.mappers.mapper_netcdf_cf.Mapper

nansat.mappers.mapper_emodnet module

class nansat.mappers.mapper_emodnet.Mapper(inputFileName, gdalDataset, gdalMetadata, logLevel=30, **kwargs)

Bases: nansat.vrt.VRT

nansat.mappers.mapper_generic module

class nansat.mappers.mapper_generic.Mapper(inputFileName, gdalDataset, gdalMetadata, logLevel=30, rmMetadatas=['NETCDF_VARNAME', '_Unsigned', 'ScaleRatio', 'ScaleOffset', 'dods_variable'], **kwargs)

Bases: nansat.vrt.VRT

repare_projection(projection)

Replace odd symbols in projection string ‘|’ => ‘,’; ‘&’ => ‘”’

add_gcps_from_metadata(geoMetadata)

Get GCPs from strings in metadata and insert in dataset

add_gcps_from_variables(filename)

Get GCPs from GCPPixel, GCPLine, GCPX, GCPY, GCPZ variables

nansat.mappers.mapper_geostationary module

nansat.mappers.mapper_geostationary.arrays2LUTString(a, b)
class nansat.mappers.mapper_geostationary.Mapper(filename, gdalDataset, gdalMetadata, **kwargs)

Bases: nansat.vrt.VRT

VRT with mapping of WKV for Geostationary satellite data

calibration()

get calibration data for Geostationary satellites

Returns

satDict – calibration data for satellite ‘name’, ‘wavelengths’, ‘scale’, ‘offset’

Return type

dicts

nansat.mappers.mapper_globcolour_l3b module

class nansat.mappers.mapper_globcolour_l3b.Mapper(filename, gdalDataset, gdalMetadata, latlonGrid=None, mask='', **kwargs)

Bases: nansat.vrt.VRT, nansat.mappers.globcolour.Globcolour

Create VRT with mapping of WKV for MERIS Level 2 (FR or RR)

nansat.mappers.mapper_globcolour_l3m module

class nansat.mappers.mapper_globcolour_l3m.Mapper(filename, gdalDataset, gdalMetadata, **kwargs)

Bases: nansat.vrt.VRT, nansat.mappers.globcolour.Globcolour

Mapper for GLOBCOLOR L3M products

nansat.mappers.mapper_goci_l1 module

class nansat.mappers.mapper_goci_l1.Mapper(filename, gdalDataset, gdalMetadata, **kwargs)

Bases: nansat.vrt.VRT

VRT with mapping of WKV for MODIS Level 1 (QKM, HKM, 1KM)

nansat.mappers.mapper_hirlam module

class nansat.mappers.mapper_hirlam.Mapper(filename, gdalDataset, gdalMetadata, **kwargs)

Bases: nansat.vrt.VRT

VRT with mapping of WKV for HIRLAM

nansat.mappers.mapper_hirlam_wind_netcdf module

class nansat.mappers.mapper_hirlam_wind_netcdf.Mapper(filename, gdalDataset, gdalMetadata, logLevel=30, **kwargs)

Bases: nansat.vrt.VRT

nansat.mappers.mapper_kmss module

class nansat.mappers.mapper_kmss.Mapper(filename, gdalDataset, gdalMetadata, **kwargs)

Bases: nansat.vrt.VRT

VRT with mapping of WKV for KMSS TOA tiff data

nansat.mappers.mapper_landsat module

class nansat.mappers.mapper_landsat.Mapper(filename, gdalDataset, gdalMetadata, resolution='low', **kwargs)

Bases: nansat.vrt.VRT

Mapper for LANDSAT5,6,7,8 .tar.gz or tif files

nansat.mappers.mapper_meris_l1 module

class nansat.mappers.mapper_meris_l1.Mapper(filename, gdalDataset, gdalMetadata, geolocation=False, zoomSize=500, step=1, **kwargs)

Bases: nansat.vrt.VRT, nansat.mappers.envisat.Envisat

VRT with mapping of WKV for MERIS Level 1 (FR or RR)

nansat.mappers.mapper_meris_l2 module

class nansat.mappers.mapper_meris_l2.Mapper(filename, gdalDataset, gdalMetadata, geolocation=False, zoomSize=500, step=1, **kwargs)

Bases: nansat.vrt.VRT, nansat.mappers.envisat.Envisat

Create VRT with mapping of WKV for MERIS Level 2 (FR or RR)

nansat.mappers.mapper_metno_hires_seaice module

class nansat.mappers.mapper_metno_hires_seaice.Mapper(filename, gdalDataset, gdalMetadata, **kwargs)

Bases: nansat.vrt.VRT

Create VRT with mapping of WKV for Met.no seaice

nansat.mappers.mapper_metno_local_hires_seaice module

class nansat.mappers.mapper_metno_local_hires_seaice.Mapper(filename, gdalDataset, gdalMetadata, **kwargs)

Bases: nansat.mappers.mapper_generic.Mapper

Create VRT with mapping of WKV for Met.no seaice

nansat.mappers.mapper_mod44w module

class nansat.mappers.mapper_mod44w.Mapper(filename, gdalDataset, gdalMetadata, **kwargs)

Bases: nansat.vrt.VRT

VRT with mapping of WKV for MOD44W produc (MODIS watermask at 250 m)

nansat.mappers.mapper_modis_l1 module

class nansat.mappers.mapper_modis_l1.Mapper(filename, gdalDataset, gdalMetadata, GCP_COUNT=30, **kwargs)

Bases: nansat.mappers.hdf4_mapper.HDF4Mapper

VRT with mapping of WKV for MODIS Level 1 (QKM, HKM, 1KM)

nansat.mappers.mapper_ncep module

class nansat.mappers.mapper_ncep.Mapper(filename, gdalDataset, gdalMetadata, **kwargs)

Bases: nansat.vrt.VRT

VRT with mapping of WKV for NCEP GFS

nansat.mappers.mapper_ncep_wind module

class nansat.mappers.mapper_ncep_wind.Mapper(filename, gdalDataset, gdalMetadata, **kwargs)

Bases: nansat.vrt.VRT

VRT with mapping of WKV for NCEP GFS

nansat.mappers.mapper_ncep_wind_online module

class nansat.mappers.mapper_ncep_wind_online.Mapper(filename, gdalDataset, gdalMetadata, outFolder='/home/docs/ncep_gfs_downloads', **kwargs)

Bases: nansat.vrt.VRT, object

VRT with mapping of WKV for NCEP GFS

nansat.mappers.mapper_netcdf_cf module

Nansat NetCDF-CF mapper

Check CF-compliance of your files here: http://cfconventions.org/compliance-checker.html

exception nansat.mappers.mapper_netcdf_cf.ContinueI

Bases: Exception

class nansat.mappers.mapper_netcdf_cf.Mapper(filename, gdal_dataset, gdal_metadata, *args, **kwargs)

Bases: nansat.vrt.VRT

input_filename = ''
times()

Get times from time variable

NOTE: This cannot be done with gdal because the time variable is a vector

nansat.mappers.mapper_netcdf_cf_sentinel1 module

class nansat.mappers.mapper_netcdf_cf_sentinel1.Mapper(filename, gdal_dataset, gdal_metadata, *args, **kwargs)

Bases: nansat.mappers.sentinel1.Sentinel1, nansat.mappers.mapper_netcdf_cf.Mapper

add_calibrated_nrcs()
add_nrcs_VV_from_HH()

nansat.mappers.mapper_nora10_local_vpv module

class nansat.mappers.mapper_nora10_local_vpv.Mapper(filename, gdalDataset, gdalMetadata, logLevel=30, **kwargs)

Bases: nansat.vrt.VRT

nansat.mappers.mapper_obpg_l2 module

class nansat.mappers.mapper_obpg_l2.Mapper(filename, gdalDataset, gdalMetadata, GCP_COUNT=10, **kwargs)

Bases: nansat.mappers.obpg.OBPGL2BaseClass

Mapper for SeaWIFS/MODIS/MERIS/VIIRS L2 data from OBPG

TODO: * Test on SeaWIFS * Test on MODIS Terra

nansat.mappers.mapper_obpg_l2_nc module

class nansat.mappers.mapper_obpg_l2_nc.Mapper(filename, gdalDataset, gdalMetadata, GCP_COUNT=10, **kwargs)

Bases: nansat.mappers.obpg.OBPGL2BaseClass

Mapper for SeaWIFS/MODIS/MERIS/VIIRS L2 data from OBPG in NC4 format

nansat.mappers.mapper_obpg_l3 module

class nansat.mappers.mapper_obpg_l3.Mapper(filename, gdalDataset, gdalMetadata, **kwargs)

Bases: nansat.vrt.VRT

Mapper for Level-3 Standard Mapped Image from http://oceancolor.gsfc.nasa.gov

param2wkv = {'CDOM Index': 'volume_absorption_coefficient_of_radiative_flux_in_sea_water_due_to_dissolved_organic_matter', 'Chlorophyll a concentration': 'mass_concentration_of_chlorophyll_a_in_sea_water', 'Chlorophyll a concentration, Garver-Siegel-Maritorena Model': 'mass_concentration_of_chlorophyll_a_in_sea_water', 'Diffuse attenuation coefficient': 'volume_attenuation_coefficient_of_downwelling_radiative_flux_in_sea_water', 'Instantaneous Photosynthetically Available Radiation': 'instantaneous_downwelling_photosynthetic_photon_radiance_in_sea_water', 'Particle backscatter at 443 nm': 'volume_backscattering_coefficient_of_radiative_flux_in_sea_water_due_to_suspended_particles', 'Photosynthetically Available Radiation': 'downwelling_photosynthetic_photon_radiance_in_sea_water', 'Remote sensing reflectance': 'surface_ratio_of_upwelling_radiance_emerging_from_sea_water_to_downwelling_radiative_flux_in_air', 'Sea Surface Salinity': 'sea_surface_salinity', 'Sea Surface Temperature': 'sea_surface_temperature'}

nansat.mappers.mapper_ocean_productivity module

class nansat.mappers.mapper_ocean_productivity.Mapper(filename, gdalDataset, gdalMetadata, **kwargs)

Bases: nansat.vrt.VRT

Mapper for Ocean Productivity website http://www.science.oregonstate.edu/ocean.productivity/

param2wkv = {'bbp': 'particle_backscatter_at_443_nm', 'chl': 'mass_concentration_of_chlorophyll_a_in_sea_water', 'ipar': 'instantaneous_downwelling_photosynthetic_photon_radiance_in_sea_water', 'par': 'downwelling_photosynthetic_photon_radiance_in_sea_water', 'sst': 'sea_surface_temperature'}
bandNames = {'instantaneous_downwelling_photosynthetic_photon_radiance_in_sea_water': 'ipar', 'mass_concentration_of_chlorophyll_a_in_sea_water': 'algal_1', 'particle_backscatter_at_443_nm': 'bbp_443', 'sea_surface_temperature': 'SST'}

nansat.mappers.mapper_opendap_arome module

class nansat.mappers.mapper_opendap_arome.Mapper(filename, gdal_dataset, gdal_metadata, date=None, ds=None, bands=None, cachedir=None, *args, **kwargs)

Bases: nansat.mappers.opendap.Opendap, nansat.mappers.mapper_arome.Mapper

baseURLs = ['http://thredds.met.no/thredds/catalog/arome25/catalog.html', 'https://thredds.met.no/thredds/dodsC/aromearcticarchive', 'http://thredds.met.no/thredds/dodsC/aromearcticarchive', 'https://thredds.met.no/thredds/dodsC/meps25epsarchive', 'http://thredds.met.no/thredds/dodsC/meps25epsarchive']
timeVarName = 'time'
xName = 'x'
yName = 'y'
timeCalendarStart = '1970-01-01'
static get_date(filename)

Extract date and time parameters from filename and return it as a formatted string

Parameters

filename (str) – nn

Returns

str, YYYY-mm-ddThh

Return type

MMZ

Examples

>>> Mapper.get_date('/path/to/arome_arctic_full_2_5km_20171030T21Z.nc')
'2017-10-30T21:00Z'
convert_dstime_datetimes(ds_time)

Convert time variable to np.datetime64

nansat.mappers.mapper_opendap_globcurrent module

nansat.mappers.mapper_opendap_globcurrent_thredds module

nansat.mappers.mapper_opendap_mywave module

class nansat.mappers.mapper_opendap_mywave.Mapper(filename, gdal_dataset, gdal_metadata, date=None, ds=None, bands=None, cachedir=None, *args, **kwargs)

Bases: nansat.mappers.opendap.Opendap

baseURLs = ['http://thredds.met.no/thredds/dodsC/fou-hi/mywavewam4archive', 'https://thredds.met.no/thredds/dodsC/sea/mywavewam4/mywavewam4_be']
timeVarName = 'time'
xName = 'rlon'
yName = 'rlat'
timeCalendarStart = '1970-01-01'
static get_date(filename)

Extract date and time parameters from filename and return it as a formatted (isoformat) string

Parameters

filename (str) –

Returns

str, YYYY-mm-ddThh

Return type

MM:00Z

Examples

>>> Mapper.get_date('/path/to/MyWave_wam4_WAVE_20171029T18Z.nc')
'2017-10-29T18:00:00Z'
convert_dstime_datetimes(ds_time)

Convert time variable to np.datetime64

nansat.mappers.mapper_opendap_occci module

nansat.mappers.mapper_opendap_osisaf module

nansat.mappers.mapper_opendap_ostia module

nansat.mappers.mapper_opendap_sentinel1 module

nansat.mappers.mapper_opendap_sentinel2 module

class nansat.mappers.mapper_opendap_sentinel2.Mapper(filename, gdal_dataset, gdal_metadata, date=None, ds=None, bands=None, cachedir=None, *args, **kwargs)

Bases: nansat.mappers.opendap.Opendap

baseURLs = ['http://nbstds.met.no/thredds/dodsC/NBS/S2A', 'http://nbstds.met.no/thredds/dodsC/NBS/S2B']
timeVarName = 'time'
xName = 'x'
yName = 'y'
timeCalendarStart = '1981-01-01'
GCP_STEP = 100
static get_date(filename)

Extract date and time parameters from filename and return it as a formatted (isoformat) string

Parameters

filename (str) – nn

Returns

str, YYYY-mm-ddThh

Return type

MMZ

convert_dstime_datetimes(ds_time)

Convert time variable to np.datetime64

nansat.mappers.mapper_opendap_siwtacsst module

nansat.mappers.mapper_opendap_sstcci module

nansat.mappers.mapper_pathfinder52 module

class nansat.mappers.mapper_pathfinder52.Mapper(filename, gdalDataset, gdalMetadata, minQual=4, **kwargs)

Bases: nansat.vrt.VRT

Mapper PATHFINDER (local files)

TODO: * remote files

nansat.mappers.mapper_quikscat module

class nansat.mappers.mapper_quikscat.Mapper(filename, gdal_dataset, metadata, quartile=0, *args, **kwargs)

Bases: nansat.mappers.scatterometers.Mapper

Nansat mapper for QuikScat

nansat.mappers.mapper_radarsat2 module

class nansat.mappers.mapper_radarsat2.Mapper(inputFileName, gdalDataset, gdalMetadata, xmlonly=False, **kwargs)

Bases: nansat.vrt.VRT

Create VRT with mapping of WKV for Radarsat2

init_from_xml(productXml, filename)

Fast init from metada in XML only

nansat.mappers.mapper_sentinel1_l1 module

class nansat.mappers.mapper_sentinel1_l1.Mapper(filename, gdalDataset, gdalMetadata, fast=False, fixgcp=True, **kwargs)

Bases: nansat.vrt.VRT

Create VRT with mapping of Sentinel-1 (A and B) stripmap mode (S1A_SM)

Parameters
  • filename (str) – name of input Sentinel-1 L1 file

  • gdalDataset (None) –

  • gdalMetadata (None) –

  • fast (bool) – Flag that triggers faster reading of metadata from Sentinel-1 file. If True, no bands are added to the dataset and georeference is not corrected. If False, all bands are added and GCPs are corrected if necessary (see Mapper.correct_geolocation_data for details).

Note

Creates self.dataset and populates it with S1 bands (when fast=False).

read_calibration(xml, vectorListName, variable_names, pol)

Read calibration data from calibration or noise XML files :param xml: String with XML from calibration or noise files :type xml: str :param vectorListName: tag of the element that contains lists with LUT values :type vectorListName: str :param variable_names: names of LUT variable to read :type variable_names: list of str :param pol: HH, HV, etc :type pol: str

Returns

data – Calibration or noise data. Keys: The same as variable_names + ‘pixel’, ‘line’

Return type

dict

read_annotation(annotation_files)

Read lon, lat, etc from annotation XML

Parameters

annotation_files (list) – strings with names of annotation files

Returns

data

geolocation data from the XML as 2D np.arrays. Keys:

pixel, line, longitude, latitude, height, incidenceAngle, elevationAngle: 2D arrays shape : tuple (shape of geolocation data arrays) x_size, y_size : int pol : list

Return type

dict

correct_geolocation_data()

Correct lon/lat values in geolocation data for points high above ground (incorrect)

Each GCP in Sentinel-1 L1 image (both in the GeoTIF files and Annotation LUT) have five coordinates: X, Y, Z (height), Pixel and Line. On some scenes that cover Greenland (and probably other lands) some GCPs have height above zero even over ocean. This is incorrect, because the radar signal comes actually from the surface and not from a point above the ground as stipulated in such GCPs. Correction of GCPs in this function is equivalelnt to reverse DEM correction of SAR data.

Notes

Updates ‘pixel’ and ‘height’ in self.annotation_data

static create_gcps(x, y, z, p, l)

Create GCPs from geolocation data

Parameters
  • x

  • y

  • z

  • p

  • l

  • X (N-D arrays with value of) –

  • Y

  • Z

  • coordinates. (Pixel and Line) –

  • lon (X and Y are typically) –

  • lat

  • height. (Z -) –

Returns

gcps

Return type

list with GDAL GCPs

read_manifest_data(input_file)

Read information (time_coverage_start, etc) manifest XML

Parameters

input_file (str) – name of manifest file

Returns

data

manifest data. Keys:

time_coverage_start time_coverage_end platform_familyName platform_number

Return type

dict

vrts_from_arrays(data, variable_names, pol='', resize=True, resample_alg=2)

Convert input dict with arrays into dict with VRTs

Parameters
  • data (dict) – 2D arrays with data from LUT

  • variable_names (list of str) – variable names that should be converted to VRTs

  • pol (str) – HH, HV, etc

  • resize (bool) – Shall VRT be zoomed to full size?

  • resample_alg (int) – Index of resampling algorithm. See VRT.get_resized_vrt()

Returns

vrts

Return type

dict with (resized) VRTs

nansat.mappers.mapper_sentinel1_l2 module

class nansat.mappers.mapper_sentinel1_l2.Mapper(filename, gdalDataset, gdalMetadata, product_type='RVL', GCP_COUNT=10, **kwargs)

Bases: nansat.vrt.VRT

Create VRT with mapping of Sentinel-1A stripmap mode (S1A_SM)

nansat.mappers.mapper_topography module

class nansat.mappers.mapper_topography.Mapper(filename, gdal_dataset, *args, **kwargs)

Bases: nansat.vrt.VRT

Mapping for the GTOPO30 (https://lta.cr.usgs.gov/GTOPO30) and the GMTED2010 (https://lta.cr.usgs.gov/GMTED2010) global elevation models.

Parameters
  • filename (string) – The vrt filename, e.g., gtopo30.vrt

  • gdal_dataset (osgeo.gdal.Dataset) – The GDAL dataset returned by gdal.Open(filename)

Example

You can create your own gtopo30.vrt file with gdal, e.g.:

gdalbuildvrt <dem>.vrt [E,W]*.DEM

Note

Either the name of a GTOPO30 DEM file or GMTED2010 tif file, or <path>/<dem>.vrt. The latter is an aggregation of the DEM-files available from the given DEM. The GTOPO30 vrt does not contain the Antarctic, because this is in polarstereographic projection.

Remember to update this mapper by adding allowed filenames to the list of accepted filenames (accepted_names) if you create or apply new DEM datasets.

nansat.mappers.mapper_viirs_l1 module

class nansat.mappers.mapper_viirs_l1.Mapper(filename, gdalDataset, gdalMetadata, GCP_COUNT0=5, GCP_COUNT1=20, pixelStep=1, lineStep=1, **kwargs)

Bases: nansat.vrt.VRT

VRT with mapping of WKV for VIIRS Level 1B

nansat.mappers.obpg module

class nansat.mappers.obpg.OBPGL2BaseClass(x_size=1, y_size=1, metadata=None, nomem=False, **kwargs)

Bases: nansat.vrt.VRT

Base Class for Mappers for SeaWIFS/MODIS/MERIS/VIIRS L2 data from OBPG

titles = ['HMODISA Level-2 Data', 'MODISA Level-2 Data', 'HMODIST Level-2 Data', 'MERIS Level-2 Data', 'GOCI Level-2 Data', 'VIIRSN Level-2 Data', 'SeaWiFS Level-2 Data']

nansat.mappers.opendap module

class nansat.mappers.opendap.Opendap(x_size=1, y_size=1, metadata=None, nomem=False, **kwargs)

Bases: nansat.vrt.VRT

Methods for all OpenDAP mappers

P2S = {'D': 86400, 'H': 3600, 'M': 2592000, 'Y': 31536000}
test_mapper(filename)

Tests if filename fits mapper. May raise WrongMapperError

Parameters

filename (str) – absolute url of input file

Raises

WrongMapperError – if input url does not match with list of: urls for a mapper

get_dataset(ds)

Open Dataset

Parameters

ds (str or netCDF4.Dataset) –

get_geospatial_variable_names()

Get names of variables with both spatial dimensions

get_dataset_time()

Load data from time variable

static get_layer_datetime(date, datetimes)

Get datetime of the matching layer and layer number

get_metaitem(url, var_name, var_dimensions)

Set metadata for creating band VRT

Parameters
  • url (str,) – absolute url of an input file

  • var_name (str,) – name of a variable/band from netCDF file

  • var_dimensions – iterable array with dimensions of the variable

create_vrt(filename, gdalDataset, gdalMetadata, date, ds, bands, cachedir)

Create VRT

Parameters
  • filename (str,) – absolute url of an input file

  • date (str,) – date in format YYYY-MM-DD

  • ds (netDCF.Dataset) –

  • bands (list) – list of src bands

  • cachedir (str) –

create_metadict(filename, var_names, time_id)

Create list which contains a dictionary with metadata for each single band

Parameters
  • filename (str,) – full path to the file

  • var_names (iterable,) – iterable object (list) with required band names (str)

  • time_id (int,) – index of required slice in time dimension

Returns

meta_dict – list which contains a dictionary with metadata for each <var_name>

Return type

list

get_time_coverage_resolution()

Try to fecth time_coverage_resolution and convert to seconds

get_shape()

Get srcRasterXSize and srcRasterYSize from OpenDAP

get_geotransform()

Get first two values of X,Y variables and create geoTranform

nansat.mappers.scatterometers module

class nansat.mappers.scatterometers.Mapper(filename, gdal_dataset, metadata, quartile=0, *args, **kwargs)

Bases: nansat.mappers.mapper_netcdf_cf.Mapper

Nansat mapper for scatterometers

set_gcps(lon, lat, gdal_dataset)

Set gcps

static shift_longitudes(lon)

Apply correction of longitudes (they are defined on 0:360 degrees but also contain egative values)

TODO: consider making this core to nansat - different ways of defining longitudes (-180:180 og 0:360 degrees) often cause problems…

nansat.mappers.sentinel1 module

class nansat.mappers.sentinel1.Sentinel1(filename, flip_gcp_line=False)

Bases: nansat.vrt.VRT

Mapper class to access Sentinel-1 data with netCDF4 to work for both opendap streams and local files.

timeVarName = 'time'
input_filename = ''
set_gcmd_dif_keywords()
get_gcps(flip_gcp_line=False)

Get Ground Control Points for the dataset.

Note that OPeNDAP streams and netCDF files are read differently by gdal. The OPeNDAP streams are read by specifying the get parameters to the OPeNDAP url. The get parameters specify the reference dimensions, e.g., x and y. Since these are specified, the raster data is correctly referenced to the GCPs. However, when gdal reads a raster band from netCDF, it reads it “blindly”. This is risky, since the definition of origo may be different in gdal vs the original data (e.g., first line starts in upper left corner or in lower left corner). For Sentinel-1, the raster data is flipped in relation to the GCPs, so we need to flip the GCP line vector as well.

add_incidence_angle_band()
get_full_size_GCPs()
add_look_direction_band()

Module contents