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
ea73ea41
Commit
ea73ea41
authored
2 years ago
by
Paolo Veglio
Browse files
Options
Downloads
Patches
Plain Diff
created function to get filenames for (almost) all inputs from VNP02MOD
parent
afa0bc20
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
sort_inputs.py
+57
-0
57 additions, 0 deletions
sort_inputs.py
with
58 additions
and
0 deletions
.gitignore
+
1
−
0
View file @
ea73ea41
...
...
@@ -3,6 +3,7 @@
*.png
*.npy
*.npz
*.nc
*.vscode
...
...
This diff is collapsed.
Click to expand it.
sort_inputs.py
0 → 100644
+
57
−
0
View file @
ea73ea41
import
os.path
import
numpy
as
np
from
datetime
import
datetime
from
glob
import
glob
def
main
(
vnp02mod_fname
):
datapath
=
os
.
path
.
dirname
(
vnp02mod_fname
)
filename
=
os
.
path
.
basename
(
vnp02mod_fname
)
vnpdate
=
filename
.
split
(
'
.
'
)[
1
]
vnptime
=
filename
.
split
(
'
.
'
)[
2
]
geos_times
=
[
'
0000
'
,
'
0300
'
,
'
0600
'
,
'
0900
'
,
'
1200
'
,
'
1500
'
,
'
1800
'
,
'
2100
'
]
geos_date_from_viirs
=
datetime
.
strftime
(
datetime
.
strptime
(
vnpdate
,
'
A%Y%j
'
),
'
%Y%m%d
'
)
geos_flist
=
glob
(
f
'
{
datapath
}
/ancillary/GEOS.fpit.asm.inst3_2d_asm_Nx.GEOS5124.
{
geos_date_from_viirs
}
*.nc4
'
)
fmt
=
'
%H%M
'
diff_times
=
[(
datetime
.
strptime
(
gt
,
fmt
)
-
datetime
.
strptime
(
vnptime
,
fmt
)).
total_seconds
()
for
gt
in
geos_times
]
file_index
=
np
.
argmin
(
np
.
abs
(
diff_times
))
if
diff_times
[
file_index
]
<=
0
:
geos_file1
=
geos_flist
[
file_index
]
geos_file2
=
geos_flist
[
file_index
+
1
]
else
:
geos_file1
=
geos_flist
[
file_index
-
1
]
geos_file2
=
geos_flist
[
file_index
]
land_ocean_fnames
=
glob
(
f
'
{
datapath
}
/ancillary/GEOS.fpit.asm.tavg1_2d_lnd_Nx.GEOS5124.
{
geos_date_from_viirs
}
*.nc4
'
)
land_ocean_timelist
=
[
t
.
split
(
'
.
'
)[
5
].
split
(
'
_
'
)[
1
]
for
t
in
land_ocean_fnames
]
diff_times
=
[(
datetime
.
strptime
(
gt
,
fmt
)
-
datetime
.
strptime
(
vnptime
,
fmt
)).
total_seconds
()
for
gt
in
land_ocean_timelist
]
land_ocean_index
=
np
.
argmin
(
np
.
abs
(
diff_times
))
geos_land_file
=
glob
(
f
'
{
datapath
}
/ancillary/GEOS.fpit.asm.tavg1_2d_lnd_Nx.GEOS5124.
{
geos_date_from_viirs
}
*.nc4
'
)[
land_ocean_index
]
geos_ocean_file
=
glob
(
f
'
{
datapath
}
/ancillary/GEOS.fpit.asm.tavg1_2d_ocn_Nx.GEOS5124.
{
geos_date_from_viirs
}
*.nc4
'
)[
land_ocean_index
]
vnp03mod
=
glob
(
f
'
{
datapath
}
/VNP03MOD.
{
vnpdate
}
.
{
vnptime
}
*.nc
'
)[
0
]
vnp02img
=
glob
(
f
'
{
datapath
}
/VNP02IMG.
{
vnpdate
}
.
{
vnptime
}
*_bowtie_restored.nc
'
)[
0
]
vnp03img
=
glob
(
f
'
{
datapath
}
/VNP03IMG.
{
vnpdate
}
.
{
vnptime
}
*.nc
'
)[
0
]
out_fnames
=
{
'
VNP03MOD
'
:
vnp03mod
,
'
VNP02IMG
'
:
vnp02img
,
'
VNP03IMG
'
:
vnp03img
,
'
GEOS_atm_1
'
:
geos_file1
,
'
GEOS_atm_2
'
:
geos_file2
,
'
GEOS_land
'
:
geos_land_file
,
'
GEOS_ocean
'
:
geos_ocean_file
,
}
return
out_fnames
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