Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Luz Andrea Silva Torres
miniprojectscientificcomputing2021
Commits
31b34c77
Commit
31b34c77
authored
Jan 19, 2022
by
Luz Andrea Silva Torres
Browse files
Mini project
parent
ba0278b4
Changes
5
Expand all
Hide whitespace changes
Inline
Sidebyside
Clean200cover.png
0 → 100644
View file @
31b34c77
35.9 KB
Mini Poject part I Luz Andrea Silva Torres.ipynb
0 → 100644
View file @
31b34c77
This diff is collapsed.
Click to expand it.
Mini Poject part II Luz Andrea Silva Torres.ipynb
0 → 100644
View file @
31b34c77
This diff is collapsed.
Click to expand it.
carro.JPG
0 → 100644
View file @
31b34c77
38.3 KB
tools.py
0 → 100644
View file @
31b34c77
import
matplotlib.pylab
as
plt
import
netCDF4
import
numpy
as
np
import
netCDF4
as
nc
def
mod_arr
(
field
,
axis
,
order
):
"""Define array with boundary conditions to compute partial derivatives for first order forward scheme.
Boundary condition for last row or column:N=N+(N(N1)) of field array
• Field: field to derive (array to modify)
• axis = 1, colums varies (used to compute derivates along x). axis = 0 rows varies (used to compute derivates along y)
• order=order of precision of derivatives"""
if
order
==
1
:
mod_arr
=
np
.
roll
(
field
,

1
,
axis
=
axis
)
if
axis
==
0
:
mod_arr
[

1
,:]
=
2
*
field
[

1
,:]

field
[

2
,:]
elif
axis
==
1
:
mod_arr
[:,

1
]
=
2
*
field
[:,

1
]

field
[:,

2
]
return
mod_arr
def
derivatives
(
field1
,
field2
,
axis
,
order
):
"""Compute partial derivatives along a field called field2 which could be in time or space using firstorder forward scheme
• Field1: Field to derive
• Field2: Field to derive from
• axis: along which derivation is carried out.
axis=1 derivation along i direction, axis=0 derivation along j direction
• order= order of precision of derivatives, this function can be expanded to a higher order of precision"""
if
order
==
1
:
der
=
np
.
divide
((
mod_arr
(
field1
,
axis
,
order
)

field1
),(
mod_arr
(
field2
,
axis
,
order
)

field2
))
return
der
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