Skip to content
Snippets Groups Projects
Commit ede31f05 authored by Nils Brüggemann's avatar Nils Brüggemann
Browse files

pyic_view: Fixed a typo regarding uuidOfHGrid. Added more cmaps. Try not to...

pyic_view: Fixed a typo regarding uuidOfHGrid. Added more cmaps. Try not to identify fpath_ckdtree here but push this to interp_to_rectgrid_xr.
parent 05cc5e1c
No related branches found
No related tags found
No related merge requests found
Pipeline #99282 passed
......@@ -58,30 +58,31 @@ def str_to_array(string):
array = np.array(string.split(','), dtype=float)
return array
def get_fpath_ckdtree(data, res, path_grid, gname='auto', fpath_tgrid='auto'):
if path_grid == 'auto':
path_grid = params['path_grid']
try:
Dgrid = pyic.identify_grid(data, path_grid)
except:
# This doesn't always work, lets try another approach
try:
Dgrid = pyic.identify_grid(
data, path_grid, uuidOfHGrid=data.attrs['uuidOfHGrid']
)
except:
Dgrid = dict()
if gname == "auto":
try:
gname = Dgrid["name"]
except KeyError:
gname = "none"
fpath_ckdtree = f'{path_grid}/{gname}/ckdtree/rectgrids/{gname}_res{res:3.2f}_180W-180E_90S-90N.nc'
print(f'fpath_ckdtree: {fpath_ckdtree}')
return fpath_ckdtree
#def get_fpath_ckdtree(data, res, path_grid, gname='auto', fpath_tgrid='auto'):
# if path_grid == 'auto':
# path_grid = params['path_grid']
#
# try:
# Dgrid = pyic.identify_grid(data, path_grid)
# except:
# # This doesn't always work, lets try another approach
# try:
# print(f"Here: {data.attrs['uuidOfHGrid']}")
# Dgrid = pyic.identify_grid(
# data, path_grid, uuidOfHGrid=data.attrs['uuidOfHGrid']
# )
# except:
# Dgrid = dict()
#
# if gname == "auto":
# try:
# gname = Dgrid["name"]
# except KeyError:
# gname = "none"
#
# fpath_ckdtree = f'{path_grid}/{gname}/ckdtree/rectgrids/{gname}_res{res:3.2f}_180W-180E_90S-90N.nc'
# print(f'fpath_ckdtree: {fpath_ckdtree}')
# return fpath_ckdtree
def get_data(ds, var_name, it, iz, res, lon_reg, lat_reg):
......@@ -114,7 +115,7 @@ class view(object):
self.colormaps = [
"inferno", "viridis", "plasma",
"RdYlBu_r", "RdBu_r", "Blues_r",
"cmo.thermal", "cmo.haline", "cmo.curl",
"cmo.thermal", "cmo.haline", "cmo.curl", "cmo.ice", "cmo.dense",
]
self.res_all = [1., 0.3, 0.1, 0.02]
#self.proj_all = [
......@@ -341,10 +342,10 @@ class view(object):
print(f"variables in data set: {self.var_names}")
self.var_name = self.var_names[0]
# copy uugridid to each variable as attribute
# copy uuidOfHGrid to each variable as attribute
for var in list(self.ds):
try:
self.ds[var].attrs['uugridid'] = self.ds.attrs.get("uugridid")
self.ds[var].attrs['uuidOfHGrid'] = self.ds.attrs.get("uuidOfHGrid")
except:
print(f'::: Warning: No uuidOfHGrid for {var}. (Do not worry if data is on healpix grid.) :::')
......@@ -369,7 +370,7 @@ class view(object):
# get updated limits
self.update_lon_lat_reg()
# get updated data
self.fpath_ckdtree = get_fpath_ckdtree(self.ds, self.res, self.path_grid)
#self.fpath_ckdtree = get_fpath_ckdtree(self.ds, self.res, self.path_grid)
self.dai = get_data(
self.ds, self.var_name, self.it, self.iz,
self.res, self.lon_reg, self.lat_reg
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment