Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
gts2
gts2_client
Commits
5b675fa8
Commit
5b675fa8
authored
Feb 20, 2018
by
Niklas Bohn
Browse files
Moved 'Data' variable to band group
parent
012dacc0
Pipeline
#2617
passed with stages
in 16 minutes and 23 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
gts2_client/gts2_client.py
View file @
5b675fa8
...
...
@@ -609,12 +609,11 @@ def json_to_netcdf(out_mode, api_result, outpath, out_prefix, geo_ll, geo_ur, st
[
setattr
(
data_info_group
,
attr
,
api_result
[
key
][
tile
][
band
][
data_info
][
attr
])
for
attr
in
api_result
[
key
][
tile
][
band
][
data_info
].
keys
()]
if
data_info
==
'data'
:
data_group
=
band_group
.
createGroup
(
data_info
)
band_arr
=
np
.
asarray
(
api_result
[
key
][
tile
][
band
][
data_info
])
data
_group
.
createDimension
(
'x'
,
band_arr
.
shape
[
2
])
data
_group
.
createDimension
(
'y'
,
band_arr
.
shape
[
1
])
data
_group
.
createDimension
(
't'
,
band_arr
.
shape
[
0
])
data
=
data
_group
.
createVariable
(
'Data'
,
'i4'
,
(
'x'
,
'y'
,
't'
),
fill_value
=
255
)
band
_group
.
createDimension
(
'x'
,
band_arr
.
shape
[
2
])
band
_group
.
createDimension
(
'y'
,
band_arr
.
shape
[
1
])
band
_group
.
createDimension
(
't'
,
band_arr
.
shape
[
0
])
data
=
band
_group
.
createVariable
(
'Data'
,
'i4'
,
(
'x'
,
'y'
,
't'
),
fill_value
=
255
)
data
.
units
=
"None"
if
level
==
"L1C"
:
data
.
long_name
=
"Top of Atmosphere Reflectance"
...
...
@@ -625,9 +624,9 @@ def json_to_netcdf(out_mode, api_result, outpath, out_prefix, geo_ll, geo_ur, st
data
.
valid_range
=
np
.
array
((
-
2000.0
,
16000.0
))
data
.
actual_range
=
np
.
array
((
np
.
min
(
band_arr
),
np
.
max
(
band_arr
)))
data
[:,
:,
:]
=
band_arr
data
_group
.
Band
=
band
.
split
(
"_"
)[
0
].
split
(
"B"
)[
-
1
]
data
_group
.
Resolution
=
band
.
split
(
"_"
)[
-
1
]
data
_group
.
Central_Wavelength
=
wl
[
str
(
band
.
split
(
"_"
)[
0
])]
band
_group
.
Band
=
band
.
split
(
"_"
)[
0
].
split
(
"B"
)[
-
1
]
band
_group
.
Resolution
=
band
.
split
(
"_"
)[
-
1
]
band
_group
.
Central_Wavelength
=
wl
[
str
(
band
.
split
(
"_"
)[
0
])]
if
key
==
'Metadata'
:
key_group
=
f
.
createGroup
(
key
)
...
...
@@ -661,12 +660,11 @@ def json_to_netcdf(out_mode, api_result, outpath, out_prefix, geo_ll, geo_ur, st
data_info_group
.
setncattr_string
(
'time'
,
api_result
[
key
][
tile
][
msk
][
data_info
][
'time'
])
if
data_info
==
'data'
:
data_group
=
mask_group
.
createGroup
(
data_info
)
mask_arr
=
np
.
asarray
(
api_result
[
key
][
tile
][
msk
][
data_info
])
data
_group
.
createDimension
(
'x'
,
mask_arr
.
shape
[
2
])
data
_group
.
createDimension
(
'y'
,
mask_arr
.
shape
[
1
])
data
_group
.
createDimension
(
't'
,
mask_arr
.
shape
[
0
])
data
=
data
_group
.
createVariable
(
'Data'
,
'i4'
,
(
'x'
,
'y'
,
't'
),
fill_value
=
255
)
mask
_group
.
createDimension
(
'x'
,
mask_arr
.
shape
[
2
])
mask
_group
.
createDimension
(
'y'
,
mask_arr
.
shape
[
1
])
mask
_group
.
createDimension
(
't'
,
mask_arr
.
shape
[
0
])
data
=
mask
_group
.
createVariable
(
'Data'
,
'i4'
,
(
'x'
,
'y'
,
't'
),
fill_value
=
255
)
data
.
units
=
"None"
data
.
long_name
=
"Mask classes"
data
.
standard_name
=
"classes"
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment