Skip to content

Version: 0.3.0

Choose a tag to compare

@iamsaswata iamsaswata released this 08 Oct 04:59
9382f37

Released 07 October 2026.

Upgrading from 0.2.0: write data = data.clip(...) (clip() no longer changes data), and in scripts print(data.shape) (shape no longer prints).

Breaking changes

  • clip() now returns the clipped data and no longer changes the original object: write data = data.clip(...).
  • shape returns the size of the data, e.g. (366, 31, 31), instead of printing it. In a script, write print(data.shape).

New

  • Added region(): area-weighted means over named states, districts, river basins and sub-basins of India, or over the polygons of a shapefile, and the value at a city, as a pandas.DataFrame. imdlib.regions.search(), list() and info() find region names and show the sources.
  • clip() accepts region names (state=, district=, basin=, subbasin=) as well as a shapefile. Cells partly inside the region are kept with their fraction (cell_fraction). spatial_mean() uses these fractions, so it equals region() for the same region. get_xarray() and to_netcdf() include cell_fraction.
  • load() reads the files when the data is first used: it returns at once, and region() and clip() read only the cells they need.

Fixes

  • Missing values are recognised by the IMD values (-999 for rain, 99.9 for temperature, none for GPM rain) instead of the value of the corner cell. This applies to spatial_mean(), get_xarray(), the land mask, the climate indices, climatology(), anomaly(), fill_na(), remap(), heatwave() and coldwave(). Results for data that is not clipped are unchanged, except:
    • GPM rain: -999 is no longer left out;
    • real-time and computed data: valid zero values are no longer turned into missing values, e.g. remap() or fill_na() after compute('dr', 'A').
  • fill_na():
    • finds the temperature cells it does not fill (the Andaman and Nicobar area and the row at 7.5°N) by their coordinates, so it is correct on the 0.5° real-time grid, where results change;
    • fills GPM rain everywhere;
    • no longer runs forever when a day has no values.
  • to_geotiff() uses NaN as its nodata value, so dry days in clipped rain are kept. Very small clipped areas are now correctly placed on the map.
  • compute('dtr', ...) and anomaly(climatology=...) raise an error if the two datasets are not on the same cells. SPEI raises an error for clipped tmax or tmin.

Full changelog: 0.2.0...0.3.0