{"id":561,"date":"2022-11-11T05:34:20","date_gmt":"2022-11-11T05:34:20","guid":{"rendered":"http:\/\/www.gislxz.com\/?p=561"},"modified":"2023-03-26T12:35:15","modified_gmt":"2023-03-26T12:35:15","slug":"ndvi%e9%a1%b9%e7%9b%ae%e8%ae%b0%e5%bd%95","status":"publish","type":"post","link":"https:\/\/www.gislxz.com\/index.php\/2022\/11\/11\/ndvi%e9%a1%b9%e7%9b%ae%e8%ae%b0%e5%bd%95\/","title":{"rendered":"ndvi\u9879\u76ee\u8bb0\u5f55"},"content":{"rendered":"\n<p>\u4e0b\u8f7d\u597d\u6570\u636e\u540e\uff0c\u5f00\u59cb\u5e72\u6d3b <\/p>\n\n\n\n<p>\u76ee\u524d\u6211\u4eec\u67092020\u5e7409\u6708\u52302021\u5e7410\u6708\u6bcf\u4e2a\u6708\u7684ndvi\u5747\u503ctif\uff0c\u5f53\u7136\u7531\u4e8e\u4e91\u7684\u5f71\u54cd\uff0c\u5f88\u591a\u5730\u65b9\u662f\u6709\u7a7a\u6d1e\u7684\uff0c\u4e0b\u9762\u8bb0\u5f55\u4e00\u4e0b\u5904\u7406\u8fc7\u7a0b<\/p>\n\n\n\n<p>\u9996\u5148\u54e8\u51752\u7684ndvi\u6570\u636e\u662f\u56db\u5f20\u4e0d\u540c\u8303\u56f4\u7684\u56fe\uff0c\u5148\u5bf9\u5176\u505a\u4e2a\u9576\u5d4c\u62fc\u6210\u4e00\u5e45\u56fe<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"873\" src=\"http:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-1024x873.png\" alt=\"\" class=\"wp-image-562\" srcset=\"https:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-1024x873.png 1024w, https:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-300x256.png 300w, https:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-768x655.png 768w, https:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image.png 1293w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u53d1\u73b0\u6709\u5f88\u591a\u5730\u65b9\u90fd\u6ca1\u6709\u6570\u636e\uff0c\u6ca1\u4e8b\u6211\u4eec\u8fd8\u6709landsat\u6570\u636e<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"848\" src=\"http:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-1-1024x848.png\" alt=\"\" class=\"wp-image-563\" srcset=\"https:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-1-1024x848.png 1024w, https:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-1-300x248.png 300w, https:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-1-768x636.png 768w, https:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-1.png 1228w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>landsat\u6570\u636e\u8fd8\u6ca1\u7ecf\u8fc7\u88c1\u526a\uff0c\u5148\u901a\u8fc7\u63a9\u819c\u63d0\u53d6\u8fdb\u884c\u88c1\u526a<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"812\" src=\"http:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-2-1024x812.png\" alt=\"\" class=\"wp-image-564\" srcset=\"https:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-2-1024x812.png 1024w, https:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-2-300x238.png 300w, https:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-2-768x609.png 768w, https:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-2.png 1295w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u4e4b\u540e\u8fdb\u884c\u9576\u5d4c\uff0c\u8981\u6ce8\u610f\u9576\u5d4c\u65f6\u53d6\u503c\u7684\u987a\u5e8f\uff0c\u4fdd\u8bc1\u54e8\u51752\u4f18\u5148\u4e8elandsat\uff0c\u7136\u540e\u8fd8\u8981\u8bbe\u7f6e\u50cf\u5143\u5927\u5c0f\uff0c\u4fdd\u6301\u548c\u54e8\u51752\u4e00\u81f4<\/p>\n\n\n\n<p>\u9576\u5d4c\u540e\u8fd8\u662f\u6709\u5c11\u91cf\u7a7a\u6d1e\u6ca1\u6709\u6570\u636e\uff0c\u63a5\u7740\u7528\u9ad8\u5206\u6570\u636e\u518d\u8fdb\u884c\u586b\u5145\uff0c\u53ef\u60dc\u9ad8\u5206\u6570\u636e\u53ea\u7ecf\u8fc7\u9884\u5904\u7406\uff0c\u8fd8\u662f\u4ee5\u53bf\u57df\u4e3a\u5355\u4f4d\u5b58\u50a8\uff0c\u5e76\u4e14\u8981\u624b\u52a8\u8ba1\u7b97ndvi<\/p>\n\n\n\n<p>\u9996\u5148\u5199\u4e00\u4e2a\u811a\u672c\u5c06\u9ad8\u5206\u6570\u636e\u8c03\u6574\u5b58\u50a8\u7ec4\u7ec7\u5f62\u5f0f<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>def list_dir(path = None):\n    date=&#91;\"202009\",\"202010\",\"202011\",\"202012\",\"202101\",\"202102\",\"202103\",\"202104\",\"202105\",\"202106\",\"202107\",\"202108\",\"202109\",\"202110\"]\n    dir_list = os.listdir(path)\n    for cur_file in dir_list:\n        cur_path = os.path.join(path, cur_file)\n        if os.path.isfile(cur_path):\n            print (cur_path)\n            if(cur_path&#91;-3:]==\"tif\"):\n                if(cur_path&#91;-10:-4] in date):\n                    to_path =\"E:\/ndvi_prj\/gf\/\" + cur_path&#91;-10:-4]\n                    shutil.move(cur_path,to_path)\n                    print(\"move to\"+to_path)\n            if(cur_path&#91;-3:]==\"ovr\"):\n                if(cur_path&#91;-14:-8] in date):\n                    to_path = \"E:\/ndvi_prj\/gf\/\" + cur_path&#91;-14:-8]\n                    shutil.move(cur_path,to_path)\n                    print(\"move to\"+to_path)\n        elif os.path.isdir(cur_path):\n            print(\"{0} : is dir!\".format(cur_path))\n            list_dir(cur_path) # \u9012\u5f52\u5b50\u76ee\u5f55<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"550\" src=\"http:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-3-1024x550.png\" alt=\"\" class=\"wp-image-566\" srcset=\"https:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-3-1024x550.png 1024w, https:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-3-300x161.png 300w, https:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-3-768x413.png 768w, https:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-3-1536x825.png 1536w, https:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-3.png 1709w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>\u539f\u59cb\u662f\u53bf\u57df\u5b58\u50a8<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"549\" src=\"http:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-4-1024x549.png\" alt=\"\" class=\"wp-image-567\" srcset=\"https:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-4-1024x549.png 1024w, https:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-4-300x161.png 300w, https:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-4-768x412.png 768w, https:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-4-1536x823.png 1536w, https:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-4.png 1709w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>\u8f6c\u6210\u6309\u65f6\u95f4\u5b58\u50a8<\/figcaption><\/figure>\n\n\n\n<p>\u4e00\u6b21\u5bfc\u5165\u8be5\u6708\u6240\u6709\u7684\u56fe\u50cf\uff0c\u9576\u5d4c\u9009\u6700\u5927\u503c\uff0c\u56e0\u4e3a\u8fd9\u4e2a\u6570\u636e\u7684\u80cc\u666f\u503c\u662fRGB\uff080\uff0c0\uff0c0\uff09\u800c\u4e0d\u662fNaN\uff0c\u4e4b\u540e\u7528\u4e91\u63a9\u819c\u8fdb\u884c\u62a0\u51fa\u3002\u7528\u91cd\u5e86\u5e02shp\u548c\u4e91\u63a9\u819c\u4ea4\u96c6\u53d6\u53cd\uff0c\u7136\u540e\u63a9\u819c\u63d0\u53d6<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"845\" src=\"http:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-5-1024x845.png\" alt=\"\" class=\"wp-image-568\" srcset=\"https:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-5-1024x845.png 1024w, https:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-5-300x247.png 300w, https:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-5-768x633.png 768w, https:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-5.png 1375w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u6309\u63a9\u819c\u63d0\u53d6\uff0c\u6ce8\u610f\u63a9\u819c\u5fc5\u987b\u662fshp\u800c\u4e0d\u662f\u8981\u7d20\uff0c\u5426\u5219\u4f1a\u51fa\u9519<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"820\" src=\"http:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-6-1024x820.png\" alt=\"\" class=\"wp-image-569\" srcset=\"https:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-6-1024x820.png 1024w, https:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-6-300x240.png 300w, https:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-6-768x615.png 768w, https:\/\/www.gislxz.com\/wp-content\/uploads\/2022\/11\/image-6.png 1484w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>&gt;&gt;&gt; import os\n    import time\n    import arcpy\n    from arcpy import env\n\n    def zonal(raster, shp):\n\tattri_table = \"zonalstat\"\n\tarcpy.gp.ZonalStatisticsAsTable_sa(shp, \"FID\", raster, attri_table, \"NODATA\", \"MEAN\")\n\tarcpy.JoinField_management(shp,\"FID\", attri_table, \"FID\")\n\n    if __name__ == \"__main__\":\n\ttime1 = time.time()\n\tndvi_ras = 'E:\/ndvi_prj\/ndvi_2000\/202010.tif'\n\tshp = 'E:\/ndvi_prj\/500101\/500101.shp'\n\ttemp_path = 'E:\/ndvi_prj\/\/temp\/'\n\n\tarcpy.CheckOutExtension('Spatial')\n\tarcpy.env.overwriteOutput = True\n\tenv.workspace = temp_path\n\n\tzonal(ndvi_ras, shp)\n\ttime2 = time.time()\n\tprint((time2-time1) \/ 3600.0)<\/code><\/pre>\n\n\n\n<p>arcpy\u8fdb\u884c\u5206\u533a\u7edf\u8ba1\u5e76\u5b57\u6bb5\u8fde\u63a5<\/p>\n\n\n\n<p>\u4f46\u662f\u901f\u5ea6\u8fd8\u662f\u592a\u6162\uff0c\u4e8e\u662f\u6362\u6210\u63d0\u53d6\u4e2d\u5fc3\u70b9\u503c\u8fdb\u884c\u8d4b\u503c<\/p>\n\n\n\n<p>\u6d41\u7a0b\u662f1\u8981\u7d20\u8f6c\u70b92\u591a\u503c\u8d4b\u503c\u5230\u70b93\u5b57\u6bb5\u8fde\u63a54\u5220\u9664\u591a\u4e8e\u5b57\u6bb5<\/p>\n\n\n\n<p>\u5728\u64cd\u4f5c\u8fc7\u7a0b\u4e2d\u53d1\u73b0\u5220\u9664\u591a\u4f59\u5b57\u6bb5\u65f6\u901f\u5ea6\u6781\u6162\u4e14\u51fa\u9519\uff0c\u6298\u817e\u534a\u5929\u539f\u6765\u662fshp\u7684\u5c5e\u6027\u8868\uff08dbf\u6587\u4ef6\uff09\u8fc7\u5927\uff0c\u5bfc\u81f4\u6ea2\u51fa\u3002\u56e0\u800c\u5c06\u5220\u9664\u591a\u4e8e\u5b57\u6bb5\u653e\u5728\u7b2c\u4e00\u6b65\u6765\u505a\u3002QGIS\u7684\u4fdd\u7559\u5b57\u6bb5\u53ef\u4ee5\u751f\u6210\u65b0\u7684shp\uff0c\u901f\u5ea6\u6bd4arcgis\u5220\u9664\u5b57\u6bb5\u5feb\u5f88\u591a<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e0b\u8f7d\u597d\u6570\u636e\u540e\uff0c\u5f00\u59cb\u5e72\u6d3b \u76ee\u524d\u6211\u4eec\u67092020\u5e7409\u6708\u52302021\u5e7410\u6708\u6bcf\u4e2a\u6708\u7684ndvi\u5747\u503ctif\uff0c\u5f53\u7136\u7531\u4e8e\u4e91\u7684\u5f71\u54cd\uff0c\u5f88\u591a\u5730\u65b9\u662f\u6709\u7a7a\u6d1e &#8230;<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[25,24],"tags":[],"class_list":["post-561","post","type-post","status-publish","format-standard","hentry","category-gis","category-24"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.gislxz.com\/index.php\/wp-json\/wp\/v2\/posts\/561","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gislxz.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gislxz.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gislxz.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gislxz.com\/index.php\/wp-json\/wp\/v2\/comments?post=561"}],"version-history":[{"count":4,"href":"https:\/\/www.gislxz.com\/index.php\/wp-json\/wp\/v2\/posts\/561\/revisions"}],"predecessor-version":[{"id":573,"href":"https:\/\/www.gislxz.com\/index.php\/wp-json\/wp\/v2\/posts\/561\/revisions\/573"}],"wp:attachment":[{"href":"https:\/\/www.gislxz.com\/index.php\/wp-json\/wp\/v2\/media?parent=561"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gislxz.com\/index.php\/wp-json\/wp\/v2\/categories?post=561"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gislxz.com\/index.php\/wp-json\/wp\/v2\/tags?post=561"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}