GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Set CF-1.7-specific attributes for netCDF formats only · GenericMappingTools/pygmt@62f0ce0

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • pygmt/datatypes
    • grid.py
    • header.py
    • image.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎pygmt/datatypes/grid.py‎

Copy file name to clipboardExpand all lines: pygmt/datatypes/grid.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ def to_dataarray(self) -> xr.DataArray:
139139
title: Produced by grdcut
140140
history: grdcut @earth_relief_01d_p -R-55/-47/-24/-10 -Gstatic_ea...
141141
description: Reduced by Gaussian Cartesian filtering (111.2 km fullwi...
142-
long_name: elevation (m)
143142
actual_range: [190. 981.]
143+
long_name: elevation (m)
144144
>>> da.coords["lon"] # doctest: +NORMALIZE_WHITESPACE, +ELLIPSIS
145145
<xarray.DataArray 'lon' (lon: 8)>...
146146
array([-54.5, -53.5, -52.5, -51.5, -50.5, -49.5, -48.5, -47.5])
Collapse file

‎pygmt/datatypes/header.py‎

Copy file name to clipboardExpand all lines: pygmt/datatypes/header.py
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -210,17 +210,17 @@ def data_attrs(self) -> dict[str, Any]:
210210
GridFormat.NI,
211211
GridFormat.NF,
212212
GridFormat.ND,
213-
}: # Only set the 'Conventions' attribute for netCDF.
213+
}: # Set attributes specific to CF-1.7 conventions
214214
attrs["Conventions"] = "CF-1.7"
215-
attrs["title"] = self.title.decode()
216-
attrs["history"] = self.command.decode()
217-
attrs["description"] = self.remark.decode()
215+
attrs["title"] = self.title.decode()
216+
attrs["history"] = self.command.decode()
217+
attrs["description"] = self.remark.decode()
218+
attrs["actual_range"] = np.array([self.z_min, self.z_max])
218219
long_name, units = _parse_nameunits(self.z_units.decode())
219220
if long_name:
220221
attrs["long_name"] = long_name
221222
if units:
222223
attrs["units"] = units
223-
attrs["actual_range"] = np.array([self.z_min, self.z_max])
224224
return attrs
225225

226226
@property
Collapse file

‎pygmt/datatypes/image.py‎

Copy file name to clipboardExpand all lines: pygmt/datatypes/image.py
-4Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,11 +145,7 @@ def to_dataarray(self) -> xr.DataArray:
145145
* x (x) float64... -179.5 -178.5 -177.5 -176.5 ... 177.5 178.5 179.5
146146
* band (band) uint8... 1 2 3
147147
Attributes:
148-
title:
149-
history:
150-
description:
151148
long_name: z
152-
actual_range: [ 1.79769313e+308 -1.79769313e+308]
153149
154150
>>> da.coords["x"] # doctest: +NORMALIZE_WHITESPACE, +ELLIPSIS
155151
<xarray.DataArray 'x' (x: 360)>...

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.