Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lecture materials
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package 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
generic software skills
lecture materials
Commits
38b96cd0
Commit
38b96cd0
authored
11 months ago
by
Dominik Zobel
Browse files
Options
Downloads
Patches
Plain Diff
Adjust postprocessing example and add Hands-on
parent
aeaec7cc
No related branches found
No related tags found
1 merge request
!56
Debugging Strategies lecture notes
Pipeline
#66870
passed
11 months ago
Stage: test
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
lectures/debugging-strategies/slides.qmd
+40
-5
40 additions, 5 deletions
lectures/debugging-strategies/slides.qmd
with
40 additions
and
5 deletions
lectures/debugging-strategies/slides.qmd
+
40
−
5
View file @
38b96cd0
...
@@ -310,7 +310,7 @@ $\Rightarrow$_Show use of `gdb`_
...
@@ -310,7 +310,7 @@ $\Rightarrow$_Show use of `gdb`_
# Errors due to data access and communication
# Errors due to data access and communication
## Postprocessing example (1/
3
)
## Postprocessing example (1/
4
)
- Extract data from netCDF file and calculate interpolation weights
- Extract data from netCDF file and calculate interpolation weights
- File located [here](static/vmro3_input4MIPs_ozone_1850-1855_rev.nc)
- File located [here](static/vmro3_input4MIPs_ozone_1850-1855_rev.nc)
...
@@ -326,7 +326,7 @@ Calculate_Weights(filename, timestamp_start, timestamp_end, timestep_days)
...
@@ -326,7 +326,7 @@ Calculate_Weights(filename, timestamp_start, timestamp_end, timestep_days)
```
```
## Postprocessing example (2/
3
)
## Postprocessing example (2/
4
)
:::{.smaller}
:::{.smaller}
...
@@ -358,7 +358,7 @@ def Calculate_Weights(filename, timestamp_start, timestamp_end, timestep_days):
...
@@ -358,7 +358,7 @@ def Calculate_Weights(filename, timestamp_start, timestamp_end, timestep_days):
:::
:::
## Postprocessing example (3/
3
)
## Postprocessing example (3/
4
)
```python
```python
...
@@ -376,7 +376,31 @@ def Select_Date(ds, model_date, method):
...
@@ -376,7 +376,31 @@ def Select_Date(ds, model_date, method):
'%Y-%m-%d %H:%M:%S')
'%Y-%m-%d %H:%M:%S')
```
```
:::{.fragment}
<!--
```python
def Open_File(filename):
import xarray as xr
return xr.open_dataset(filename)\
.convert_calendar('standard', use_cftime=True)
def Select_Date(ds, model_date, method='ffill'):
import datetime as dt
if ( model_date < dt.datetime(1850, 1, 16, 12, 0, 0) ) \
or ( model_date > dt.datetime(1854, 12, 31, 12, 0, 0) ):
ds_elem = ds.sel(time=model_date, method='nearest')
else :
ds_elem = ds.sel(time=model_date, method=method)
return dt.datetime.strptime(str(ds_elem['time'].values),
'%Y-%m-%d %H:%M:%S')
```
-->
## Postprocessing example (4/4)
```{.python startFrom="14"}
```{.python startFrom="14"}
def Get_Time_Objects(timestamp_start, timestamp_end, timestep_days):
def Get_Time_Objects(timestamp_start, timestamp_end, timestep_days):
...
@@ -389,8 +413,19 @@ def Get_Time_Objects(timestamp_start, timestamp_end, timestep_days):
...
@@ -389,8 +413,19 @@ def Get_Time_Objects(timestamp_start, timestamp_end, timestep_days):
return [start_date, end_date, timestep]
return [start_date, end_date, timestep]
```
```
:::
## Hands-On! {.handson}
1. Which command in the code causes the problem?
2. Describe what would you need to do?
(you can inspect the data e.g. with `print(ds['time'])`
or in your terminal with `cdo infon <file>.nc`)
<!--
```
ncdump -h
```
-->
## Parallel programs
## Parallel programs
...
...
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