这里面我们首先要上传我们自己的研究区,然后加载每一年的数据降水数据,通过系数转化,完成正常降水量的展示,我们通过对reduceregion的统计,分别算出平均降水量,分辨率设定为1000米,最后加载影像的chart折线图,用于存放坐标横轴时间和纵轴的对象(降水),这里我们首先看一下降水数据
中国区域地面气象要素驱动数据年度合成产品(1979-2018),包括近地面气温、近地面气压、近地面空气比湿、近地面全速、地面向下短波辐射、地面向下长波辐射、地面降水率共7个要素。数据为NETCDF格式,时间分辨率为年,水平空间分辨率为0.1°。可为中国区陆面过程模拟提供驱动数据。
数据集ID:
TPDC/CMFD_01YEAR
时间范围: 1979年-2018年
范围: 全国
来源: 国家青藏高原科学数据中心
复制代码段:
var images = pie.ImageCollection("TPDC/CMFD_01YEAR")
波段统计:
名称 | 类型 | 空间分辨率 | 无效值 |
---|---|---|---|
lrad | Float32 | 0.1度 | -32767 |
prec | Float32 | 0.1度 | -32767 |
pres | Float32 | 0.1度 | -32767 |
shum | Float32 | 0.1度 | -32767 |
srad | Float32 | 0.1度 | -32767 |
temp | Float32 | 0.1度 | -32767 |
wind | Float32 | 0.1度 | -32767 |
属性:
date | string | 影像日期 |
数据引用:阳坤, 何杰. (2019). 中国区域地面气象要素驱动数据集(1979-2018). 国家青藏高原科学数据中心, DOI: 10.11888/AtmosphericPhysics.tpe.249369.file. CSTR: 18406.11.AtmosphericPhysics.tpe.249369.file.
[Yang, K., He, J. (2019). China meteorological forcing dataset (1979-2018). National Tibetan Plateau Data Center, DOI: 10.11888/AtmosphericPhysics.tpe.249369.file. CSTR: 18406.11.AtmosphericPhysics.tpe.249369.file. ] (下载引用: RIS格式 | RIS英文格式 | Bibtex格式 | Bibtex英文格式 )
文章引用:
1.He, J., Yang, K., Tang, W. Lu, H., Qin, J., Chen, Y.Y., & Li, X. (2020). The first high-resolution meteorological forcing dataset for land process studies over China. Scientific Data, 7, 25, https://doi.org/10.1038/s41597-020-0369-y.( 查看 | Bibtex格式)
2.Yang, K., He, J.,Tang, W.J., Qin, J., & Cheng, C. (2010). On downward shortwave and longwave radiations over high altitude regions: Observation and modeling in the Tibetan Plateau. Agricultural and Forest Meteorology, 150(1), 38-46.( 查看 | Bibtex格式)
文中用到的函数:
reduceRegion(reducer,geometry,scale)
对特定区域的所有像素进行统计,返回结果为一个JSON对象;目前可完成最大、最小和求和统计计算。
方法参数:
- image(Image)
Image实例。
- reducer(Reducer)
统计类型,包括最大值、最小值和求和。
- geometry(Geometry)
统计区域范围。默认是影像第一个波段的范围。
- scale(Number)
统计采样比例。
返回值:Dictionary
ChartImage(ySeries,xSeries,options)
即将弃用,请使用 ui.Chart.image.*替换。
通过统计的结果在控制台绘制图表,绘制的图表可以保存。
方法参数:
- ySeries(List)
计算结果Array对象
- xSeries(List)
横坐标标注Array对象
- options(Object)
用于描述统计图的Json对象
返回值:null
代码:
-
- //加载用户已上传的研究区边界数据(以黄河流域为例/山西省为例)
- var region = pie.FeatureCollection("user/PieGeoLiu666/RiverBasin/YellowRiver_Basin")//选择用户已上传的矢量边界
- .first()
- .geometry();
-
- //显示计算区域边界
- Map.addLayer(region, { color: "0000ff", fillColor: "00000000", width: 2 }, "黄河流域");
- Map.setCenter(112.254, 35.726, 3);
- print(region);
-
- //加载逐年CMFD数据
- var CMFD1979 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1979").select('prec').clip(region);
- var prec1979 = CMFD1979.multiply(8760);
-
- var CMFD1980 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1980").select('prec').clip(region);
- var prec1980 = CMFD1980.multiply(8760);
-
- var CMFD1981 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1981").select('prec').clip(region);
- var prec1981 = CMFD1981.multiply(8760);
-
- var CMFD1982 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1982").select('prec').clip(region);
- var prec1982 = CMFD1982.multiply(8760);
-
- var CMFD1983 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1983").select('prec').clip(region);
- var prec1983 = CMFD1983.multiply(8760);
-
- var CMFD1984 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1984").select('prec').clip(region);
- var prec1984 = CMFD1984.multiply(8760);
-
- var CMFD1985 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1985").select('prec').clip(region);
- var prec1985 = CMFD1985.multiply(8760);
-
- var CMFD1986 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1986").select('prec').clip(region);
- var prec1986 = CMFD1986.multiply(8760);
-
- var CMFD1987 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1987").select('prec').clip(region);
- var prec1987 = CMFD1987.multiply(8760);
-
- var CMFD1988 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1988").select('prec').clip(region);
- var prec1988 = CMFD1988.multiply(8760);
-
- var CMFD1989 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1989").select('prec').clip(region);
- var prec1989 = CMFD1989.multiply(8760);
-
- var CMFD1990 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1990").select('prec').clip(region);
- var prec1990 = CMFD1990.multiply(8760);
-
- var CMFD1991 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1991").select('prec').clip(region);
- var prec1991 = CMFD1991.multiply(8760);
-
- var CMFD1992 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1992").select('prec').clip(region);
- var prec1992 = CMFD1992.multiply(8760);
-
- var CMFD1993 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1993").select('prec').clip(region);
- var prec1993 = CMFD1993.multiply(8760);
-
- var CMFD1994 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1994").select('prec').clip(region);
- var prec1994 = CMFD1994.multiply(8760);
-
- var CMFD1995 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1995").select('prec').clip(region);
- var prec1995 = CMFD1995.multiply(8760);
-
- var CMFD1996 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1996").select('prec').clip(region);
- var prec1996 = CMFD1996.multiply(8760);
-
- var CMFD1997 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1997").select('prec').clip(region);
- var prec1997 = CMFD1997.multiply(8760);
-
- var CMFD1998 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1998").select('prec').clip(region);
- var prec1998 = CMFD1998.multiply(8760);
-
- var CMFD1999 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1999").select('prec').clip(region);
- var prec1999 = CMFD1999.multiply(8760);
-
- var CMFD2000 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2000").select('prec').clip(region);
- var prec2000 = CMFD2000.multiply(8760);
-
- var CMFD2001 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2001").select('prec').clip(region);
- var prec2001 = CMFD2001.multiply(8760);
-
- var CMFD2002 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2002").select('prec').clip(region);
- var prec2002 = CMFD2002.multiply(8760);
-
- var CMFD2003 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2003").select('prec').clip(region);
- var prec2003 = CMFD2003.multiply(8760);
-
- var CMFD2004 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2004").select('prec').clip(region);
- var prec2004 = CMFD2004.multiply(8760);
-
- var CMFD2005 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2005").select('prec').clip(region);
- var prec2005 = CMFD2005.multiply(8760);
-
- var CMFD2006 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2006").select('prec').clip(region);
- var prec2006 = CMFD2006.multiply(8760);
-
- var CMFD2007 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2007").select('prec').clip(region);
- var prec2007 = CMFD2007.multiply(8760);
-
- var CMFD2008 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2008").select('prec').clip(region);
- var prec2008 = CMFD2008.multiply(8760);
-
- var CMFD2009 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2009").select('prec').clip(region);
- var prec2009 = CMFD2009.multiply(8760);
-
- var CMFD2010 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2010").select('prec').clip(region);
- var prec2010 = CMFD2010.multiply(8760);
-
- var CMFD2011 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2011").select('prec').clip(region);
- var prec2011 = CMFD2011.multiply(8760);
-
- var CMFD2012 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2012").select('prec').clip(region);
- var prec2012 = CMFD2012.multiply(8760);
-
- var CMFD2013 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2013").select('prec').clip(region);
- var prec2013 = CMFD2013.multiply(8760);
-
- var CMFD2014 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2014").select('prec').clip(region);
- var prec2014 = CMFD2014.multiply(8760);
-
- var CMFD2015 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2015").select('prec').clip(region);
- var prec2015 = CMFD2015.multiply(8760);
-
- var CMFD2016 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2016").select('prec').clip(region);
- var prec2016 = CMFD2016.multiply(8760);
-
- var CMFD2017 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2017").select('prec').clip(region);
- var prec2017 = CMFD2017.multiply(8760);
-
- var CMFD2018 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2018").select('prec').clip(region);
- var prec2018 = CMFD2018.multiply(8760);
-
- //统计计算研究区内的逐年均值
- var prec1979_mean = prec1979.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1980_mean = prec1980.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1981_mean = prec1981.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1982_mean = prec1982.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1983_mean = prec1983.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1984_mean = prec1984.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1985_mean = prec1985.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1986_mean = prec1986.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1987_mean = prec1987.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1988_mean = prec1988.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1989_mean = prec1989.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1990_mean = prec1990.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1991_mean = prec1991.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1992_mean = prec1992.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1993_mean = prec1993.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1994_mean = prec1994.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1995_mean = prec1995.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1996_mean = prec1996.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1997_mean = prec1997.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1998_mean = prec1998.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1999_mean = prec1999.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2000_mean = prec2000.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2001_mean = prec2001.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2002_mean = prec2002.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2003_mean = prec2003.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2004_mean = prec2004.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2005_mean = prec2005.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2006_mean = prec2006.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2007_mean = prec2007.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2008_mean = prec2008.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2009_mean = prec2009.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2010_mean = prec2010.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2011_mean = prec2011.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2012_mean = prec2012.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2013_mean = prec2013.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2014_mean = prec2014.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2015_mean = prec2015.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2016_mean = prec2016.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2017_mean = prec2017.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2018_mean = prec2018.reduceRegion(pie.Reducer.mean(), region, 1000);
-
- //配置折线图的样式
- var line_options = {
- title: '1979-2018年黄河流域年降水量(mm)',
- legend: ['降水量(mm)'],
- xAxisName: "年份",
- yAxisName: "年降水量(mm)",
- chartType: "line"
- };
- var images = [prec1979_mean, prec1980_mean, prec1981_mean, prec1982_mean, prec1983_mean, prec1984_mean,
- prec1985_mean, prec1986_mean, prec1987_mean, prec1988_mean, prec1989_mean, prec1990_mean,
- prec1991_mean, prec1992_mean, prec1993_mean, prec1994_mean, prec1995_mean, prec1996_mean,
- prec1997_mean, prec1998_mean, prec1999_mean, prec2000_mean, prec2001_mean, prec2002_mean,
- prec2003_mean, prec2004_mean, prec2005_mean, prec2006_mean, prec2007_mean, prec2008_mean,
- prec2009_mean, prec2010_mean, prec2011_mean, prec2012_mean, prec2013_mean, prec2014_mean,
- prec2015_mean, prec2016_mean, prec2017_mean, prec2018_mean];
-
- var xSeries = [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, 2016, 2017, 2018];
-
- //绘制折线图
- ChartImage(images, xSeries, line_options);
同样我们加载山西省的数据来尝试一下,当然你也可以画一个自己的研究区完成指定区域的降水数据的统计,当然这里加载新的研究区会有卡顿现象,所以大家要注意研究加载较大的时候,我们注意等待,大概2分钟山西省的降水量也能出来啦:
山西省的代码:
- //加载山西省边界
- var region = pie.FeatureCollection('user/xg346049806/shanxibianjie').first().geometry();;
-
-
- //显示计算区域边界
- Map.addLayer(region, { color: "0000ff", fillColor: "00000000", width: 2 }, "黄河流域");
- Map.setCenter(112.254, 35.726, 3);
- print(region);
-
- //加载逐年CMFD数据
- var CMFD1979 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1979").select('prec').clip(region);
- var prec1979 = CMFD1979.multiply(8760);
-
- var CMFD1980 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1980").select('prec').clip(region);
- var prec1980 = CMFD1980.multiply(8760);
-
- var CMFD1981 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1981").select('prec').clip(region);
- var prec1981 = CMFD1981.multiply(8760);
-
- var CMFD1982 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1982").select('prec').clip(region);
- var prec1982 = CMFD1982.multiply(8760);
-
- var CMFD1983 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1983").select('prec').clip(region);
- var prec1983 = CMFD1983.multiply(8760);
-
- var CMFD1984 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1984").select('prec').clip(region);
- var prec1984 = CMFD1984.multiply(8760);
-
- var CMFD1985 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1985").select('prec').clip(region);
- var prec1985 = CMFD1985.multiply(8760);
-
- var CMFD1986 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1986").select('prec').clip(region);
- var prec1986 = CMFD1986.multiply(8760);
-
- var CMFD1987 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1987").select('prec').clip(region);
- var prec1987 = CMFD1987.multiply(8760);
-
- var CMFD1988 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1988").select('prec').clip(region);
- var prec1988 = CMFD1988.multiply(8760);
-
- var CMFD1989 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1989").select('prec').clip(region);
- var prec1989 = CMFD1989.multiply(8760);
-
- var CMFD1990 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1990").select('prec').clip(region);
- var prec1990 = CMFD1990.multiply(8760);
-
- var CMFD1991 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1991").select('prec').clip(region);
- var prec1991 = CMFD1991.multiply(8760);
-
- var CMFD1992 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1992").select('prec').clip(region);
- var prec1992 = CMFD1992.multiply(8760);
-
- var CMFD1993 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1993").select('prec').clip(region);
- var prec1993 = CMFD1993.multiply(8760);
-
- var CMFD1994 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1994").select('prec').clip(region);
- var prec1994 = CMFD1994.multiply(8760);
-
- var CMFD1995 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1995").select('prec').clip(region);
- var prec1995 = CMFD1995.multiply(8760);
-
- var CMFD1996 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1996").select('prec').clip(region);
- var prec1996 = CMFD1996.multiply(8760);
-
- var CMFD1997 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1997").select('prec').clip(region);
- var prec1997 = CMFD1997.multiply(8760);
-
- var CMFD1998 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1998").select('prec').clip(region);
- var prec1998 = CMFD1998.multiply(8760);
-
- var CMFD1999 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_1999").select('prec').clip(region);
- var prec1999 = CMFD1999.multiply(8760);
-
- var CMFD2000 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2000").select('prec').clip(region);
- var prec2000 = CMFD2000.multiply(8760);
-
- var CMFD2001 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2001").select('prec').clip(region);
- var prec2001 = CMFD2001.multiply(8760);
-
- var CMFD2002 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2002").select('prec').clip(region);
- var prec2002 = CMFD2002.multiply(8760);
-
- var CMFD2003 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2003").select('prec').clip(region);
- var prec2003 = CMFD2003.multiply(8760);
-
- var CMFD2004 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2004").select('prec').clip(region);
- var prec2004 = CMFD2004.multiply(8760);
-
- var CMFD2005 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2005").select('prec').clip(region);
- var prec2005 = CMFD2005.multiply(8760);
-
- var CMFD2006 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2006").select('prec').clip(region);
- var prec2006 = CMFD2006.multiply(8760);
-
- var CMFD2007 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2007").select('prec').clip(region);
- var prec2007 = CMFD2007.multiply(8760);
-
- var CMFD2008 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2008").select('prec').clip(region);
- var prec2008 = CMFD2008.multiply(8760);
-
- var CMFD2009 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2009").select('prec').clip(region);
- var prec2009 = CMFD2009.multiply(8760);
-
- var CMFD2010 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2010").select('prec').clip(region);
- var prec2010 = CMFD2010.multiply(8760);
-
- var CMFD2011 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2011").select('prec').clip(region);
- var prec2011 = CMFD2011.multiply(8760);
-
- var CMFD2012 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2012").select('prec').clip(region);
- var prec2012 = CMFD2012.multiply(8760);
-
- var CMFD2013 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2013").select('prec').clip(region);
- var prec2013 = CMFD2013.multiply(8760);
-
- var CMFD2014 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2014").select('prec').clip(region);
- var prec2014 = CMFD2014.multiply(8760);
-
- var CMFD2015 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2015").select('prec').clip(region);
- var prec2015 = CMFD2015.multiply(8760);
-
- var CMFD2016 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2016").select('prec').clip(region);
- var prec2016 = CMFD2016.multiply(8760);
-
- var CMFD2017 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2017").select('prec').clip(region);
- var prec2017 = CMFD2017.multiply(8760);
-
- var CMFD2018 = pie.Image("TPDC/CMFD_01YEAR/CMFD_01YEAR_2018").select('prec').clip(region);
- var prec2018 = CMFD2018.multiply(8760);
-
- //统计计算研究区内的逐年均值
- var prec1979_mean = prec1979.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1980_mean = prec1980.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1981_mean = prec1981.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1982_mean = prec1982.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1983_mean = prec1983.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1984_mean = prec1984.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1985_mean = prec1985.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1986_mean = prec1986.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1987_mean = prec1987.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1988_mean = prec1988.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1989_mean = prec1989.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1990_mean = prec1990.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1991_mean = prec1991.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1992_mean = prec1992.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1993_mean = prec1993.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1994_mean = prec1994.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1995_mean = prec1995.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1996_mean = prec1996.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1997_mean = prec1997.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1998_mean = prec1998.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec1999_mean = prec1999.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2000_mean = prec2000.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2001_mean = prec2001.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2002_mean = prec2002.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2003_mean = prec2003.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2004_mean = prec2004.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2005_mean = prec2005.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2006_mean = prec2006.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2007_mean = prec2007.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2008_mean = prec2008.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2009_mean = prec2009.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2010_mean = prec2010.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2011_mean = prec2011.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2012_mean = prec2012.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2013_mean = prec2013.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2014_mean = prec2014.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2015_mean = prec2015.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2016_mean = prec2016.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2017_mean = prec2017.reduceRegion(pie.Reducer.mean(), region, 1000);
- var prec2018_mean = prec2018.reduceRegion(pie.Reducer.mean(), region, 1000);
-
- //配置折线图的样式
- var line_options = {
- title: '1979-2018年山西省年降水量(mm)',
- legend: ['降水量(mm)'],
- xAxisName: "年份",
- yAxisName: "年降水量(mm)",
- chartType: "line"
- };
- var images = [prec1979_mean, prec1980_mean, prec1981_mean, prec1982_mean, prec1983_mean, prec1984_mean,
- prec1985_mean, prec1986_mean, prec1987_mean, prec1988_mean, prec1989_mean, prec1990_mean,
- prec1991_mean, prec1992_mean, prec1993_mean, prec1994_mean, prec1995_mean, prec1996_mean,
- prec1997_mean, prec1998_mean, prec1999_mean, prec2000_mean, prec2001_mean, prec2002_mean,
- prec2003_mean, prec2004_mean, prec2005_mean, prec2006_mean, prec2007_mean, prec2008_mean,
- prec2009_mean, prec2010_mean, prec2011_mean, prec2012_mean, prec2013_mean, prec2014_mean,
- prec2015_mean, prec2016_mean, prec2017_mean, prec2018_mean];
-
- var xSeries = [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, 2016, 2017, 2018];
-
- //绘制折线图
- ChartImage(images, xSeries, line_options);