Skip to content

Commit

Permalink
FIX: Writing errors when trying to save PyDDA grids.
Browse files Browse the repository at this point in the history
  • Loading branch information
rcjackson committed Aug 2, 2024
1 parent b1a4939 commit b27c22d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pydda/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from . import constraints
from . import io

__version__ = "2.0.0"
__version__ = "2.0.1"

print("Welcome to PyDDA %s" % __version__)
print("If you are using PyDDA in your publications, please cite:")
Expand Down
8 changes: 2 additions & 6 deletions pydda/io/read_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,26 +91,22 @@ def read_from_pyart_grid(Grid):
origin_latitude = Grid.origin_latitude
origin_longitude = Grid.origin_longitude
origin_altitude = Grid.origin_altitude
radar_name = Grid.radar_name

if len(list(Grid.fields.keys())) > 0:
first_grid_name = list(Grid.fields.keys())[0]
else:
first_grid_name = ""
projection = Grid.get_projparams()
new_grid = new_grid.to_xarray()

new_grid.attrs["radar_name"] = radar_name["data"]
new_grid["projection"] = xr.DataArray(1, dims=(), attrs=projection)

if "lat_0" in projection.keys():
new_grid["projection"].attrs["_include_lon_0_lat_0"] = "true"
else:
new_grid["projection"].attrs["_include_lon_0_lat_0"] = "false"

if "units" not in new_grid["time"].attrs.keys():
new_grid["time"].attrs["units"] = (
"seconds since %s"
% new_grid["time"].dt.strftime("%Y-%m-%dT%H:%M:%SZ").values[0]
)
new_grid.attrs["first_grid_name"] = first_grid_name
x = radar_latitude.pop("data").squeeze()
new_grid["radar_latitude"] = xr.DataArray(
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
PLATFORMS = "Linux, Windows, OSX"
MAJOR = 2
MINOR = 0
MICRO = 0
MICRO = 1

# SCRIPTS = glob.glob('scripts/*')
# TEST_SUITE = 'nose.collector'
Expand Down

0 comments on commit b27c22d

Please sign in to comment.