[ncl-talk] Sub: Regress

Dennis Shea shea at ucar.edu
Sat Jul 4 07:20:18 MDT 2015


Please read the documentation for 'cd_calendar'

http://www.ncl.ucar.edu/Document/Functions/Built-in/cd_calendar.shtml

---

 f =addfile("precip.mon.mean.nc","r")

time = f->time

TIME = cd_calendar(time,0)

print(TIME)

Most commonly monthly means are arbitrarily assignedto

[a] the 1st day of the month,

[b] the last day of the month,

      or, more rarely,

[c] the middle day of the month.

You will see each time corresponds to to a different month


Again.  please **carefully read** the cd_calendar documentation.

It is a very useful function.




On Fri, Jul 3, 2015 at 8:56 PM, Adv <advita6 at gmail.com> wrote:

> Hi,
> In this example input file is daily data or monthly data.
> https://www.ncl.ucar.edu/Applications/Scripts/regress_2.ncl
> Because, the netcdf file I use says, hours since but the file is monthly.
> So I'm stuck with the unit conversion process.
>
>  ncdump -c precip.mon.mean.nc
> netcdf precip.mon.mean {
> dimensions:
>     lon = 144 ;
>     lat = 72 ;
>     time = UNLIMITED ; // (436 currently)
> variables:
>     float lat(lat) ;
>         lat:units = "degrees_north" ;
>         lat:actual_range = 88.75f, -88.75f ;
>         lat:long_name = "Latitude" ;
>         lat:standard_name = "latitude" ;
>         lat:axis = "Y" ;
>     float lon(lon) ;
>         lon:units = "degrees_east" ;
>         lon:long_name = "Longitude" ;
>         lon:actual_range = 1.25f, 358.75f ;
>         lon:standard_name = "longitude" ;
>         lon:axis = "X" ;
>     double time(time) ;
>         time:units = "hours since 1800-01-01 00:00:0.0" ;
>         time:long_name = "Time" ;
>         time:delta_t = "0000-01-00 00:00:00" ;
>         time:avg_period = "0000-01-00 00:00:00" ;
>         time:standard_name = "time" ;
>         time:axis = "T" ;
>         time:actual_range = 1569072., 1886808. ;
>     float precip(time, lat, lon) ;
>         precip:long_name = "Average Monthly Rate of Precipitation" ;
>         precip:valid_range = 0.f, 70.f ;
>         precip:units = "mm/day" ;
>         precip:add_offset = 0.f ;
>         precip:scale_factor = 1.f ;
>         precip:missing_value = -9.96921e+36f ;
>         precip:precision = 2s ;
>         precip:least_significant_digit = 2s ;
>         precip:var_desc = "Precipitation" ;
>         precip:dataset = "CPC Merged Analysis of Precipitation Standard" ;
>         precip:level_desc = "Surface" ;
>         precip:statistic = "Mean" ;
>         precip:parent_stat = "Mean" ;
>         precip:actual_range = 0.f, 56.54f ;
>
> // global attributes:
>         :Conventions = "COARDS" ;
>         :title = "CPC Merged Analysis of Precipitation (excludes NCEP
> Reanalysis)" ;
>         :platform = "Analyses" ;
>         :source = "ftp ftp.cpc.ncep.noaa.gov precip/cmap/monthly" ;
>         :documentation = "
> http://www.esrl.noaa.gov/psd/data/gridded/data.cmap.html" ;
>         :references = "
> http://www.esrl.noaa.gov/psd/data/gridded/data.cmap.html" ;
>         :hisotry = "Converted to chunked, deflated non-packed NetCDF4 Jul
> 2014" ;
>         :history = "CPC Merged Analysis of Monthly Precipitation (excludes
> NCEP Reanalysis)" ;
>         :version = "V1505" ;
> data:
>
>  lat = 88.75, 86.25, 83.75, 81.25, 78.75, 76.25, 73.75, 71.25, 68.75,
> 66.25,
>     63.75, 61.25, 58.75, 56.25, 53.75, 51.25, 48.75, 46.25, 43.75, 41.25,
>     38.75, 36.25, 33.75, 31.25, 28.75, 26.25, 23.75, 21.25, 18.75, 16.25,
>     13.75, 11.25, 8.75, 6.25, 3.75, 1.25, -1.25, -3.75, -6.25, -8.75,
> -11.25,
>     -13.75, -16.25, -18.75, -21.25, -23.75, -26.25, -28.75, -31.25,
> -33.75,
>     -36.25, -38.75, -41.25, -43.75, -46.25, -48.75, -51.25, -53.75,
> -56.25,
>     -58.75, -61.25, -63.75, -66.25, -68.75, -71.25, -73.75, -76.25,
> -78.75,
>     -81.25, -83.75, -86.25, -88.75 ;
>
>  lon = 1.25, 3.75, 6.25, 8.75, 11.25, 13.75, 16.25, 18.75, 21.25, 23.75,
>     26.25, 28.75, 31.25, 33.75, 36.25, 38.75, 41.25, 43.75, 46.25, 48.75,
>     51.25, 53.75, 56.25, 58.75, 61.25, 63.75, 66.25, 68.75, 71.25, 73.75,
>     76.25, 78.75, 81.25, 83.75, 86.25, 88.75, 91.25, 93.75, 96.25, 98.75,
>     101.25, 103.75, 106.25, 108.75, 111.25, 113.75, 116.25, 118.75,
> 121.25,
>     123.75, 126.25, 128.75, 131.25, 133.75, 136.25, 138.75, 141.25,
> 143.75,
>     146.25, 148.75, 151.25, 153.75, 156.25, 158.75, 161.25, 163.75,
> 166.25,
>     168.75, 171.25, 173.75, 176.25, 178.75, 181.25, 183.75, 186.25,
> 188.75,
>     191.25, 193.75, 196.25, 198.75, 201.25, 203.75, 206.25, 208.75,
> 211.25,
>     213.75, 216.25, 218.75, 221.25, 223.75, 226.25, 228.75, 231.25,
> 233.75,
>     236.25, 238.75, 241.25, 243.75, 246.25, 248.75, 251.25, 253.75,
> 256.25,
>     258.75, 261.25, 263.75, 266.25, 268.75, 271.25, 273.75, 276.25,
> 278.75,
>     281.25, 283.75, 286.25, 288.75, 291.25, 293.75, 296.25, 298.75,
> 301.25,
>     303.75, 306.25, 308.75, 311.25, 313.75, 316.25, 318.75, 321.25,
> 323.75,
>     326.25, 328.75, 331.25, 333.75, 336.25, 338.75, 341.25, 343.75,
> 346.25,
>     348.75, 351.25, 353.75, 356.25, 358.75 ;
>
>  time = 1569072, 1569816, 1570488, 1571232, 1571952, 1572696, 1573416,
>     1574160, 1574904, 1575624, 1576368, 1577088, 1577832, 1578576,
> 1579272,
>     1580016, 1580736, 1581480, 1582200, 1582944, 1583688, 1584408,
> 1585152,
>     1585872, 1586616, 1587360, 1588032, 1588776, 1589496, 1590240,
> 1590960,
>     1591704, 1592448, 1593168, 1593912, 1594632, 1595376, 1596120,
> 1596792,
>     1597536, 1598256, 1599000, 1599720, 1600464, 1601208, 1601928,
> 1602672,
>     1603392, 1604136, 1604880, 1605552, 1606296, 1607016, 1607760,
> 1608480,
>     1609224, 1609968, 1610688, 1611432, 1612152, 1612896, 1613640,
> 1614336,
>     1615080, 1615800, 1616544, 1617264, 1618008, 1618752, 1619472,
> 1620216,
>     1620936, 1621680, 1622424, 1623096, 1623840, 1624560, 1625304,
> 1626024,
>     1626768, 1627512, 1628232, 1628976, 1629696, 1630440, 1631184,
> 1631856,
>     1632600, 1633320, 1634064, 1634784, 1635528, 1636272, 1636992,
> 1637736,
>     1638456, 1639200, 1639944, 1640616, 1641360, 1642080, 1642824,
> 1643544,
>     1644288, 1645032, 1645752, 1646496, 1647216, 1647960, 1648704,
> 1649400,
>     1650144, 1650864, 1651608, 1652328, 1653072, 1653816, 1654536,
> 1655280,
>     1656000, 1656744, 1657488, 1658160, 1658904, 1659624, 1660368,
> 1661088,
>     1661832, 1662576, 1663296, 1664040, 1664760, 1665504, 1666248,
> 1666920,
>     1667664, 1668384, 1669128, 1669848, 1670592, 1671336, 1672056,
> 1672800,
>     1673520, 1674264, 1675008, 1675680, 1676424, 1677144, 1677888,
> 1678608,
>     1679352, 1680096, 1680816, 1681560, 1682280, 1683024, 1683768,
> 1684464,
>     1685208, 1685928, 1686672, 1687392, 1688136, 1688880, 1689600,
> 1690344,
>     1691064, 1691808, 1692552, 1693224, 1693968, 1694688, 1695432,
> 1696152,
>     1696896, 1697640, 1698360, 1699104, 1699824, 1700568, 1701312,
> 1701984,
>     1702728, 1703448, 1704192, 1704912, 1705656, 1706400, 1707120,
> 1707864,
>     1708584, 1709328, 1710072, 1710744, 1711488, 1712208, 1712952,
> 1713672,
>     1714416, 1715160, 1715880, 1716624, 1717344, 1718088, 1718832,
> 1719528,
>     1720272, 1720992, 1721736, 1722456, 1723200, 1723944, 1724664,
> 1725408,
>     1726128, 1726872, 1727616, 1728288, 1729032, 1729752, 1730496,
> 1731216,
>     1731960, 1732704, 1733424, 1734168, 1734888, 1735632, 1736376,
> 1737048,
>     1737792, 1738512, 1739256, 1739976, 1740720, 1741464, 1742184,
> 1742928,
>     1743648, 1744392, 1745136, 1745808, 1746552, 1747272, 1748016,
> 1748736,
>     1749480, 1750224, 1750944, 1751688, 1752408, 1753152, 1753896,
> 1754592,
>     1755336, 1756056, 1756800, 1757520, 1758264, 1759008, 1759728,
> 1760472,
>     1761192, 1761936, 1762680, 1763352, 1764096, 1764816, 1765560,
> 1766280,
>     1767024, 1767768, 1768488, 1769232, 1769952, 1770696, 1771440,
> 1772112,
>     1772856, 1773576, 1774320, 1775040, 1775784, 1776528, 1777248,
> 1777992,
>     1778712, 1779456, 1780200, 1780872, 1781616, 1782336, 1783080,
> 1783800,
>     1784544, 1785288, 1786008, 1786752, 1787472, 1788216, 1788960,
> 1789656,
>     1790400, 1791120, 1791864, 1792584, 1793328, 1794072, 1794792,
> 1795536,
>     1796256, 1797000, 1797744, 1798416, 1799160, 1799880, 1800624,
> 1801344,
>     1802088, 1802832, 1803552, 1804296, 1805016, 1805760, 1806504,
> 1807176,
>     1807920, 1808640, 1809384, 1810104, 1810848, 1811592, 1812312,
> 1813056,
>     1813776, 1814520, 1815264, 1815936, 1816680, 1817400, 1818144,
> 1818864,
>     1819608, 1820352, 1821072, 1821816, 1822536, 1823280, 1824024,
> 1824720,
>     1825464, 1826184, 1826928, 1827648, 1828392, 1829136, 1829856,
> 1830600,
>     1831320, 1832064, 1832808, 1833480, 1834224, 1834944, 1835688,
> 1836408,
>     1837152, 1837896, 1838616, 1839360, 1840080, 1840824, 1841568,
> 1842240,
>     1842984, 1843704, 1844448, 1845168, 1845912, 1846656, 1847376,
> 1848120,
>     1848840, 1849584, 1850328, 1851000, 1851744, 1852464, 1853208,
> 1853928,
>     1854672, 1855416, 1856136, 1856880, 1857600, 1858344, 1859088,
> 1859784,
>     1860528, 1861248, 1861992, 1862712, 1863456, 1864200, 1864920,
> 1865664,
>     1866384, 1867128, 1867872, 1868544, 1869288, 1870008, 1870752,
> 1871472,
>     1872216, 1872960, 1873680, 1874424, 1875144, 1875888, 1876632,
> 1877304,
>     1878048, 1878768, 1879512, 1880232, 1880976, 1881720, 1882440,
> 1883184,
>     1883904, 1884648, 1885392, 1886064, 1886808 ;
>
>
>
> Could someone help me to overcome this?
>
> Thank you,
> Adv
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150704/771d88d7/attachment.html 


More information about the ncl-talk mailing list