In [1]:
from nansat import *
In [9]:
n = Nansat('/vagrant/shared/test_data/meris_l1/MER_FRS_1PNPDK20120303_093810_000000333112_00180_52349_3561.N1')
In [10]:
n.export2thredds?
In [11]:
d = Domain(NSR().wkt, ds=n.vrt.dataset)
n.reproject(d)
n.crop(xOff=2000, yOff=500, xSize=500, ySize=500)
print n
----------------------------------------
/vagrant/shared/test_data/meris_l1/MER_FRS_1PNPDK20120303_093810_000000333112_00180_52349_3561.N1
----------------------------------------
Mapper: meris_l1
----------------------------------------
Band : 1 L_413
units: mW m-2 sr-1 (cm-1)-1
colormap: jet
short_name: L
dataType: 6
long_name: top of atmosphere emitted toward outer space per unit wavenumber or as a function of wavenumber radiative flux in a particular direction, per unit of solid angle
standard_name: toa_outgoing_spectral_radiance
wavelength: 413
suffix: 413
SourceFilename: /vsimem/BMB0E75WYF.vrt
time: 2012-03-03T09:38:10.423969
minmax: 0.000 1000
SourceBand: 1
wkv: toa_outgoing_spectral_radiance
name: L_413
Band : 2 L_443
units: mW m-2 sr-1 (cm-1)-1
colormap: jet
short_name: L
dataType: 6
long_name: top of atmosphere emitted toward outer space per unit wavenumber or as a function of wavenumber radiative flux in a particular direction, per unit of solid angle
standard_name: toa_outgoing_spectral_radiance
wavelength: 443
suffix: 443
SourceFilename: /vsimem/BMB0E75WYF.vrt
time: 2012-03-03T09:38:10.423969
minmax: 0.000 1000
SourceBand: 2
wkv: toa_outgoing_spectral_radiance
name: L_443
Band : 3 L_490
units: mW m-2 sr-1 (cm-1)-1
colormap: jet
short_name: L
dataType: 6
long_name: top of atmosphere emitted toward outer space per unit wavenumber or as a function of wavenumber radiative flux in a particular direction, per unit of solid angle
standard_name: toa_outgoing_spectral_radiance
wavelength: 490
suffix: 490
SourceFilename: /vsimem/BMB0E75WYF.vrt
time: 2012-03-03T09:38:10.423969
minmax: 0.000 1000
SourceBand: 3
wkv: toa_outgoing_spectral_radiance
name: L_490
Band : 4 L_510
units: mW m-2 sr-1 (cm-1)-1
colormap: jet
short_name: L
dataType: 6
long_name: top of atmosphere emitted toward outer space per unit wavenumber or as a function of wavenumber radiative flux in a particular direction, per unit of solid angle
standard_name: toa_outgoing_spectral_radiance
wavelength: 510
suffix: 510
SourceFilename: /vsimem/BMB0E75WYF.vrt
time: 2012-03-03T09:38:10.423969
minmax: 0.000 1000
SourceBand: 4
wkv: toa_outgoing_spectral_radiance
name: L_510
Band : 5 L_560
units: mW m-2 sr-1 (cm-1)-1
colormap: jet
short_name: L
dataType: 6
long_name: top of atmosphere emitted toward outer space per unit wavenumber or as a function of wavenumber radiative flux in a particular direction, per unit of solid angle
standard_name: toa_outgoing_spectral_radiance
wavelength: 560
suffix: 560
SourceFilename: /vsimem/BMB0E75WYF.vrt
time: 2012-03-03T09:38:10.423969
minmax: 0.000 1000
SourceBand: 5
wkv: toa_outgoing_spectral_radiance
name: L_560
Band : 6 L_620
units: mW m-2 sr-1 (cm-1)-1
colormap: jet
short_name: L
dataType: 6
long_name: top of atmosphere emitted toward outer space per unit wavenumber or as a function of wavenumber radiative flux in a particular direction, per unit of solid angle
standard_name: toa_outgoing_spectral_radiance
wavelength: 620
suffix: 620
SourceFilename: /vsimem/BMB0E75WYF.vrt
time: 2012-03-03T09:38:10.423969
minmax: 0.000 1000
SourceBand: 6
wkv: toa_outgoing_spectral_radiance
name: L_620
Band : 7 L_665
units: mW m-2 sr-1 (cm-1)-1
colormap: jet
short_name: L
dataType: 6
long_name: top of atmosphere emitted toward outer space per unit wavenumber or as a function of wavenumber radiative flux in a particular direction, per unit of solid angle
standard_name: toa_outgoing_spectral_radiance
wavelength: 665
suffix: 665
SourceFilename: /vsimem/BMB0E75WYF.vrt
time: 2012-03-03T09:38:10.423969
minmax: 0.000 1000
SourceBand: 7
wkv: toa_outgoing_spectral_radiance
name: L_665
Band : 8 L_681
units: mW m-2 sr-1 (cm-1)-1
colormap: jet
short_name: L
dataType: 6
long_name: top of atmosphere emitted toward outer space per unit wavenumber or as a function of wavenumber radiative flux in a particular direction, per unit of solid angle
standard_name: toa_outgoing_spectral_radiance
wavelength: 681
suffix: 681
SourceFilename: /vsimem/BMB0E75WYF.vrt
time: 2012-03-03T09:38:10.423969
minmax: 0.000 1000
SourceBand: 8
wkv: toa_outgoing_spectral_radiance
name: L_681
Band : 9 L_709
units: mW m-2 sr-1 (cm-1)-1
colormap: jet
short_name: L
dataType: 6
long_name: top of atmosphere emitted toward outer space per unit wavenumber or as a function of wavenumber radiative flux in a particular direction, per unit of solid angle
standard_name: toa_outgoing_spectral_radiance
wavelength: 709
suffix: 709
SourceFilename: /vsimem/BMB0E75WYF.vrt
time: 2012-03-03T09:38:10.423969
minmax: 0.000 1000
SourceBand: 9
wkv: toa_outgoing_spectral_radiance
name: L_709
Band : 10 L_753
units: mW m-2 sr-1 (cm-1)-1
colormap: jet
short_name: L
dataType: 6
long_name: top of atmosphere emitted toward outer space per unit wavenumber or as a function of wavenumber radiative flux in a particular direction, per unit of solid angle
standard_name: toa_outgoing_spectral_radiance
wavelength: 753
suffix: 753
SourceFilename: /vsimem/BMB0E75WYF.vrt
time: 2012-03-03T09:38:10.423969
minmax: 0.000 1000
SourceBand: 10
wkv: toa_outgoing_spectral_radiance
name: L_753
Band : 11 L_761
units: mW m-2 sr-1 (cm-1)-1
colormap: jet
short_name: L
dataType: 6
long_name: top of atmosphere emitted toward outer space per unit wavenumber or as a function of wavenumber radiative flux in a particular direction, per unit of solid angle
standard_name: toa_outgoing_spectral_radiance
wavelength: 761
suffix: 761
SourceFilename: /vsimem/BMB0E75WYF.vrt
time: 2012-03-03T09:38:10.423969
minmax: 0.000 1000
SourceBand: 11
wkv: toa_outgoing_spectral_radiance
name: L_761
Band : 12 L_778
units: mW m-2 sr-1 (cm-1)-1
colormap: jet
short_name: L
dataType: 6
long_name: top of atmosphere emitted toward outer space per unit wavenumber or as a function of wavenumber radiative flux in a particular direction, per unit of solid angle
standard_name: toa_outgoing_spectral_radiance
wavelength: 778
suffix: 778
SourceFilename: /vsimem/BMB0E75WYF.vrt
time: 2012-03-03T09:38:10.423969
minmax: 0.000 1000
SourceBand: 12
wkv: toa_outgoing_spectral_radiance
name: L_778
Band : 13 L_864
units: mW m-2 sr-1 (cm-1)-1
colormap: jet
short_name: L
dataType: 6
long_name: top of atmosphere emitted toward outer space per unit wavenumber or as a function of wavenumber radiative flux in a particular direction, per unit of solid angle
standard_name: toa_outgoing_spectral_radiance
wavelength: 864
suffix: 864
SourceFilename: /vsimem/BMB0E75WYF.vrt
time: 2012-03-03T09:38:10.423969
minmax: 0.000 1000
SourceBand: 13
wkv: toa_outgoing_spectral_radiance
name: L_864
Band : 14 L_849
units: mW m-2 sr-1 (cm-1)-1
colormap: jet
short_name: L
dataType: 6
long_name: top of atmosphere emitted toward outer space per unit wavenumber or as a function of wavenumber radiative flux in a particular direction, per unit of solid angle
standard_name: toa_outgoing_spectral_radiance
wavelength: 849
suffix: 849
SourceFilename: /vsimem/BMB0E75WYF.vrt
time: 2012-03-03T09:38:10.423969
minmax: 0.000 1000
SourceBand: 14
wkv: toa_outgoing_spectral_radiance
name: L_849
Band : 15 L_900
units: mW m-2 sr-1 (cm-1)-1
colormap: jet
short_name: L
dataType: 6
long_name: top of atmosphere emitted toward outer space per unit wavenumber or as a function of wavenumber radiative flux in a particular direction, per unit of solid angle
standard_name: toa_outgoing_spectral_radiance
wavelength: 900
suffix: 900
SourceFilename: /vsimem/BMB0E75WYF.vrt
time: 2012-03-03T09:38:10.423969
minmax: 0.000 1000
SourceBand: 15
wkv: toa_outgoing_spectral_radiance
name: L_900
Band : 16 flags_l1
units: 1
colormap: jet
short_name: flags
dataType: 1
long_name: Quality Flags
standard_name: quality_flags
suffix: l1
SourceFilename: /vsimem/BMB0E75WYF.vrt
time: 2012-03-03T09:38:10.423969
minmax: 0 1
SourceBand: 16
wkv: quality_flags
name: flags_l1
Band : 17 sun zenith angles
name: sun zenith angles
dataType: 7
units: (10)^-6 deg
SourceFilename: /vsimem/BMB0E75WYF.vrt
time: 2012-03-03T09:38:10.423969
SourceBand: 17
Band : 18 sun azimuth angles
name: sun azimuth angles
dataType: 7
units: (10)^-6 deg
SourceFilename: /vsimem/BMB0E75WYF.vrt
time: 2012-03-03T09:38:10.423969
SourceBand: 18
Band : 19 zonal winds
name: zonal winds
dataType: 7
units: m*s-1
SourceFilename: /vsimem/BMB0E75WYF.vrt
time: 2012-03-03T09:38:10.423969
SourceBand: 19
Band : 20 meridional winds
name: meridional winds
dataType: 7
units: m*s-1
SourceFilename: /vsimem/BMB0E75WYF.vrt
time: 2012-03-03T09:38:10.423969
SourceBand: 20
Band : 21 swathmask
units: None
colormap: jet
short_name: swathmask
dataType: 1
long_name: Swath mask
standard_name: swath_binary_mask
SourceFilename: /vsimem/BMB0E75WYF.vrt
minmax: 0 1
SourceBand: 21
wkv: swath_binary_mask
name: swathmask
----------------------------------------
Domain:[500 x 500]
----------------------------------------
Projection:
GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563],
TOWGS84[0,0,0,0,0,0,0]],
PRIMEM["Greenwich",0],
UNIT["degree",0.0174532925199433]]
----------------------------------------
Corners (lon, lat):
( 22.09, 62.45) ( 24.59, 62.45)
( 22.09, 59.95) ( 24.59, 59.95)
In [12]:
n.export2thredds('test_export.nc', {'L_560': {'type': '>i2', 'units': 'W m2'}}, metadata={'title': 'test_file'})
/home/vagrant/miniconda/lib/python2.7/site-packages/scipy/io/netcdf.py:287: RuntimeWarning: Cannot close a netcdf_file opened with mmap=True, when netcdf_variables or arrays referring to its data still exist. All data arrays obtained from such files refer directly to data on disk, and must be copied before the file can be cleanly closed. (See netcdf_file docstring for more information on mmap.)
), category=RuntimeWarning)
Out[12]:
0
In [15]:
!/home/vagrant/miniconda/bin/gdalinfo test_export.nc
Driver: netCDF/Network Common Data Format
Files: test_export.nc
Size is 500, 500
Coordinate System is:
GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHORITY["EPSG","7030"]],
TOWGS84[0,0,0,0,0,0,0],
AUTHORITY["EPSG","6326"]],
PRIMEM["Greenwich",0,
AUTHORITY["EPSG","8901"]],
UNIT["degree",0.0174532925199433,
AUTHORITY["EPSG","9108"]],
AUTHORITY["EPSG","4326"]]
Origin = (22.087631873472898,62.450051611554407)
Pixel Size = (0.004999772341313,-0.004999768518972)
Metadata:
lat#long_name=latitude
lat#standard_name=latitude
lat#units=degrees_north
latitude_longitude#GeoTransform=22.08763235280353 0.004999773273614116 0 62.45005350652858 0 -0.004999773273614116
latitude_longitude#grid_mapping_name=latitude_longitude
latitude_longitude#inverse_flattening=298.257223563
latitude_longitude#longitude_of_prime_meridian=0
latitude_longitude#semi_major_axis=6378137
latitude_longitude#spatial_ref=GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9108"]],AUTHORITY["EPSG","4326"]]
lon#long_name=longitude
lon#standard_name=longitude
lon#units=degrees_east
L_560#colormap=jet
L_560#grid_mapping=latitude_longitude
L_560#long_name=top of atmosphere emitted toward outer space per unit wavenumber or as a function of wavenumber radiative flux in a particular direction, per unit of solid angle
L_560#minmax=0.000 1000
L_560#name=L_560
L_560#short_name=L
L_560#standard_name=toa_outgoing_spectral_radiance
L_560#suffix=560
L_560#units=W m2
L_560#wavelength=560
L_560#wkv=toa_outgoing_spectral_radiance
NC_GLOBAL#Conventions=CF-1.5
NC_GLOBAL#creation_date=2015-09-24 10:53:54 UTC
NC_GLOBAL#easternmost_longitude=24.587519
NC_GLOBAL#history=
NC_GLOBAL#institution=NERSC
NC_GLOBAL#northernmost_latitude=62.450054
NC_GLOBAL#source=satellite remote sensing
NC_GLOBAL#southernmost_latitude=59.950169
NC_GLOBAL#title=test_file
NC_GLOBAL#westernmost_longitude=22.087633
NETCDF_DIM_EXTRA={time}
NETCDF_DIM_time_DEF={1,6}
NETCDF_DIM_time_VALUES=40969.40150462963
time#axis=T
time#calendar=standard
time#long_name=time
time#standard_name=time
time#units=days since 1900-1-1 0:0:0 +0
Corner Coordinates:
Upper Left ( 22.0876319, 62.4500516) ( 22d 5'15.47"E, 62d27' 0.19"N)
Lower Left ( 22.0876319, 59.9501674) ( 22d 5'15.47"E, 59d57' 0.60"N)
Upper Right ( 24.5875180, 62.4500516) ( 24d35'15.06"E, 62d27' 0.19"N)
Lower Right ( 24.5875180, 59.9501674) ( 24d35'15.06"E, 59d57' 0.60"N)
Center ( 23.3375750, 61.2001095) ( 23d20'15.27"E, 61d12' 0.39"N)
Band 1 Block=500x1 Type=Int16, ColorInterp=Undefined
NoData Value=-32767
Metadata:
colormap=jet
grid_mapping=latitude_longitude
long_name=top of atmosphere emitted toward outer space per unit wavenumber or as a function of wavenumber radiative flux in a particular direction, per unit of solid angle
minmax=0.000 1000
name=L_560
NETCDF_DIM_time=40969.40150462963
NETCDF_VARNAME=L_560
short_name=L
standard_name=toa_outgoing_spectral_radiance
suffix=560
units=W m2
wavelength=560
wkv=toa_outgoing_spectral_radiance
In [ ]:
Content source: nansencenter/nansat-lectures
Similar notebooks: