Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V5.2.5 target merge #247

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# ESGF Publisher

`v5.2.2` is the latest release of the ESGF Publisher. We recommend everyone to upgrade to this version.
For the current version number of the ESGF Publisher, and release notes for recent releases, see: https://esg-publisher.readthedocs.io/

See: https://esg-publisher.readthedocs.io/
See below for release notes for versions up to v5.2.2. Although there is some overlap with what is on readthedocs, the list below is not updated with the most recent releases.

### Release notes:
----

### Older release notes:

#### v5.2.2
* **BUGFIX**: Fix path argument issues
Expand Down
2 changes: 1 addition & 1 deletion src/python/esgcet/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "5.2.4"
__version__ = "5.2.5"
10 changes: 6 additions & 4 deletions src/python/esgcet/mk_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ def init_project(self, proj):
proj: Name of the project to be process
"""
project = proj

self.GA = GA

if project in DRS:
self.DRS = DRS[project]
if project in CONST_ATTR:
Expand All @@ -42,6 +43,8 @@ def init_project(self, proj):
self.DRS = self.user_project[project]['DRS']
if 'CONST_ATTR' in self.user_project[project]:
self.CONST_ATTR = self.user_project[project]['CONST_ATTR']
if 'GA' in self.user_project[project]:
self.GA = { project : self.user_project[project]['GA'] }
else:
raise (BaseException(f"Error: Project {project} Data Record Syntax (DRS) not defined. Define in esg.ini"))
self.dataset['project'] = project
Expand Down Expand Up @@ -181,8 +184,8 @@ def global_attributes(self, proj, scandata):
# handle Global attributes if defined for the project
projkey = proj.lower()

if projkey in GA:
for facetkey in GA[projkey]:
if projkey in self.GA:
for facetkey in self.GA[projkey]:
# did we find a GA in the data by the the key name
if facetkey in scandata:
facetval = scandata[facetkey]
Expand Down Expand Up @@ -293,7 +296,6 @@ def get_file(self, mapdata, fn_trid):
proj_root = root
rel_path = rel_path.replace(f"{self.first_val}/","")
root_found = True
print(f"base path = '{self.base_bath}'")
if not self.base_path:
mapped_root = self.data_roots[root]
self.base_path = f"{mapped_root}/{rel_path}"
Expand Down
13 changes: 7 additions & 6 deletions src/python/esgcet/mk_dataset_xarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ def xarray_load(map_data):
destpath = os.path.dirname(datafile)

filespec = f"{destpath}/*.nc"
return xarray.open_mfdataset(filespec, use_cftime=True)
res = xarray.open_mfdataset(filespec, use_cftime=True)
return res

def get_attrs_dict(self, scanobj):
return scanobj.attrs
Expand Down Expand Up @@ -43,7 +44,7 @@ def _get_time_str(self, timeval):
idx = x.index('.')
return x[:idx] + 'Z'
else:
return timeval.item().isoformat() + "Z"
return timeval.item().isoformat(timespec="seconds") + "Z"

def _get_min_max_bounds(self, latlon):
bigarr = latlon[0] + latlon[-1]
Expand All @@ -56,8 +57,8 @@ def set_bounds(self, record, scanobj):
if "lat" in scanobj.coords:
lat = scanobj.coords["lat"]
if len(lat) > 0:
record["north_degrees"] = float(lat[-1])
record["south_degrees"] = float(lat[0])
record["north_degrees"] = lat.values.max()
record["south_degrees"] = lat.values.min()
else:
self.publog.warn("'lat' found but len 0")
elif "latitude" in scanobj.coords:
Expand All @@ -80,8 +81,8 @@ def set_bounds(self, record, scanobj):
if "lon" in scanobj.coords:
lon = scanobj.coords["lon"]
if len(lon) > 0:
record["east_degrees"] = float(lon[-1])
record["west_degrees"] = float(lon[0])
record["east_degrees"] = lon.values.max()
record["west_degrees"] = lon.values.min()
else:
self.publog.warn("'lon' found but len 0")
elif "longitude" in scanobj.coords:
Expand Down