Commits (4)
......@@ -17,13 +17,18 @@ CHANGELOG
* Documentation
* Removed negative values on the horizontal interpolation due to unmapped NaNs values.
* Improved load_nes.py removing redundant code
* Direct access to variable data. (`#77 <https://earth.bsc.es/gitlab/es/NES/-/issues/77>`_)
* New functionalities for vertical extrapolation. (`#74 <https://earth.bsc.es/gitlab/es/NES/-/issues/74>`_)
* Removed cfunits and psutil dependencies.
* Updated the requirements and environment.yml for the Conda environment created in MN5 (`#78 <https://earth.bsc.es/gitlab/es/NES/-/issues/78>`_)
* Bugfix:
* Vertical interpolation for descendant level values (Pressure) (`#71 <https://earth.bsc.es/gitlab/es/NES/-/issues/71>`_)
* Removed lat-lon dimension on the NetCDF projections that not need them (`#72 <https://earth.bsc.es/gitlab/es/NES/-/issues/72>`_)
* Fixed the bug when creating the spatial bounds after selecting a region (`#68 <https://earth.bsc.es/gitlab/es/NES/-/issues/68>`_)
* Fixed the bug related to Shapely deprecated function TopologicalError(`#76 <https://earth.bsc.es/gitlab/es/NES/-/issues/76>`_)
* Fixed the bug related to NumPy deprecated np.object(`#76 <https://earth.bsc.es/gitlab/es/NES/-/issues/76>`_)
* Removed DeprecationWarnings from shapely and pyproj libraries, needed for the porting to MN5 (`#78 <https://earth.bsc.es/gitlab/es/NES/-/issues/78>`_)
1.1.3
============
......
......@@ -14,6 +14,7 @@ from shapely.geometry import Polygon, Point
from copy import deepcopy, copy
import datetime
from dateutil.relativedelta import relativedelta
from typing import Union, List
import pyproj
from ..methods import vertical_interpolation, horizontal_interpolation, cell_measures, spatial_join
from ..nes_formats import to_netcdf_cams_ra, to_netcdf_monarch, to_monarch_units, to_netcdf_cmaq, to_cmaq_units, \
......@@ -445,7 +446,30 @@ class Nes(object):
else:
return self.__add__(other)
def copy(self, copy_vars=False):
def __getitem__(self, key: str) -> Union[np.array, None]:
"""
Retrieve the data associated with the specified key.
Parameters
----------
key : str
The key to retrieve the data for.
Returns
-------
Union[np.array, None]
The data associated with the specified key, or None if the key
does not exist.
Notes
-----
This method allows accessing data in the variables dictionary using
dictionary-like syntax, e.g., obj[key]['data'].
"""
return self.variables[key]['data']
def copy(self, copy_vars: bool = False):
"""
Copy the Nes object.
The copy will avoid to copy the communicator, dataset and variables by default.
......