Skip to content

Commit

Permalink
Adding lats and lons properties (#135)
Browse files Browse the repository at this point in the history
Adding lats and lons properties for Grib2Message objects.

Cleanup of imports

This commit refernces issue #114

Co-authored-by: Eric Engle <EricEngle-NOAA@users.noreply.github.com>
  • Loading branch information
EricEngle-NOAA and EricEngle-NOAA authored Feb 13, 2024
1 parent fa58425 commit cb6ce4b
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions grib2io/_grib2io.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,22 @@
* [Plotting Arakawa Rotated Lat/Lon Grids](https://github.com/NOAA-MDL/grib2io/blob/master/demos/plot-arakawa-rotlatlon-grids.ipynb)
"""

from dataclasses import dataclass, field
from numpy.typing import NDArray
from typing import Union, Optional
import builtins
import collections
import copy
import datetime
import hashlib
import numpy as np
import os
import pyproj
import re
import struct
import sys
from typing import Union, Optional
import warnings

from dataclasses import dataclass, field
from numpy import ma
import numpy as np
from numpy.typing import NDArray
import pyproj

from . import g2clib
from . import tables
from . import templates
Expand Down Expand Up @@ -725,6 +723,18 @@ def griddef(self):
return Grib2GridDef.from_section3(self.section3)


@property
def lats(self):
"""Return grid latitudes."""
return self.latlons()[0]


@property
def lons(self):
"""Return grid longitudes."""
return self.latlons()[1]


def __repr__(self):
"""
Return an unambiguous string representation of the object.
Expand Down

0 comments on commit cb6ce4b

Please sign in to comment.