#2958 closed help (completed)

cannot plot on loop when observations = '--'

Reported by: NoelClancy Owned by: pmcguire
Component: JULES Keywords: Python, merge, FLUXNET, aggregated_by()
Cc: Platform: JASMIN
UM Version:


/home/users/nmc/FLUXNET2015/30_FLUXNET_SITES/scr/noel_fluxnet_evaluation_2.py in <module>()

144 iris.coord_categorisation.add_year(model_cube, 'time')
145 iris.coord_categorisation.add_month(model_cube, 'time')

—> 146 iris.coord_categorisation.add_day_of_year(model_cube, 'time')

148 model_cube = iris.util.squeeze(model_cube)

/usr/lib/python2.7/site-packages/iris/coord_categorisation.pyc in add_day_of_year(cube, coord, name)

180 add_categorised_coord(
181 cube, name, coord,

—> 182 lambda coord, x: _pt_date(coord, x).timetuple()[7])


/usr/lib/python2.7/site-packages/iris/coord_categorisation.pyc in add_categorised_coord(cube, name, from_coord, category_function, units)

89 vectorised_fn = np.vectorize(category_function)
90 new_coord = iris.coords.AuxCoord?(vectorised_fn(from_coord,

—→ 91 from_coord.points),

92 units=units,
93 attributes=from_coord.attributes.copy())

/usr/lib/python2.7/site-packages/numpy/lib/function_base.pyc in call(self, *args, kwargs)

2753 vargs.extend([kwargs[_n] for _n in names])

→ 2755 return self._vectorize_call(func=func, args=vargs)

2757 def _get_ufunc_and_otypes(self, func, args):

/usr/lib/python2.7/site-packages/numpy/lib/function_base.pyc in _vectorize_call(self, func, args)

2829 for a in args]

→ 2831 outputs = ufunc(*inputs)

2833 if ufunc.nout == 1:

/usr/lib/python2.7/site-packages/iris/coord_categorisation.pyc in <lambda>(coord, x)

180 add_categorised_coord(
181 cube, name, coord,

—> 182 lambda coord, x: _pt_date(coord, x).timetuple()[7])


/usr/lib/python2.7/site-packages/iris/coord_categorisation.pyc in _pt_date(coord, time)

125 # - We will want to do better, when we sort out our own Calendars.
126 # - For now, just make sure these all call through this one function.

—> 127 return coord.units.num2date(time)


/usr/lib/python2.7/site-packages/cf_units/init.pyc in num2date(self, time_value)

1987 """
1988 cdf_utime = self.utime()

→ 1989 return _num2date_to_nearest_second(time_value, cdf_utime)

/usr/lib/python2.7/site-packages/cf_units/init.pyc in _num2date_to_nearest_second(time_value, utime)

607 microseconds = 0
608 round_mask = np.logical_or(has_half_seconds, microseconds != 0)

—> 609 ceil_mask = np.logical_or(has_half_seconds, microseconds ≥ 500000)

610 if time_values[ceil_mask].size > 0:
611 useconds = Unit('second')

Change History (2)

comment:1 Changed 12 months ago by pmcguire

  • Keywords Python, merge, FLUXNET, aggregated_by() added
  • Platform set to JASMIN
  • Status changed from new to accepted

Hi Noel:
You later showed me an aggregated_by error in Python with the JULES/FLUXNET Python code.
This error happens sometimes due to the problems with iris and newer versions of numpy.
It's best for now to skip the FLUXNET sites that have this problem. The aggregated_by problem has been reported to the iris team.

You and I also later decided to merge the Python files from Karina Williams which did the plotting by climatology for the FLUXNET data and the JULES model for different sites, together with the previous plotting for all the years which was done by the fluxnet_evaluation.py module.

We did this merge, and it worked. But it still needs the capability to overlay two models on the FLUXNET observation time series for all the years, instead of just one model. And it still needs the capability to extract the data from the NETCDF files beforehand anc convert it to text files.

I will close this ticket for now. If you need to address these latter issues, don't hesitate to open a new ticket.

comment:2 Changed 12 months ago by pmcguire

  • Resolution set to completed
  • Status changed from accepted to closed
Note: See TracTickets for help on using tickets.