Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
kafitzgerald committed Nov 17, 2023
1 parent 6451db0 commit 45430c1
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions Gallery/Topography/NCL_topo_1.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,24 @@
nlat = 2160
nlon = 4320

elevation_data = np.fromfile(gdf.get("binary_files/ETOPO5.DAT"),dtype = '>i2').reshape((nlat, nlon))
elevation_data = np.fromfile(gdf.get("binary_files/ETOPO5.DAT"),
dtype='>i2').reshape((nlat, nlon))

# Create numpy arrays for latitude and longitude
lat = np.linspace(90, -90, nlat)
lon = np.linspace(0, 360, nlon)

# Create an xarray DataArray
da = xr.DataArray(
data=elevation_data,
dims=["lat", "lon"],
coords=dict(
lat=(["lat"], lat, {"long_name":"latitude"}),
lon=(["lon"], lon, {"long_name":"longitude"})),
name="elevation",
attrs={"units":"m"}
)
da = xr.DataArray(data=elevation_data,
dims=["lat", "lon"],
coords=dict(lat=(["lat"], lat, {
"long_name": "latitude"
}),
lon=(["lon"], lon, {
"long_name": "longitude"
})),
name="elevation",
attrs={"units": "m"})

###############################################################################
# Plot
Expand Down

0 comments on commit 45430c1

Please sign in to comment.