Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Clément Haëck
submeso-color
Commits
2b124dc0
Commit
2b124dc0
authored
Mar 31, 2022
by
Clément Haëck
Browse files
Rename to setup_metadata
parent
7c832934
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
19 additions
and
19 deletions
+19
-19
Compute/SOM/SOM_merge_pigments.py
Compute/SOM/SOM_merge_pigments.py
+1
-1
Compute/cloud_map.py
Compute/cloud_map.py
+1
-1
Compute/clouds_gs.py
Compute/clouds_gs.py
+1
-1
Compute/compute_hi.py
Compute/compute_hi.py
+1
-1
Compute/create_front_proba_mask.py
Compute/create_front_proba_mask.py
+1
-1
Compute/front_probability_single_month.py
Compute/front_probability_single_month.py
+1
-1
Compute/front_probability_total.py
Compute/front_probability_total.py
+1
-1
Compute/heat_fluxes_ts.py
Compute/heat_fluxes_ts.py
+1
-1
Compute/histogram/compute_hists_ostia_gs3.py
Compute/histogram/compute_hists_ostia_gs3.py
+1
-1
Compute/histogram/compute_hists_ostia_gs3_2d.py
Compute/histogram/compute_hists_ostia_gs3_2d.py
+1
-1
Compute/histogram/compute_hists_ostia_gs3_2thr.py
Compute/histogram/compute_hists_ostia_gs3_2thr.py
+1
-1
Compute/histogram/find_threshold.py
Compute/histogram/find_threshold.py
+1
-1
Compute/make_land.py
Compute/make_land.py
+1
-1
Compute/mean_ndays.py
Compute/mean_ndays.py
+1
-1
Compute/regrid/merge_daily.py
Compute/regrid/merge_daily.py
+1
-1
Compute/regrid/regrid.py
Compute/regrid/regrid.py
+1
-1
Download/process_ostia_sst.py
Download/process_ostia_sst.py
+1
-1
lib/__init__.py
lib/__init__.py
+1
-1
lib/zones.py
lib/zones.py
+1
-1
No files found.
Compute/SOM/SOM_merge_pigments.py
View file @
2b124dc0
...
...
@@ -71,7 +71,7 @@ def merge_pigments(args):
image
=
images_grp
[
modis_file
][
image_idx
]
pig
=
xr
.
open_dataset
(
f
)[
var
]
ds
[
var
][
dict
(
lon
=
image
.
slice_x
,
lat
=
image
.
slice_y
)]
=
pig
.
values
lib
.
setup_meta
_
at
trs
(
ds
,
args
)
lib
.
setup_meta
d
at
a
(
ds
,
args
)
ds
.
to_netcdf
(
ofile
,
encoding
=
encoding
)
...
...
Compute/cloud_map.py
View file @
2b124dc0
...
...
@@ -25,6 +25,6 @@ clouds = clouds.rename(CHL='cloud_probability')
clouds
=
clouds
.
chunk
({
'time'
:
1
})
odir
=
lib
.
data
.
clouds_maps
.
get_root
(
args
)
lib
.
setup_meta
_
at
trs
(
clouds
,
args
)
lib
.
setup_meta
d
at
a
(
clouds
,
args
)
save_chunks_by_date
(
clouds
,
path
.
join
(
odir
,
'%Y/cloud_%Y%m.nc'
),
encoding
=
{
'_all'
:
{
'zlib'
:
True
}})
Compute/clouds_gs.py
View file @
2b124dc0
...
...
@@ -49,7 +49,7 @@ def main():
gc
=
gc
.
assign_coords
(
zone
=
args
[
'zone'
],
data
=
'globcolour'
)
lib
.
setup_meta
_
at
trs
(
gc
,
args
)
lib
.
setup_meta
d
at
a
(
gc
,
args
)
with
ProgressBar
():
gc
.
to_netcdf
(
lib
.
data
.
clouds
.
get_filename
(
data
=
'globcolour'
,
...
...
Compute/compute_hi.py
View file @
2b124dc0
...
...
@@ -38,7 +38,7 @@ def main(args):
'_FillValue'
:
-
32767.
,
'dtype'
:
'int16'
,
'scale_factor'
:
1e-3
}}
lib
.
setup_meta
_
at
trs
(
hi
,
args
)
lib
.
setup_meta
d
at
a
(
hi
,
args
)
save_chunks_by_date
(
hi
,
filename
=
filename
,
encoding
=
encoding
)
...
...
Compute/create_front_proba_mask.py
View file @
2b124dc0
...
...
@@ -18,7 +18,7 @@ def main(args):
ofile
=
lib
.
data
.
p_frt_mask
.
get_filename
(
args
)
lib
.
check_output_dir
(
ofile
,
file
=
True
)
ds
=
mask
.
to_dataset
(
name
=
'mask'
)
lib
.
setup_meta
_
at
trs
(
ds
,
args
)
lib
.
setup_meta
d
at
a
(
ds
,
args
)
ds
.
to_netcdf
(
ofile
,
encoding
=
{
'mask'
:
{
'zlib'
:
True
,
'dtype'
:
'bool'
}})
return
mask
...
...
Compute/front_probability_single_month.py
View file @
2b124dc0
...
...
@@ -50,7 +50,7 @@ def main():
outdir
=
lib
.
data
.
front_probability
.
get_root
(
args
,
period
=
'monthly'
)
lib
.
check_output_dir
(
path
.
join
(
outdir
,
str
(
args
[
'year'
])))
lib
.
setup_meta
_
at
trs
(
mth
,
args
)
lib
.
setup_meta
d
at
a
(
mth
,
args
)
save_chunks_by_date
(
mth
,
path
.
join
(
outdir
,
'%Y/%Y%m%d.nc'
))
return
mth
...
...
Compute/front_probability_total.py
View file @
2b124dc0
...
...
@@ -41,7 +41,7 @@ def main():
lib
.
check_output_dir
(
outdir
)
year
=
'2000'
lib
.
setup_meta
_
at
trs
(
tot
,
args
)
lib
.
setup_meta
d
at
a
(
tot
,
args
)
tot
.
to_netcdf
(
path
.
join
(
outdir
,
year
,
year
+
'0101.nc'
),
encoding
=
{
var_name
:
{
'zlib'
:
True
}})
...
...
Compute/heat_fluxes_ts.py
View file @
2b124dc0
...
...
@@ -21,7 +21,7 @@ def main():
dst
=
box
.
extract
(
ds
)
dst
=
dst
.
hf
.
mean
([
'lat'
,
'lon'
])
lib
.
setup_meta
_
at
trs
(
dst
,
args
)
lib
.
setup_meta
d
at
a
(
dst
,
args
)
dst
.
to_netcdf
(
ofile
)
...
...
Compute/histogram/compute_hists_ostia_gs3.py
View file @
2b124dc0
...
...
@@ -130,7 +130,7 @@ def main(args):
m_next
(
"Executing computations / Writing to disk"
)
ofile
=
lib
.
data
.
hists
.
get_filename
(
args
)
lib
.
check_output_dir
(
ofile
,
file
=
True
)
lib
.
setup_meta
_
at
trs
(
hist
,
args
)
lib
.
setup_meta
d
at
a
(
hist
,
args
)
hist
.
to_netcdf
(
ofile
,
encoding
=
encoding
)
m_end
()
...
...
Compute/histogram/compute_hists_ostia_gs3_2d.py
View file @
2b124dc0
...
...
@@ -110,7 +110,7 @@ def main(args):
# filename=path.join(lib.root_data, 'graph.pdf'))
ofile
=
lib
.
data
.
hists
.
get_filename
(
args
)
lib
.
check_output_dir
(
ofile
,
file
=
True
)
lib
.
setup_meta
_
at
trs
(
hist
,
args
)
lib
.
setup_meta
d
at
a
(
hist
,
args
)
hist
.
to_netcdf
(
ofile
,
encoding
=
encoding
)
m_end
()
...
...
Compute/histogram/compute_hists_ostia_gs3_2thr.py
View file @
2b124dc0
...
...
@@ -129,7 +129,7 @@ def main(args):
m_next
(
"Executing computations / Writing to disk"
)
ofile
=
lib
.
data
.
hists
.
get_filename
(
args
)
lib
.
check_output_dir
(
ofile
,
file
=
True
)
lib
.
setup_meta
_
at
trs
(
hist
,
args
)
lib
.
setup_meta
d
at
a
(
hist
,
args
)
hist
.
to_netcdf
(
ofile
,
encoding
=
encoding
)
m_end
()
...
...
Compute/histogram/find_threshold.py
View file @
2b124dc0
...
...
@@ -92,7 +92,7 @@ def main(args):
hist
=
hist
.
load
()
ofile
=
lib
.
data
.
hists
.
get_filename
(
args
)
lib
.
check_output_dir
(
ofile
,
file
=
True
)
lib
.
setup_meta
_
at
trs
(
hist
,
args
)
lib
.
setup_meta
d
at
a
(
hist
,
args
)
hist
.
to_netcdf
(
ofile
,
encoding
=
encoding
)
m_end
()
...
...
Compute/make_land.py
View file @
2b124dc0
...
...
@@ -33,7 +33,7 @@ def write_land(ds, land, filename, grid):
ds
=
ds
.
isel
(
time
=
0
)
ds
=
enlarge
(
ds
)
ds
=
ds
.
reset_coords
(
drop
=
True
)
lib
.
setup_meta
_
at
trs
(
ds
)
lib
.
setup_meta
d
at
a
(
ds
)
ds
.
to_netcdf
(
filename
,
encoding
=
{
'land'
:
{
'zlib'
:
True
}})
return
ds
...
...
Compute/mean_ndays.py
View file @
2b124dc0
...
...
@@ -25,7 +25,7 @@ def main(args):
lib
.
check_output_dir
(
path
.
join
(
finder
.
root
,
'{:d}'
.
format
(
args
[
'year'
])))
filename
=
finder
.
get_filename
()
lib
.
setup_meta
_
at
trs
(
ds
,
args
)
lib
.
setup_meta
d
at
a
(
ds
,
args
)
save_chunks_by_date
(
ds
,
filename
,
encoding
=
{
'_all'
:
{
'zlib'
:
True
}})
...
...
Compute/regrid/merge_daily.py
View file @
2b124dc0
...
...
@@ -64,7 +64,7 @@ def merge_products(args):
encoding
[
var
][
'add_offset'
]
=
0.05
for
_
,
d
in
ds
.
groupby
(
'time'
):
lib
.
setup_meta
_
at
trs
(
d
,
args
)
lib
.
setup_meta
d
at
a
(
d
,
args
)
s
=
str
(
d
.
time
.
dt
.
strftime
(
'%Y%m%d'
).
values
)
ofile
=
path
.
join
(
odir
,
'A_{}.nc'
.
format
(
s
))
d
.
to_netcdf
(
ofile
,
encoding
=
encoding
)
...
...
Compute/regrid/regrid.py
View file @
2b124dc0
...
...
@@ -122,7 +122,7 @@ def fix_coords(file, args):
encoding
=
{
v
:
{
'zlib'
:
True
,
'_FillValue'
:
nc
.
default_fillvals
[
ds
[
v
].
dtype
.
str
[
1
:]]}
for
v
in
ds
.
data_vars
}
lib
.
setup_meta
_
at
trs
(
ds
,
args
)
lib
.
setup_meta
d
at
a
(
ds
,
args
)
ds
.
to_netcdf
(
file
,
encoding
=
encoding
)
...
...
Download/process_ostia_sst.py
View file @
2b124dc0
...
...
@@ -56,7 +56,7 @@ def main(args):
zlib
=
True
))
ofile
=
lo
.
get_filename
(
args
,
Y
=
'%Y'
,
m
=
'%m'
,
d
=
'%d'
,
relative
=
False
)
lib
.
setup_meta
_
at
trs
(
ds_out
,
args
)
lib
.
setup_meta
d
at
a
(
ds_out
,
args
)
save_chunks_by_date
(
ds_out
,
ofile
,
encoding
=
encoding
)
return
ds_out
...
...
lib/__init__.py
View file @
2b124dc0
...
...
@@ -162,7 +162,7 @@ def get_args(args, add_args=None, description=''):
return
dargs
def
setup_meta
_
at
trs
(
ds
:
xr
.
Dataset
,
def
setup_meta
d
at
a
(
ds
:
xr
.
Dataset
,
args
:
Dict
=
None
,
**
kwargs
:
Any
)
->
xr
.
Dataset
:
"""Set some dataset attributes with information on how it was created.
...
...
lib/zones.py
View file @
2b124dc0
...
...
@@ -109,6 +109,6 @@ if __name__ == '__main__':
for
zone
in
zones
.
values
():
zone
.
add_to_ds
(
ds
)
lib
.
setup_meta
_
at
trs
(
ds
,
args
)
lib
.
setup_meta
d
at
a
(
ds
,
args
)
ds
.
to_netcdf
(
get_filename
(
'zones'
,
region
=
args
[
'region'
],
grid
=
grid
),
encoding
=
{
v
:
{
'zlib'
:
True
}
for
v
in
ds
.
data_vars
})
Write
Preview
Markdown
is supported
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