|
Last change
on this file since 3593 was
3565,
checked in by afalco, 11 months ago
|
|
Script to interpolate temperatures profiles from one altitude grid to another in 1D.
AF
|
|
File size:
768 bytes
|
| Rev | Line | |
|---|
| [3565] | 1 | # Script to interpolate a temperature profile (profile.in) from altitudes |
|---|
| 2 | # defined in z2sig.def.in on a new altitude grid (z2sig.def) |
|---|
| 3 | |
|---|
| 4 | import numpy as np |
|---|
| 5 | import pandas as pd |
|---|
| 6 | |
|---|
| 7 | temperature_in = pd.read_csv("profile.in", header=None).iloc[:,0] |
|---|
| 8 | print(len(temperature_in), temperature_in[0]) |
|---|
| 9 | z2sig_in = pd.read_csv("z2sig.def.in", names=range(40), header=None, skiprows=1, delimiter=" ").iloc[:,0] |
|---|
| 10 | print(len(z2sig_in), z2sig_in[0]) |
|---|
| 11 | z2sig_out = pd.read_csv("z2sig.def", names=range(40), header=None, skiprows=1, delimiter=" ").iloc[:,0] |
|---|
| 12 | print(len(z2sig_out), z2sig_out[0]) |
|---|
| 13 | |
|---|
| 14 | #add surface |
|---|
| 15 | z2sig_in = np.insert(z2sig_in,0,0) |
|---|
| 16 | z2sig_out = np.insert(z2sig_out,0,0) |
|---|
| 17 | |
|---|
| 18 | temperature_out = np.interp(z2sig_out, z2sig_in, temperature_in) |
|---|
| 19 | np.savetxt("profile", temperature_out, fmt="%f") |
|---|
Note: See
TracBrowser
for help on using the repository browser.