<p>I am looking to model wind speed with altitude in real time. I am currently using a GFS model:
<a href="https://nomads.ncep.noaa.gov/dods/gfs_0p25_1hr/gfs20240616/gfs_0p25_1hr_00z.info" rel="nofollow noreferrer">https://nomads.ncep.noaa.gov/dods/gfs_0p25_1hr/gfs20240616/gfs_0p25_1hr_00z.info</a></p>
<p>I am curious as to what the ugrdprs ** (1000 975 950 925 900.. 10 7 4 2 1) u-component of wind [m/s] variable is. When accessed it provides an array of 41 values. I am assuming that it provides wind speeds from altitudes 1000 to 0 decrementing by factors of 25 except I am confused by the sudden 10 7 4 2 1. Is my assumption accurate? Is there a better way to model this data?</p>
<p>Here is the code I have so far:</p>
<pre><code>import datetime as dt
import xarray as xr
import matplotlib.pyplot as plt

# Get today's date in YYYYMMDD format
date = dt.date.today().strftime(&quot;%Y%m%d&quot;)

# URL for GFS data
gfs = f&quot;https://nomads.ncep.noaa.gov/dods/gfs_0p25_1hr&quot;

# Define latitude and longitude (single point)
lat = 0.0
lon = 0.0

# Define time and variable(s) of interest
time = (0, 1)  # Want the first time step
var = [&quot;ugrdprs&quot;]
runs = [0]

# Loop over each run
for run in runs:
    # Construct the URL for the specific run
    url = f&quot;{gfs}/gfs{date}/gfs_0p25_1hr_{run:02d}z&quot;

    # Open the dataset using xarray
    with xr.open_dataset(url) as ds:
        # Select the variable of interest and slice by time, latitude, and longitude
        ugrad_data = ds[var].isel(time=slice(*time)).sel(lat=lat, lon=lon)
        
        altwinddict = {}
        # Print the ugrdprs data values
        for i in range(len(ugrad_data['ugrdprs'].values[0])):
            wind_speed = ugrad_data['ugrdprs'].values[0][i]
            altitude = i * 25
            # Store altitude and wind speed in the dictionary
            altwinddict[altitude] = wind_speed
        
        # Plotting the altwinddict data
        altitudes = list(altwinddict.keys())
        wind_speeds = list(altwinddict.values())

        plt.figure(figsize=(10, 6))
        plt.scatter(altitudes, wind_speeds, marker='o', color='b', label='Wind Speeds')
        
        plt.xlabel('Altitude (m)')
        plt.ylabel('Wind Speed (m/s)')
        plt.title('Wind Speeds at Different Altitudes')
        plt.legend()
        plt.grid(True)
        plt.tight_layout()
        plt.show()
</code></pre>
<p>This produces a graph: <a href="https://i.sstatic.net/iV5SbWFj.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/iV5SbWFj.png" alt="" /></a></p>
<p>I am also looking to model up to 3000m the GFS model has wind speed values for 1829 m, 2743m , and 3658 meters above mean sea level. I am thinking of adding those points and linearly extrapolating. Is there a better way to do this? Open to any suggestions.</p>

CC BY-SA 4.0
2024-07-03T12:36:52.080Z
Your assumption is likely false and provides pressure levels in hPa instead of height levels in m.
Joscha Fregin
CC BY-SA 4.0
2024-07-04T02:24:47.060Z
Thanks! Given this I am currently interpolating given actual altitude wind speed data points from 10,20,..100, 1829 m, 2743m , and 3658 meters there are huge holes between these data points.  Is there another model I should consider looking into?
RSA41
CC BY-SA 4.0
2024-07-04T09:14:21.493Z
There are many different models. How do you calculate the height? The height of a pressure level varies. It is rarely on the same level in m.
Joscha Fregin
CC BY-SA 4.0
2024-07-05T08:29:05.813Z
You need to understand some fundamentals of weather models, in this case especially how vertical levels are defined. A good starting point could be this lecture on meted: https://www.meted.ucar.edu/bom/mstructure_dynamics/navmenu.php?tab=1&page=6-0-0&type=flash
Whir
<wind><atmosphere-modelling><python><air>
Wind speed vs attitude model
RSA41
# Wind speed vs attitude model

(Asked by: username_0 on 2024-07-02)

I am looking to model wind speed with altitude in real time. I am currently using a GFS model:
<https://nomads.ncep.noaa.gov/dods/gfs_0p25_1hr/gfs20240616/gfs_0p25_1hr_00z.info>

I am curious as to what the ugrdprs \*\* (1000 975 950 925 900.. 10 7 4 2 1) u-component of wind [m/s] variable is. When accessed it provides an array of 41 values. I am assuming that it provides wind speeds from altitudes 1000 to 0 decrementing by factors of 25 except I am confused by the sudden 10 7 4 2 1. Is my assumption accurate? Is there a better way to model this data?

Here is the code I have so far:

```
import datetime as dt
import xarray as xr
import matplotlib.pyplot as plt

# Get today's date in YYYYMMDD format
date = dt.date.today().strftime("%Y%m%d")

# URL for GFS data
gfs = f"https://nomads.ncep.noaa.gov/dods/gfs_0p25_1hr"

# Define latitude and longitude (single point)
lat = 0.0
lon = 0.0

# Define time and variable(s) of interest
time = (0, 1)  # Want the first time step
var = ["ugrdprs"]
runs = [0]

# Loop over each run
for run in runs:
    # Construct the URL for the specific run
    url = f"{gfs}/gfs{date}/gfs_0p25_1hr_{run:02d}z"

    # Open the dataset using xarray
    with xr.open_dataset(url) as ds:
        # Select the variable of interest and slice by time, latitude, and longitude
        ugrad_data = ds[var].isel(time=slice(*time)).sel(lat=lat, lon=lon)
        
        altwinddict = {}
        # Print the ugrdprs data values
        for i in range(len(ugrad_data['ugrdprs'].values[0])):
            wind_speed = ugrad_data['ugrdprs'].values[0][i]
            altitude = i * 25
            # Store altitude and wind speed in the dictionary
            altwinddict[altitude] = wind_speed
        
        # Plotting the altwinddict data
        altitudes = list(altwinddict.keys())
        wind_speeds = list(altwinddict.values())

        plt.figure(figsize=(10, 6))
        plt.scatter(altitudes, wind_speeds, marker='o', color='b', label='Wind Speeds')
        
        plt.xlabel('Altitude (m)')
        plt.ylabel('Wind Speed (m/s)')
        plt.title('Wind Speeds at Different Altitudes')
        plt.legend()
        plt.grid(True)
        plt.tight_layout()
        plt.show()

```

This produces a graph: [![](https://i.sstatic.net/iV5SbWFj.png)](https://i.sstatic.net/iV5SbWFj.png)

I am also looking to model up to 3000m the GFS model has wind speed values for 1829 m, 2743m , and 3658 meters above mean sea level. I am thinking of adding those points and linearly extrapolating. Is there a better way to do this? Open to any suggestions.

**Tags:** wind, atmosphere-modelling, python, air

> **Comments:**
> **username_1**: Your assumption is likely false and provides pressure levels in hPa instead of height levels in m.  
> **username_0**: Thanks! Given this I am currently interpolating given actual altitude wind speed data points from 10,20,..100, 1829 m, 2743m , and 3658 meters there are huge holes between these data points.  Is there another model I should consider looking into?  
> **username_1**: There are many different models. How do you calculate the height? The height of a pressure level varies. It is rarely on the same level in m.  
> **username_2**: You need to understand some fundamentals of weather models, in this case especially how vertical levels are defined. A good starting point could be this lecture on meted: https://www.meted.ucar.edu/bom/mstructure_dynamics/navmenu.php?tab=1&page=6-0-0&type=flash  

---

## 0 answers

