Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
dirsig_public
dirsig-file-maker
Commits
89c6497c
Commit
89c6497c
authored
6 days ago
by
Michael Blazej
Browse files
Options
Download
Email Patches
Plain Diff
Complex water definitions are now supported
parent
d428ea72
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
106 additions
and
11 deletions
+106
-11
demos/test_Brdf1.py
demos/test_Brdf1.py
+17
-3
demos/test_WaveSpectrum1.py
demos/test_WaveSpectrum1.py
+29
-3
dirfm/water.py
dirfm/water.py
+60
-5
No files found.
demos/test_Brdf1.py
View file @
89c6497c
...
...
@@ -604,9 +604,23 @@ def create_platform_motion():
def
create_atmosphere
():
at
=
(
atmos
.
BasicAtmosphere
()
.
set_radiative_transfer
(
atmos
.
UniformRadiativeTransfer
(
1
,
1
))
.
set_weather
(
Path
(
"$DIRSIG_HOME/lib/data/weather/mls.wth"
))
atmos
.
NewAtmosphere
(
Path
.
cwd
()
/
"demos"
/
"atmosphere"
/
"mls_urban_38km.adb.hdf"
)
.
set_info
(
"A great atmosphere"
,
"Joe User"
,
"Aweseom, Corp"
,
"This is a great atmosphere setup."
,
)
.
set_backend
(
atmos
.
ModtranTapeBackend
()
.
set_profile
(
"MODTRAN 5.2"
)
.
set_atmospheric_model
(
"MidLatitudeSummer"
)
.
set_boundary_aerosol_model
(
"RuralVis23Km"
,
visibility_km
=
38.0
)
.
set_multiple_scattering
(
"Isacc"
)
.
set_co2_mixing_ratio
(
395
)
)
)
return
at
...
...
This diff is collapsed.
Click to expand it.
demos/test_WaveSpectrum1.py
View file @
89c6497c
...
...
@@ -287,8 +287,8 @@ def create_scene():
def
create_tasks
():
t
=
TASKS
(
datetime
(
2012
,
7
,
20
,
1
4
,
0
,
0
,
0
,
timezone
(
-
timedelta
(
hours
=
5
)))
).
add_start_stop
(
0
,
0
)
datetime
(
2012
,
7
,
20
,
1
9
,
0
,
0
,
0
,
timezone
(
-
timedelta
(
hours
=
5
)))
).
add_start_stop
(
0
,
5
)
return
t
...
...
@@ -302,7 +302,33 @@ def create_water():
.
set_wind_options
(
1
,
0
)
.
set_ocean_resolution
(
6
,
0.25
)
)
.
add_plugin
(
water
.
ClearWaterIOPmodel
())
.
add_plugin
(
water
.
IOPmodel
(
"purewater"
).
add_concentration_model
(
{
"TYPE"
:
"gauss"
,
"ID"
:
"chlConc"
,
"BG"
:
0.2
,
"S"
:
9
,
"H"
:
144
,
"DMAX"
:
17
,
"ZLEVEL"
:
0
,
}
).
add_scattering_model
(
{
"TYPE"
:
"gordonmorel"
,
"ID"
:
"chlScat"
,
"K"
:
0.33
,
"Q"
:
0.62
,
"CONCID"
:
"chlConc"
,
"EXCUSIVE"
:
0
}
).
add_phase_function_model
(
{
"TYPE"
:
"petzold"
,
"SCATID"
:
"chlScat"
}
)
)
)
return
pool_water
...
...
This diff is collapsed.
Click to expand it.
dirfm/water.py
View file @
89c6497c
...
...
@@ -141,20 +141,75 @@ class ThermalWater(OceanPlugin):
return
{
"name"
:
"ThermalWater"
,
"inputs"
:
{
"tempk"
:
self
.
_ocean_temp
}}
def
__writer__
(
fid
,
level
,
data
):
#assert isinstance(root, fid)
assert
isinstance
(
level
,
int
)
assert
isinstance
(
data
,
dict
)
tab
=
" "
for
key
in
data
.
keys
():
fid
.
write
(
tab
*
level
)
fid
.
write
(
key
)
if
isinstance
(
data
[
key
],
dict
):
fid
.
write
(
" {
\n
"
)
__writer__
(
fid
,
level
+
1
,
data
[
key
])
fid
.
write
(
tab
*
level
)
fid
.
write
(
"}
\n
"
)
else
:
fid
.
write
(
" = {}
\n
"
.
format
(
data
[
key
]))
class
IOPmodel
(
OceanPlugin
):
pass
__MEDIUM__
=
[
"null"
,
"air"
,
"purewater"
,
"sbpurewater"
,
"pspurewater"
]
def
__init__
(
self
,
medium
):
assert
isinstance
(
medium
,
str
)
assert
medium
in
self
.
__MEDIUM__
self
.
_data
=
{
"IOP_MODEL"
:{
"BASE_MEDIUM"
:
medium
}}
def
add_scattering_model
(
self
,
model
):
assert
isinstance
(
model
,
dict
)
self
.
_data
[
'IOP_MODEL'
][
"ADD_SCATTERING_MODEL"
]
=
model
return
self
def
add_absorption_model
(
self
,
model
):
assert
isinstance
(
model
,
dict
)
self
.
_data
[
'IOP_MODEL'
][
"ADD_ABSORPTION_MODEL"
]
=
model
return
self
def
add_phase_function_model
(
self
,
model
):
assert
isinstance
(
model
,
dict
)
self
.
_data
[
'IOP_MODEL'
][
"ADD_PHASE_FUNCTION_MODEL"
]
=
model
return
self
def
add_concentration_model
(
self
,
model
):
assert
isinstance
(
model
,
dict
)
self
.
_data
[
'IOP_MODEL'
][
"ADD_CONCENTRATION_MODEL"
]
=
model
return
self
def
write
(
self
,
dirs
,
key
=
"root"
,
name
=
"custom_water.iop"
):
fname
=
dirs
[
key
]
/
name
with
open
(
fname
,
"w"
)
as
fid
:
__writer__
(
fid
,
0
,
self
.
_data
)
return
{
"name"
:
"IOPModel"
,
"inputs"
:
{
"iop_filename"
:
fname
.
as_posix
()},
}
class
ClearWaterIOPmodel
(
IOPmodel
):
def
__init__
(
self
):
pass
self
.
_data
=
{
"IOP_MODEL"
:{
"BASE_MEDIUM"
:
"purewater"
}}
def
write
(
self
,
dirs
,
key
=
"root"
,
name
=
"clear_water.iop"
):
fname
=
dirs
[
key
]
/
name
with
open
(
fname
,
"w"
)
as
fid
:
fid
.
write
(
"IOP_MODEL {
\n
"
)
fid
.
write
(
" BASE_MEDIUM = purewater
\n
"
)
fid
.
write
(
"}
\n
"
)
__writer__
(
fid
,
0
,
self
.
_data
)
return
{
"name"
:
"IOPModel"
,
...
...
This diff is collapsed.
Click to expand it.
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