Skip to content

fluh_timeseries YEAR isn't like flanduse_timeseries YEAR #26

@samsrabin

Description

@samsrabin

First of all, let me say that I don't think this is an issue. The variable data seems to be the same! However, the differing time axis attributes—and/or maybe something else causing YEAR to not be parsed by ncdump—did confuse me for a while, so it might be worth considering making these consistent.

In the CLM flanduse_timeseries file, the YEAR variable is the actual year.

f=/glade/campaign/cesm/cesmdata/cseg/inputdata/lnd/clm2/surfdata_esmf/ctsm5.2.0/landuse.timeseries_0.9x1.25_SSP2-4.5_1850-2100_78pfts_c240216.nc
ncdump -h $f | grep time | grep -v time,; ncdump -v YEAR $f | tail
netcdf landuse.timeseries_0.9x1.25_SSP2-4.5_1850-2100_78pfts_c240216 {
	time = UNLIMITED ; // (251 currently)
		PCT_CROP_MAX:long_name = "maximum total percent crop landunit during time period" ;
		PCT_NAT_PFT_MAX:long_name = "maximum percent plant functional type during time period (% of landunit)" ;
		PCT_CFT_MAX:long_name = "maximum percent crop functional type during time period (% of landunit)" ;
	int YEAR(time) ;
	int time(time) ;
		time:long_name = "year" ;
		time:units = "unitless" ;
    1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
    2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016,
    2017, 2018, 2019, 2020, 2021, 2022, 2023, 2024, 2025, 2026, 2027, 2028,
    2029, 2030, 2031, 2032, 2033, 2034, 2035, 2036, 2037, 2038, 2039, 2040,
    2041, 2042, 2043, 2044, 2045, 2046, 2047, 2048, 2049, 2050, 2051, 2052,
    2053, 2054, 2055, 2056, 2057, 2058, 2059, 2060, 2061, 2062, 2063, 2064,
    2065, 2066, 2067, 2068, 2069, 2070, 2071, 2072, 2073, 2074, 2075, 2076,
    2077, 2078, 2079, 2080, 2081, 2082, 2083, 2084, 2085, 2086, 2087, 2088,
    2089, 2090, 2091, 2092, 2093, 2094, 2095, 2096, 2097, 2098, 2099, 2100 ;
}

However, in the FATES fluh_timeseries file it's more complicated. This can't be inspected using ncdump for some reason:

f=/glade/campaign/cesm/cesmdata/cseg/inputdata/lnd/clm2/surfdata_map/fates-sci.1.68.3_api.31.0.0_tools.1.0.1/LUH2_states_transitions_management.timeseries_4x5_hist_simyr1850-2015_c231101.nc
ncdump -h $f | grep time | grep -v time,; ncdump -v YEAR $f | tail
netcdf LUH2_states_transitions_management.timeseries_4x5_hist_simyr1850-2015_c231101 {
	time = 166 ;
	double time(time) ;
		time:_FillValue = nan ;
		time:units = "years since 850-01-01 0:0:0" ;
		time:calendar = "noleap" ;
		time:long_name = "time" ;
		time:standard_name = "time" ;
		time:axis = "T" ;
	double YEAR(time) ;
data:

 YEAR = _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
    _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
    _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
    _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
    _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
    _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _,
    _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _, _ ;
}

However, xarray can see it if you tell it not to decode times:

import xarray as xr
f = "/glade/campaign/cesm/cesmdata/cseg/inputdata/lnd/clm2/surfdata_map/fates-sci.1.68.3_api.31.0.0_tools.1.0.1/LUH2_states_transitions_management.timeseries_4x5_hist_simyr1850-2015_c231101.nc"
ds = xr.open_dataset(f, decode_times=False)
ds["YEAR"].values
array([1850., 1851., 1852., 1853., 1854., 1855., 1856., 1857., 1858.,
       1859., 1860., 1861., 1862., 1863., 1864., 1865., 1866., 1867.,
       1868., 1869., 1870., 1871., 1872., 1873., 1874., 1875., 1876.,
       1877., 1878., 1879., 1880., 1881., 1882., 1883., 1884., 1885.,
       1886., 1887., 1888., 1889., 1890., 1891., 1892., 1893., 1894.,
       1895., 1896., 1897., 1898., 1899., 1900., 1901., 1902., 1903.,
       1904., 1905., 1906., 1907., 1908., 1909., 1910., 1911., 1912.,
       1913., 1914., 1915., 1916., 1917., 1918., 1919., 1920., 1921.,
       1922., 1923., 1924., 1925., 1926., 1927., 1928., 1929., 1930.,
       1931., 1932., 1933., 1934., 1935., 1936., 1937., 1938., 1939.,
       1940., 1941., 1942., 1943., 1944., 1945., 1946., 1947., 1948.,
       1949., 1950., 1951., 1952., 1953., 1954., 1955., 1956., 1957.,
       1958., 1959., 1960., 1961., 1962., 1963., 1964., 1965., 1966.,
       1967., 1968., 1969., 1970., 1971., 1972., 1973., 1974., 1975.,
       1976., 1977., 1978., 1979., 1980., 1981., 1982., 1983., 1984.,
       1985., 1986., 1987., 1988., 1989., 1990., 1991., 1992., 1993.,
       1994., 1995., 1996., 1997., 1998., 1999., 2000., 2001., 2002.,
       2003., 2004., 2005., 2006., 2007., 2008., 2009., 2010., 2011.,
       2012., 2013., 2014., 2015.])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions