wolfram语言入门

    科技2025-03-19  20

    wolfram语言入门

    Wildfires have been spreading in multiple states recently. California is suffering the most with some of its largest wildfires in history. Oregon has 20 large wildfires covering over 400,000 acres. And even Washington is not being spared this year.

    野火最近已在多个州蔓延。 加利福尼亚州遭受着历史上最大规模的野火之苦。 俄勒冈州有20处大火,覆盖面积超过40万英亩。 甚至华盛顿今年也不能幸免。

    To get a sense of where the current wildfires are, I implemented a function called WildfireData which sources data from NASA’s MODIS instruments aboard its Terra and Aqua satellites (code included at the end of this post):

    为了了解当前的野火状况,我实现了一个名为WildfireData的函数,该函数通过其Terra和Aqua卫星从NASA的MODIS仪器中获取数据(本文结尾处包含的代码):

    https://modis.gsfc.nasa.gov/

    https://modis.gsfc.nasa.gov/

    This WildfireData function can be accessed through the following global ResourceFunction URI:

    可以通过以下全局ResourceFunction URI访问此WildfireData函数:

    WildfireData = ResourceFunction[ "user:arnoudb/DeployedResources/Function/WildfireData"]

    We can now immediately use this function to get the currently available wildfire data from NASA:

    现在,我们可以立即使用此功能从NASA获取当前可用的野火数据:

    data = WildfireData[]

    The output is a dataset with several columns. The first column holds the geographical location of a wildfire observation and the second column holds its brightness:

    输出是具有几列的数据集。 第一列包含野火观测的地理位置,第二列包含其亮度:

    (Image by author) (图片由作者提供)

    We can start by plotting all the locations on a map:

    我们可以从在地图上绘制所有位置开始:

    GeoGraphics[{Red, Point[data[All, "Location"]]}]

    The output shows the observed wildfires:

    输出显示观察到的野火:

    (Image by author) (图片由作者提供)

    At this zoom level, it looks like there are quite a few wildfires in the South, but we can zoom into, for example, Mississippi to see up close:

    在此缩放级别上,南部似乎有很多野火,但是我们可以放大,例如密西西比州,以近距离观察:

    ms = Entity["AdministrativeDivision", {"Mississippi", "UnitedStates"}];GeoGraphics[{ Blue, Polygon[ms], Red, Point[data[All, "Location"]] }, GeoRange -> ms]

    Up close it becomes clear these wildfires are quite scattered and standalone:

    近距离来看,这些野火非常分散且独立:

    (Image by author) (图片由作者提供)

    We can compare Mississippi to Oregon to see the difference:

    我们可以将密西西比州和俄勒冈州进行比较,以了解两者之间的区别:

    or = Entity["AdministrativeDivision", {"Oregon", "UnitedStates"}];GeoGraphics[{ Blue, Polygon[or], Red, Point[data[All, "Location"]]}, GeoRange -> or]

    There are a far greater number of wildfires in Oregon:

    俄勒冈州的野火数量更多:

    (Image by author) (图片由作者提供)

    We can zoom in on any area, for example, the area within 40 miles of the center of Los Angeles:

    我们可以放大任何区域,例如,洛杉矶市中心40英里以内的区域:

    la = Entity["City", {"LosAngeles", "California", "UnitedStates"}];GeoGraphics[{ Red, Point[data[All, "Location"]]}, GeoRange -> GeoDisk[la, Quantity[40, "Miles"]]]

    There are many wildfires in the San Gabriel mountains:

    圣盖博山上有许多野火:

    (Image by author) (图片由作者提供)

    These wildfires have been named the Bobcat Fire (#bobcatfire on Twitter):

    这些野火被称为山猫火(Twitter上的#bobcatfire):

    演示地址

    There are also large wildfires east of Salem, Oregon:

    在俄勒冈州塞勒姆以东还有大火:

    area = Entity[“City”, {“Salem”, “Oregon”, “UnitedStates”}]GeoGraphics[{ Red, Point[data[All, "Location"]]}, GeoRange -> GeoDisk[area, Quantity[60, "Miles"]]]

    This shows a very big cluster of wildfires:

    这显示了一大堆野火:

    (Image by author) (图片由作者提供)

    Unfortunately, the wildfire season in the West is not expected to end until November. So far, in California alone, over 3,000,000 acres have burned with an estimated cost of $800,000,000. Oregon has lost over 600,000 acres and Washington has lost over 500,000 acres.

    不幸的是,西方的野火季节预计要到11月才能结束。 到目前为止,仅在加利福尼亚州,就有超过300万英亩的土地被烧毁,估计成本为8亿美元。 俄勒冈州损失了60万英亩,华盛顿损失了500,000英亩。

    Code for the WildfireData function:

    WildfireData函数的代码:

    WildfireData[] := Module[{base, csv1, csv2, csv, ds}, base = "https://firms.modaps.eosdis.nasa.gov/data/active_fire/c6/\ csv/"; csv1 = Once[Import[ URLBuild[{base, "MODIS_C6_USA_contiguous_and_Hawaii_24h.csv"}]]]; csv2 = Once[Import[URLBuild[{base, "MODIS_C6_Alaska_24h.csv"}]]]; csv = If[Length[csv2] > 1, Join[csv1, csv2], csv1]; ds = Dataset[Map[ <| "Location" -> GeoPosition[{First[#], #[[2]]}], "Brightness" -> #[[3]], "Scan" -> #[[4]], "Track" -> #[[5]], "AcquisitionDate" -> DateObject[{#[[6]] <> " " <> IntegerString[#[[7]], 10, 4], {"Year", "-", "Month", "-", "Day", " ", "Hour", "Minute"}}], "Satellite" -> #[[8]], "ConfidenceFraction" -> #[[9]]/100., "Version" -> #[[10]], "BrightnessT31" -> #[[11]], "FRP" -> #[[12]], "DayNight" -> #[[13]]|> &, Rest[csv]] ] ]

    翻译自: https://towardsdatascience.com/mapping-wildfires-with-the-wolfram-language-6ddbd9b030b0

    wolfram语言入门

    相关资源:wolframalpha数学使用教程.pdf
    Processed: 0.013, SQL: 8