Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
MVCM
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Paolo Veglio
MVCM
Commits
6e67be90
Commit
6e67be90
authored
2 years ago
by
Paolo Veglio
Browse files
Options
Downloads
Plain Diff
Merge branch 'work_for_AMS' of gitlab.ssec.wisc.edu:pveglio/mvcm into work_for_AMS
parents
391c6d6b
ce61d369
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
hires_module.py
+33
-22
33 additions, 22 deletions
hires_module.py
scene.py
+6
-6
6 additions, 6 deletions
scene.py
setup.py
+7
-4
7 additions, 4 deletions
setup.py
sort_inputs.py
+3
-2
3 additions, 2 deletions
sort_inputs.py
with
49 additions
and
34 deletions
hires_module.py
+
33
−
22
View file @
6e67be90
import
numpy
as
np
import
numpy
as
np
import
xarray
as
xr
import
xarray
as
xr
import
netCDF4
as
nc
import
netCDF4
as
nc
import
sys
from
glob
import
glob
from
glob
import
glob
...
@@ -22,13 +23,13 @@ importlib.reload(tst)
...
@@ -22,13 +23,13 @@ importlib.reload(tst)
# TEST CASE
# TEST CASE
# data:
# data:
_datapath
=
'
/ships19/hercules/pveglio/mvcm_viirs_hires
'
_datapath
=
'
/ships19/hercules/pveglio/mvcm_viirs_hires
'
_fname_mod02
=
glob
(
f
'
{
_datapath
}
/VNP02MOD.A2022173.1454.001.*.uwssec_bowtie_corrected.nc
'
)[
0
]
_fname_mod02
=
''
_fname_mod03
=
glob
(
f
'
{
_datapath
}
/VNP03MOD.A2022173.1454.001.*.uwssec.nc
'
)[
0
]
_fname_mod03
=
''
_fname_img02
=
glob
(
f
'
{
_datapath
}
/VNP02IMG.A2022173.1454.001.*.uwssec_bowtie_corrected.nc
'
)[
0
]
_fname_img02
=
''
_fname_img03
=
glob
(
f
'
{
_datapath
}
/VNP03IMG.A2022173.1454.001.*.uwssec.nc
'
)[
0
]
_fname_img03
=
''
# MVCM output
# MVCM output
_cld_mask
=
f
'
{
_datapath
}
/CLDMSK_L2_VIIRS_SNPP.A2022173.1454.001.2022174035130.nc
'
_cld_mask
=
'
'
# thresholds:
# thresholds:
_threshold_file
=
'
/home/pveglio/mvcm/thresholds.mvcm.snpp.v0.0.1.yaml
'
_threshold_file
=
'
/home/pveglio/mvcm/thresholds.mvcm.snpp.v0.0.1.yaml
'
...
@@ -60,13 +61,8 @@ def main(*,
...
@@ -60,13 +61,8 @@ def main(*,
geos_constants
:
str
=
_geos_constants
,
geos_constants
:
str
=
_geos_constants
,
ndvi_file
:
str
=
_ndvi_file
,
ndvi_file
:
str
=
_ndvi_file
,
sst_file
:
str
=
_sst_file
,
sst_file
:
str
=
_sst_file
,
cloud_mask_file
=
_cld_mask
)
->
None
:
out_fname
:
str
=
'
temp.nc
'
)
->
None
:
f
=
nc
.
Dataset
(
cloud_mask_file
)
cm
=
f
[
'
geophysical_data/Cloud_Mask
'
][:]
f
.
close
()
check
=
nc
.
Dataset
(
mod02
)
check
=
nc
.
Dataset
(
mod02
)
if
'
M01
'
not
in
list
(
check
[
'
observation_data
'
].
variables
):
if
'
M01
'
not
in
list
(
check
[
'
observation_data
'
].
variables
):
check
.
close
()
check
.
close
()
...
@@ -75,6 +71,7 @@ def main(*,
...
@@ -75,6 +71,7 @@ def main(*,
if
check
.
isopen
():
if
check
.
isopen
():
check
.
close
()
check
.
close
()
print
(
threshold_file
)
with
open
(
threshold_file
)
as
f
:
with
open
(
threshold_file
)
as
f
:
text
=
f
.
read
()
text
=
f
.
read
()
thresholds
=
yml
.
safe_load
(
text
)
thresholds
=
yml
.
safe_load
(
text
)
...
@@ -99,14 +96,14 @@ def main(*,
...
@@ -99,14 +96,14 @@ def main(*,
if
'
I01
'
not
in
viirs_data
:
if
'
I01
'
not
in
viirs_data
:
return
return
cm_flag
=
np
.
array
((
np
.
array
(
cm
[
0
,
:,
:],
np
.
byte
)
&
#
cm_flag = np.array((np.array(cm[0, :, :], np.byte) &
(
pow
(
2
,
1
)
+
pow
(
2
,
2
)))
/
pow
(
2
,
1
))
#
(pow(2, 1) + pow(2, 2)))/pow(2, 1))
#
mvcm_conf
=
np
.
ones
(
cm_flag
.
shape
)
#
mvcm_conf = np.ones(cm_flag.shape)
# conf[cm_flag == 3] = 1
#
# conf[cm_flag == 3] = 1
mvcm_conf
[
cm_flag
==
2
]
=
0.95
#
mvcm_conf[cm_flag == 2] = 0.95
mvcm_conf
[
cm_flag
==
1
]
=
0.66
#
mvcm_conf[cm_flag == 1] = 0.66
mvcm_conf
[
cm_flag
==
0
]
=
0
#
mvcm_conf[cm_flag == 0] = 0
viirs_lores
=
rd
.
read_data
(
'
viirs
'
,
mod02
,
data_path
+
'
/
'
+
mod03
)
viirs_lores
=
rd
.
read_data
(
'
viirs
'
,
mod02
,
data_path
+
'
/
'
+
mod03
)
...
@@ -170,11 +167,10 @@ def main(*,
...
@@ -170,11 +167,10 @@ def main(*,
date
=
mod02
.
split
(
'
.
'
)[
1
]
date
=
mod02
.
split
(
'
.
'
)[
1
]
time
=
mod02
.
split
(
'
.
'
)[
2
]
time
=
mod02
.
split
(
'
.
'
)[
2
]
mvcm_confidence
=
mvcm_conf
.
repeat
(
2
,
0
).
repeat
(
2
,
1
)
#
mvcm_confidence = mvcm_conf.repeat(2, 0).repeat(2, 1)
out_xr
=
xr
.
Dataset
(
out_xr
=
xr
.
Dataset
(
data_vars
=
dict
(
data_vars
=
dict
(
hires_confidence
=
([
'
number_of_lines
'
,
'
number_of_pixels
'
],
confidence
),
hires_confidence
=
([
'
number_of_lines
'
,
'
number_of_pixels
'
],
confidence
),
mvcm_confidence
=
([
'
number_of_lines
'
,
'
number_of_pixels
'
],
mvcm_confidence
),
ocean_day_mask
=
([
'
number_of_lines
'
,
'
number_of_pixels
'
],
viirs_data
.
Ocean_Day
.
values
),
ocean_day_mask
=
([
'
number_of_lines
'
,
'
number_of_pixels
'
],
viirs_data
.
Ocean_Day
.
values
),
),
),
coords
=
dict
(
coords
=
dict
(
...
@@ -214,4 +210,19 @@ def read_bits(byte, bits):
...
@@ -214,4 +210,19 @@ def read_bits(byte, bits):
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
main
()
main
(
data_path
=
sys
.
argv
[
1
],
mod02
=
sys
.
argv
[
2
],
mod03
=
sys
.
argv
[
3
],
img02
=
sys
.
argv
[
4
],
img03
=
sys
.
argv
[
5
],
threshold_file
=
sys
.
argv
[
6
],
geos_atm_1
=
sys
.
argv
[
7
],
geos_atm_2
=
sys
.
argv
[
8
],
geos_land
=
sys
.
argv
[
9
],
geos_ocean
=
sys
.
argv
[
10
],
geos_constants
=
sys
.
argv
[
11
],
ndvi_file
=
sys
.
argv
[
12
],
sst_file
=
sys
.
argv
[
13
],
out_fname
=
sys
.
argv
[
14
])
This diff is collapsed.
Click to expand it.
scene.py
+
6
−
6
View file @
6e67be90
...
@@ -38,14 +38,14 @@ night = 200
...
@@ -38,14 +38,14 @@ night = 200
# #################################################################### #
# #################################################################### #
# TEST CASE
# TEST CASE
# data:
# data:
datapath
=
'
/ships19/hercules/pveglio/mvcm_viirs_hires
'
#
datapath = '/ships19/hercules/pveglio/mvcm_viirs_hires'
fname_mod02
=
glob
(
f
'
{
datapath
}
/VNP02MOD.A2022173.1448.001.*.uwssec*.nc
'
)[
0
]
#
fname_mod02 = glob(f'{datapath}/VNP02MOD.A2022173.1448.001.*.uwssec*.nc')[0]
fname_mod03
=
glob
(
f
'
{
datapath
}
/VNP03MOD.A2022173.1448.001.*.uwssec.nc
'
)[
0
]
#
fname_mod03 = glob(f'{datapath}/VNP03MOD.A2022173.1448.001.*.uwssec.nc')[0]
fname_img02
=
glob
(
f
'
{
datapath
}
/VNP02IMG.A2022173.1448.001.*.uwssec*.nc
'
)[
0
]
#
fname_img02 = glob(f'{datapath}/VNP02IMG.A2022173.1448.001.*.uwssec*.nc')[0]
fname_img03
=
glob
(
f
'
{
datapath
}
/VNP03IMG.A2022173.1448.001.*.uwssec.nc
'
)[
0
]
#
fname_img03 = glob(f'{datapath}/VNP03IMG.A2022173.1448.001.*.uwssec.nc')[0]
# thresholds:
# thresholds:
threshold_file
=
'
/home/pveglio/mvcm_leo/thresholds/new_thresholds.mvcm.snpp.v1.0.0.yaml
'
#
threshold_file = '/home/pveglio/mvcm_leo/thresholds/new_thresholds.mvcm.snpp.v1.0.0.yaml'
# ancillary files:
# ancillary files:
geos_atm_1
=
'
GEOS.fpit.asm.inst3_2d_asm_Nx.GEOS5124.20220622_1200.V01.nc4
'
geos_atm_1
=
'
GEOS.fpit.asm.inst3_2d_asm_Nx.GEOS5124.20220622_1200.V01.nc4
'
...
...
This diff is collapsed.
Click to expand it.
setup.py
+
7
−
4
View file @
6e67be90
...
@@ -26,12 +26,15 @@ sourcefiles = ['src/get_Reynolds_SST.c', # SST
...
@@ -26,12 +26,15 @@ sourcefiles = ['src/get_Reynolds_SST.c', # SST
]
]
include_dirs
=
[
'
include
'
,
include_dirs
=
[
'
include
'
,
'
/opt/hdfeos2/2.20-gcc-8.3/include
'
,
'
/opt/hdf4/4.2.9-gcc-4.9.2/include
'
,
'
/opt/netcdf4/4.7.0-gcc-8.3/include
'
,
'
/opt/hdfeos2/2.19-gcc-4.9.2/include
'
,
'
/opt/netcdf4/4.3.3-gcc-4.9.2/include
'
,
numpy
.
get_include
(),
]
numpy
.
get_include
(),
]
library_dirs
=
[
'
/opt/hdfeos2/2.20-gcc-8.3/lib
'
,
library_dirs
=
[
'
/opt/hdf4/4.2.9-gcc-4.9.2/lib
'
,
'
/opt/netcdf4/4.7.0-gcc-8.3/lib
'
]
'
/opt/hdfeos2/2.19-gcc-4.9.2/lib
'
,
'
/opt/netcdf4/4.3.3-gcc-4.9.2/lib
'
,
]
extensions
=
[
Extension
(
'
ancillary_data
'
,
sourcefiles
,
extensions
=
[
Extension
(
'
ancillary_data
'
,
sourcefiles
,
include_dirs
=
include_dirs
,
include_dirs
=
include_dirs
,
...
...
This diff is collapsed.
Click to expand it.
sort_inputs.py
+
3
−
2
View file @
6e67be90
...
@@ -63,7 +63,8 @@ def create_filenames(vnp02mod_fname):
...
@@ -63,7 +63,8 @@ def create_filenames(vnp02mod_fname):
'
data_path
'
:
datapath
,
'
data_path
'
:
datapath
,
'
cloud_mask_file
'
:
cld_msk
'
cloud_mask_file
'
:
cld_msk
}
}
for
k
in
list
(
out_fnames
):
print
(
f
'
{
k
}
:
{
out_fnames
[
k
]
}
'
)
return
out_fnames
return
out_fnames
...
@@ -93,4 +94,4 @@ def call_mvcm():
...
@@ -93,4 +94,4 @@ def call_mvcm():
if
__name__
==
"
__main__
"
:
if
__name__
==
"
__main__
"
:
c
all_mvcm
()
c
reate_filenames
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment