冰島冰川融多快?冰島學生實地測量

摘錄自2019年11月10日中央通訊社冰島報導

冰島7年級學生莉亞(Lilja Einarsdottir)今天和同學來了趟不尋常的田野之旅:他們一同測量索爾黑馬冰川過去這一年間縮減了多少,親身見證氣候的變遷。莉亞說:「很漂亮,但看到冰河消融了這麼多,也覺得很難過。」

2010年起的每年10月,現已退休的教師史提凡松(Jon Stefansson)都會帶60公里外村落霍爾斯沃德呂爾(Hvolsvollur)的13歲學生,前來測量索爾黑馬冰川(Solheimajokull)的演變。他們的測量結果讓人不寒而慄:過去10年間,夾在兩大山坡間的索爾黑馬冰川,每年平均縮減40公尺。

莉亞說:「(第一批學生)開始在這裡測量時,看不到任何的水,所以(冰川)一開始非常的大。」

冰島境內約1成1面積是冰川,但過去25年間,冰川消失約250立方公里,相當於總體積的7%。而學生們測量的索爾黑馬冰川因距離冰島首都雷克雅維克(Reykjavik)最近,僅150公里。在學生們測量的這將近10年間,索爾黑馬冰川縮減了380公尺。

本站聲明:網站內容來源環境資訊中心https://e-info.org.tw/,如有侵權,請聯繫我們,我們將及時處理

【其他文章推薦】

網頁設計公司推薦不同的風格,搶佔消費者視覺第一線

※廣告預算用在刀口上,台北網頁設計公司幫您達到更多曝光效益

※自行創業缺乏曝光? 網頁設計幫您第一時間規劃公司的形象門面

南投搬家公司費用需注意的眉眉角角,別等搬了再說!

新北清潔公司,居家、辦公、裝潢細清專業服務

土地劣化警訊 歐洲泥炭地乾旱擴大 部分達2000年來最嚴重

環境資訊中心外電;姜唯 翻譯;林大利 審校;稿源:Carbon Brief

根據,歐洲的泥炭地可能會從碳匯轉變為碳排放源,因為有1/4的泥炭地乾旱程度已達到2000年來最嚴重。

這種「大範圍」且「嚴重」乾旱趨勢與近期自然和人為氣候變遷趨勢吻合,也可能是因為泥炭地被用於農業和燃料而加劇。

同時有,北部地區泥炭地儲存的碳量可能是過去估計值的兩倍。

這兩篇論文都發表在《自然地球科學》(Nature Geoscience)期刊上,顯示有必要努力保護泥炭地作為高緯度地區的碳儲存場所。

歐洲泥炭地乾旱程度達到令科學家緊張的程度。照片來源:里茲大學(CC0)

受威脅的泥炭地

土壤積水情況延緩植物分解的速度時便形成泥炭地,死去的植物在此長時間層層累積。透過泥炭地,科學家能了解地球陸地表面如何排放和吸收碳。

儘管泥炭地僅覆蓋地球表面的3%左右,但土壤碳含量卻佔了大約五分之一。在歐洲,泥炭地生態系統儲存的二氧化碳比森林多五倍。

但是許多泥炭地生態受到威脅,部分原因是人類數百年來利用泥炭作為燃料或肥料。

受損的泥炭地是顯著的碳排放源,每年釋放約3.5%的全球人為二氧化碳排放量。

里茲大學的研究人員、論文之一的主要作者史雲鐸(Graeme Swindles)博士介紹了歐洲乃至歐洲之外地區泥炭地生態系統面臨的各種問題:

「因為人類對泥炭資源或土地利用的需求,泥炭地面臨破碎化、水分排乾、燃燒、農業和綠化等威脅。氣候暖化和乾旱也是主要因素。」

雖然淹水的泥炭會繼續儲存碳,但氣候變動或人類破壞引起的擾動會使氧氣進入,觸發二氧化碳的釋放。

歐洲許多泥炭地已經顯示出這種跡象,其中植被從泥炭苔蘚變成草木和灌木。

芬蘭Torronsuo國家公園的一處沼澤濕地。 攝(CC BY 2.0)

乾旱趨勢

萊斯特大學濕地生態學家佩姬(Susan Page)教授肯定史雲鐸的研究。該研究確認了從斯堪地那維亞到波羅的海,整個歐洲泥炭地的乾旱趨勢,在最近200年間尤其明顯。佩姬向Carbon Brief解釋:

「泥炭地提供許多有益的生態系統服務,但常常被低估,包括碳儲存和封存,對減緩氣候變化有重要作用,其日漸乾旱的趨勢應受到關注。」

這個趨勢不只是人為活動所造成,但作者指出,歐洲泥炭地「可能正在偏離自然變化的基線」,其中又以英國和愛爾蘭的泥炭地最為嚴重。

由於缺乏長期的水文監測數據,科學家們利用沼澤中的微小變形蟲的殼來推測歷史水位。

他們分析了31個歐洲泥炭地的重建情況,發現從1800年到2000年,有60%的土地比過去600年更為乾旱。

此外,有40%的泥炭地處於1,000年來最乾旱的狀態,更有24%是2,000年以來最乾旱。

他們認為這反映了該地區氣候日益乾旱,人為影響可能加劇了這個趨勢。整體而言,研究人員在42%的測試地點發現重大破壞,另有29%遭受輕微破壞。

但是史雲鐸強調,他們的研究工作大多在歐洲最完好的土地上進行…因此許多泥炭地的狀況會更糟。

第二篇論文讓史雲鐸的研究結果更顯重要。第二篇研究指出,歐洲泥炭地儲存碳的作用可能比過去所知更大。

英國湖區的泥炭地。照片來源: (CC BY-NC-ND 2.0)

碳儲存估算結果倍增

紐約哥倫比亞大學的尼可斯(Jonathan Nichols)教授和同事皮特(Dorothy Peteet)教授的研究估計,北部泥炭地儲存著大約10,550億公噸的碳。2010年理海大學余自成(Zicheng Yu,音譯)博士等人在同一地區估算出的數據則是5,470億公噸。

尼可斯說,過去的研究沒有將適當將未採樣地區納入估計,如亞洲和南部歐洲。

他說,泥炭地的碳通常使用「歷時法」測量,將各個地點的碳隨時間累積的速率求平均值,再加上泥炭地的面積以求出總碳量。

根據他們的論文,過去使用此方法的研究已受到「幾個已知的採樣偏差來源」的影響。

兩位作者強調了這樣一個假設:泥炭隨時間的累積速率是全球氣候的結果,因此北半球的泥炭地都相似。

尼可斯向Carbon Brief解釋在此假設下他們的方法如何改善估計精準度:

「最大的差異在於如何求所有不同地點的平均水準……人們用來衡量碳累積率的大多數地點都在西北歐洲和加拿大,因此計算會偏向那些地方,而遠離其他地方……(我們試著)根據地區加權平均值,而不是根據已進行的測量次數任意加權。」

研究人員使用4,000多個放射性碳測量值來確定645個泥炭地測試點的泥炭年齡。

他們將來自Neotoma古生態學資料庫先前未使用的數據與新的計算方法結合,估算碳累積的歷史以及泥炭地的形成時間。

位於拉脫維亞的大凱邁里(Great Kemeri)沼澤區。來源: (CC BY 2.0)

潛在問題

Carbon Brief採訪了許多科學家,他們對尼可斯和皮特的分析感到驚訝,因為他們的碳儲量估計比過去大很多。有人對他們的估計方法提出了疑問。

2010年泥炭地碳累積研究主持人余博士告訴Carbon Brief,他很高興看到這樣的論文取得了可觀的進展,但他擔心其中可能有「重大技術缺陷」而必須修訂。

他告訴Carbon Brief,這個領域的科學家很早就認同必須考量泥炭地之間的區域差異,但缺乏足夠的資料來這麼做:

「在這方面,新論文透過計算八個泥炭地區中每個區域的碳累積率來解決空間偏差,很可能是重大的進展跟改善。」

(新研究的作者主要依據政治邊界將北部的泥炭地分為八個區域。他們還設計了另外兩種劃分區域的方式,以消除任何偏誤。)

余自成說,據他所知,儘管泥炭地之間存在已知的差異,但尼可斯和皮特必須用一個平均碳密度值代表所有站點「很可惜,但也許無法避免。」

透過合併以前被忽略的數據,新論文的作者納入了通常不被視為「北部」泥炭地的地點,包括南歐某些地區,甚至還有北非的一些地區。

余自成認為,這兩個因素的結合導致對北部泥炭碳儲存量的高估。

尼可斯在回應此批評時告訴Carbon brief,除了平均碳密度以外,他們還納入有16,000個測量值的大量分布,因此能考慮到相當大的變化和不確定性。至於採納更多地點,他說「基於這份研究的觀點,這麼做是對的」:

「我們要根據已知泥炭地的所在來測量泥炭地的碳,而非根據假設的泥炭地所在。」

實際上,這表示該研究包括了過去不納入研究的區域(包括泥炭地比較少的地區)的數據。整體而言,他說,他們的方法旨在產生「更大的不確定性」,但最終結果比過去的研究更接近「真實」答案。

芬蘭北部奧伊湖(Oijärvi)附近一處沼澤溼地。 (CC BY 2.0)

真正的問題

這兩篇論文強調泥炭地對科學家了解氣候系統的重要性,以及維護和恢復泥炭地的必要性。

阿伯丁大學土壤學專家、政府間氣候變遷專門委員會的作者史密斯(Pete Smith)教授沒有參與任何一項研究,他對Carbon brief表示:

「綜觀這兩份研究,它們顯示高緯度泥炭地是重要的碳匯,因為泥炭地面積和碳儲量都在成長,但是一旦變得乾旱,則可能從淨碳匯變成碳排放源,這是真正的問題。」

他指出,儘管史雲鐸的論文顯示泥炭地變乾的現象可能還沒有超出「正常的泥炭地乾濕週期,但偏離長期基準表示逼近一個臨界值,超過這個臨界值則泥炭形成會轉為泥炭降解,導致大量的碳進入空氣。」

佩姬說,特別令人擔憂的是,這些擾動和人類活動的結合會產生「累積效應」。

史雲鐸和他的團隊寫道,歐洲泥炭地正處於「過渡狀態」,已經採取一些措施,像是堵塞人工排水溝和溝渠來恢復部分泥炭地。

他們指出,這些行動對於防範人為影響和未來的全球暖化可能非常重要。他們說要採取這些措施必須參考他們的研究發現。

尼可斯表示,考慮到泥炭地面臨的威脅,對於科學家而言,調查全世界可用的泥炭總量很重要,才能計算有多少可以損失:

「泥炭地通常不被當成全球氣候模型的一部分。但如果我們想對未來的氣候做出現實的預測,泥炭地就必須成為一部分。」

Europe’s carbon-rich peatlands show ‘widespread’ and ‘concerning’ drying trends by Josh Gabbatiss

European peatlands could turn from carbon sinks to sources as a quarter have reached levels of dryness unsurpassed in a record stretching back 2,000 years, according to a new study.

This trend of “widespread” and “substantial” drying corresponds to recent climate change, both natural and human-caused, but may also be exacerbated by the peatlands being used for agriculture and fuel.

It comes as another study estimates that the amount of carbon stored in peatlands across northern regions could be as much as double previous, widely reported estimates.

The papers, both published in Nature Geoscience, indicate a need for efforts to conserve peatlands as sites of carbon storage at higher latitudes.

Taken together, the findings are “a real concern”, according to one scientist not involved in the research, given the key role these ecosystems play in the global carbon cycle.

Threatened peat

Peatlands when waterlogged conditions slow down plant decomposition, meaning layers of dead plants accumulate over many years as peat. They are a vital component in scientists’ understanding of how the planet’s land surface emits and takes up carbon.

Despite only covering around 3% of the Earth’s surface, peatlands contain of its soil carbon. In Europe, these ecosystems store more CO2 than forests.

However, the existence of many peatlands is under threat, partly thanks to centuries of human exploitation of peat as a or .

Damaged peatlands are a significant source of emissions, 3.5% of global anthropogenic CO2 emissions each year.

, a researcher and lead author of one of the papers, lays out the various issues facing these ecosystems in Europe and further afield:

“Cutting, drainage, burning, agriculture, afforestation. All driven by need for peat as a resource or for land-use practices not in line with keeping healthy peatlands. Climate warming and drying is also a major factor in tandem with these.”

While waterlogged peat will continue to store carbon, disturbances resulting from climate fluctuations or humans damaging these ecosystems allow oxygen to enter it, triggering the release of CO2.

Many European peatlands have already shown evidence of this transition, as the vegetation they support shifting from peat mosses to grass and shrubs.

Drying trend

The , produced by Swindles and a large international group of scientists, was welcomed by wetland ecologist as a “robust piece of work” – and one with some significant implications.

It identifies a drying trend across European peatlands, from Scandinavia to the Baltics, that has become particularly pronounced in the last 200 years. Page explains to Carbon Brief:

“This trend should be of concern given that peatlands deliver a range of beneficial, but often undervalued ecosystem services, including carbon storage and sequestration and, therefore, have an important role to play in climate mitigation.”

While the results are not merely the result of human interventions, the authors note that European peatlands “may now be moving away from natural baselines”. The results were most severe for peatlands across Great Britain .

As there is no long-term hydrological monitoring data available, the scientists use the presence of shells (or “tests”) from tiny, to gauge historic water levels.

They analysed reconstructions of 31 European peatlands, concluding 60% of the sites were drier from 1800 to 2000 than they had been for the last 600 years.

Furthermore, 40% of sites were at their driest in 1,000 years, and 24% were drier than they had ever been across the entire 2,000-year record.

While they concluded that this effect mirrored an increasingly dry climate in the region, they also note that human influence in peatlands is likely to have exacerbated the trend. In total, they identified significant damage by people in 42% of the sites and a further 29% suffering from minor damage.

However, Swindles notes that they “mostly worked on the most intact sites in Europe…so there are many more that have suffered drainage far worse than this”.

These results could be particularly significant in light of the second paper, which suggests the role played by European peatlands in storing carbon may be even greater than previously imagined.

Doubling storage

In , and his colleague , both at in New York, estimate that northern peatlands store approximately 1,055 gigatonnes (Gt) of carbon.

They compared this to a made by from and his collaborators back in 2010, who arrived at a figure of 547Gt for the same region.

Nichols explains their work to Carbon Brief, noting that past analyses did not properly account for undersampled regions, such as Asia and Southern Europe.

Peatland carbon, he says, is normally measured using a “time-history method” that involves averaging together the rate at which carbon has accumulated over time at a variety of sites, combined with the area of the peatland to get the total amount of carbon.

According to their paper, past attempts that have used this method have been affected by “several known sources of sampling bias”.

Specifically, the pair highlight the assumption that peat accumulation rates over time are the result of the global climate and are, therefore, similar across the northern hemisphere.

Nichols explains to Carbon Brief how their method improves on this assumption:

“The big difference is how I average all the different sites together…Most of the sites that people have measured carbon accumulation rate at are in Northwest Europe and Canada. So you basically bias your calculations towards those places and away from other places…[We tried to] fix that problem by weighting our averages based on area, instead of arbitrarily based on how many measurements had been made.”

The researchers used over 4,000 radiocarbon measurements to determine the age of peat from 645 peatland sites.

They incorporated previously unused data from the , together with new computer algorithms for estimating the history of peat carbon accumulation and when peatlands were formed.

Nichols notes that while their final figure for carbon storage is considerably higher than previous data-driven efforts, modelling studies have already yielded higher figures:

“If you used an earth system model to predict how much peat there should be, it’s usually more than what we get when we measure, so hopefully this will make it so they are more in line.”

Potential shortcomings

Carbon Brief talked to a number of scientists who expressed surprise at Nichols and Peteet’s analysis, given the far larger estimate of carbon storage it yielded. Others raised questions about the methods the pair had used to arrive at their final figure.

Yu, who led the team that arrived at the 2010 peatland estimate, tells Carbon Brief that while he is pleased to see such a paper achieving prominence, he is concerned there are “major technical shortcomings” that have led to this considerable revision.

He tells Carbon Brief that while scientists working in this area have “long recognised” that accounting for regional differences between peatlands is the “right way to go”, lack of sufficient data has hampered their efforts:

“In this regard, this new paper has made a potentially important progress and improvement by attempting the calculations of carbon accumulation rates for each of eight peat regions, with a goal to account for spatial bias.”

(As part of their analysis, the researchers divided northern peatlands into eight regions, based mainly on political boundaries, that tend to be reported in scientific literature. They also devised two other ways of dividing the region up to eliminate any biases.)

Yu goes on to say that it is “unfortunate and perhaps unavoidable” that, from what he could tell, Nichols and Peteet had to use a single average carbon density value for all sites, despite the known variation across peatlands.

He adds that by incorporating previously overlooked data, the authors of the new paper have included sites that would not normally be considered under the category of “northern” peatlands. Among these are some parts of southern Europe and even a couple in North Africa.

Yu says that, in his view, the combination of these two factors has led to an overestimation of the amount of carbon storage provided by northern peat.

Responding to this criticism, Nichols tells Carbon Brief that beyond the average carbon density, they also took into account the considerable variation and uncertainty by incorporating a large distribution of values based on 16,000 measurements. As for the wider array of locations, he says this “gets right at the point of the paper”:

“We set out to measure carbon in peatlands based on where we know peatlands to exist, not where we assume them to be.”

In practice, this means including data from unconventional areas, including regions where peatlands are sparse. Overall, he says their methods were designed to produce “much wider uncertainties” but also a final result that is closer to the “real” answer than previous attempts.

‘Real concern’

The publication of these two papers serves to highlight the importance of peat for scientists’ understanding of the climate system, as well as the need to preserve and restore peatlands.

, a soils expert at the and author who was not involved in either study, tells Carbon Brief:

“Taken together, the studies suggest that high-latitude peatlands are acting as a significant carbon sink, as they are growing in area and carbon stock – but, if they are also drying, there is potential that they could turn from net carbon sinks to sources. Given the huge store of carbon in high latitude peatlands, that is a real concern.”

He notes that while the Swindles paper suggests drying may not yet be beyond “normal peatland drying cycles”, the shift away from long-term baselines “may be pushing them closer to a threshold whereby peat formation is replaced by peat degradation, which would lead to massive losses of carbon to the atmosphere”.

Page says a particular concern is that a combination of these perturbations and human activities have a “cumulative effect”.

Swindles and his team write that with European peatlands in a “state of transition”, there are to restore some of them by damming artificial drains and gullies.

They note that these actions may be “vital” in protecting against both human impacts and future global warming. They say these initiatives must take their findings into account.

For his part, Nichols says that considering the threats facing peatlands, it is important for scientists to investigate the total volume of peat available across the world, in order to “put a number on how much there is to lose”:

“Peatlands are not usually part of global climate models. If we want to make realistic predictions of future climate, peatlands need to be a part of it.”

※ 全文及圖片詳見:()

參考資料

  • Swindles, G.T. et al. (2019) Widespread drying of European peatlands in recent centuries, Nature Geoscience,
  •  
  • Nichols, J.E. and Peteet, D.M. (2019) Rapid expansion of northern peatlands and doubled estimate of carbon storage, Nature Geoscience,

※ 本文與 行政院農業委員會 林務局  合作刊登

作者

如果有一件事是重要的,如果能為孩子實現一個願望,那就是人類與大自然和諧共存。

於特有生物研究保育中心服務,小鳥和棲地是主要的研究對象。是龜毛的讀者,認為龜毛是探索世界的美德。

本站聲明:網站內容來源環境資訊中心https://e-info.org.tw/,如有侵權,請聯繫我們,我們將及時處理

【其他文章推薦】

※自行創業缺乏曝光? 網頁設計幫您第一時間規劃公司的形象門面

網頁設計一頭霧水該從何著手呢? 台北網頁設計公司幫您輕鬆架站!

※想知道最厲害的網頁設計公司"嚨底家"!

※幫你省時又省力,新北清潔一流服務好口碑

※別再煩惱如何寫文案,掌握八大原則!

增長率為76% 全球電動車市場達74萬輛車

德國Baden-Württemberg省的太陽能和氫能研究中心(ZSW)日前發佈的一份報告透露,全球電動汽車市場目前已達74萬輛車,其中幾乎有一半(32萬)註冊於2014年。基於電動車約為76%的增長率,去年汽車電池供應商的收益為20億歐元。   其中,美國市場增長69%,本土道路上的電動汽車數量增至29萬輛,占全球的三分之一。而中國是世界上第三最強大的電動車市場,2014年增加了約5萬4千輛,增長了120%,全國道路上接近有10萬輛電動車,僅次於擁有11萬電動車(2014年45%的速度增長)的日本。   該德國中心發現,這三個主要國家的扶持政策説明加速電動汽車的採用。在中國,例如,國產電動車是被補貼的,對終端消費者來講比較便宜。而德國相反,沒有市場激勵機制,從而只有11700新車註冊。   此外,該報告還發現,日產的Leaf是最流行的電動車品牌,創下了自2010年以來15萬的全球註冊記錄。第二是通用汽車公司的雪佛蘭Volt,全球註冊75000輛,第三為6萬註冊量的豐田Prius。而特斯拉S型已售出5萬輛,遙遙領先15000輛的寶馬的i3,事實上,i3才在市場上超過12個月,因此在這麼短時間內已具有這樣的市場份額,是令人印象深刻的。   2012年和2014年之間新車註冊數量每年增加兩倍。“如果近幾年的勢頭依然不減,在短短幾個月的時間裡,全球電動車的數量將超過百萬。”ZSW電化學能源技術事業部主任Werner Tillmetz表示。 

本站聲明:網站內容來源於EnergyTrend https://www.energytrend.com.tw/ev/,如有侵權,請聯繫我們,我們將及時處理

【其他文章推薦】

※為什麼 USB CONNECTOR 是電子產業重要的元件?

網頁設計一頭霧水該從何著手呢? 台北網頁設計公司幫您輕鬆架站!

※台北網頁設計公司全省服務真心推薦

※想知道最厲害的網頁設計公司"嚨底家"!

新北清潔公司,居家、辦公、裝潢細清專業服務

※推薦評價好的iphone維修中心

為主攻電動車 捷豹路虎將擴建英國研發中心以推新款

據英國汽車雜誌autocar3月25日消息,捷豹路虎計畫加大超低排放技術的研發,將其位於英國考文垂Whitley的研發中心由現有面積55英畝投資擴建一倍至110英畝,為其純電動汽車的問世鋪路。Whitley研發中心是捷豹、路虎兩個品牌先進動力工程低級、捷豹設計部門及公司的全球總部所在地。   其首批車型預計將會是捷豹XE豪華轎車純電動版,以及F=Pace跨界車的電動版,後者續航里程約300英里。此外,路虎推出電動SUV的可能性也很大,預計將採用與捷豹汽車相同的技術。

本站聲明:網站內容來源於EnergyTrend https://www.energytrend.com.tw/ev/,如有侵權,請聯繫我們,我們將及時處理
【其他文章推薦】

USB CONNECTOR掌控什麼技術要點? 帶您認識其相關發展及效能

台北網頁設計公司這麼多該如何選擇?

※智慧手機時代的來臨,RWD網頁設計為架站首選

※評比南投搬家公司費用收費行情懶人包大公開

※幫你省時又省力,新北清潔一流服務好口碑

※回頭車貨運收費標準

特斯拉有望 3 年後內在中國設廠

特斯拉(Tesla)執行長馬斯克(Elon Musk)在博鰲論壇期間表示,特斯拉希望 3 年內在中國大陸建立生產和設計基地,且馬斯克再度承諾,儘管目前所有在中國市場上銷售的特斯拉汽車都是從美國加州進口的,但特斯拉對發展中國市場有強烈的長期意向,盼能建立本土的生產和設計基地。   馬斯克表示,特斯拉將長期開拓中國市場,於 3 年內在中國設立工廠和研發中心,但得等到特斯拉在加州的工廠實現全能運轉,達到全部產能後,特斯拉才會考慮在海外市場建廠。因此,特斯拉還會持續進口到中國市場一段時間。   針對 2014 年特斯拉在中國的銷售不如預期,據馬斯克解釋,目前特斯拉處於「投機後遺症」的恢復期當中,「中國是特斯拉在全世界範圍內唯一有多餘庫存的市場。我們現在還在消化庫存中」。2014 年特斯拉剛剛進入中國市場時,投機者造成市場需求「極高」的假象。後來投機者取消訂單,導致庫存增加。   馬斯克並表示,在新戰略的引導下,特斯拉 3 月在中國市場的銷量較 2 月大幅成長,增幅達 130% 至 150%。  

本站聲明:網站內容來源於EnergyTrend https://www.energytrend.com.tw/ev/,如有侵權,請聯繫我們,我們將及時處理

【其他文章推薦】

※為什麼 USB CONNECTOR 是電子產業重要的元件?

網頁設計一頭霧水該從何著手呢? 台北網頁設計公司幫您輕鬆架站!

※台北網頁設計公司全省服務真心推薦

※想知道最厲害的網頁設計公司"嚨底家"!

新北清潔公司,居家、辦公、裝潢細清專業服務

※推薦評價好的iphone維修中心

複製代工經驗、不做品牌 鴻海打造電動車模組平台

鴻海集團客戶遍布全球,而且都是指標企業,為了不和客戶競爭,鴻海董事長郭台銘曾公開表示:「我絕不做品牌,要用通路打造一條龍服務。」法人認為,鴻海集團以代工稱霸一方,如今投入電動車研發,仍堅持不打品牌,可望複製代工經驗,協助客戶把產品做得更好、生產周期更短。   鴻海集團汽車事業群總經理林棟樑表示,鴻海集團可以提供全球電動車需要的關鍵零組件,而且成本更有競爭力。鴻海是從 3C 製造起家,做電腦、通訊、消費電子產品,世界上大部分品牌都是鴻海製造。   林棟樑強調,鴻海不做整車,打造電動車是別人的事,「我把平台建好,你要的我提供給你。」

本站聲明:網站內容來源於EnergyTrend https://www.energytrend.com.tw/ev/,如有侵權,請聯繫我們,我們將及時處理
【其他文章推薦】

USB CONNECTOR掌控什麼技術要點? 帶您認識其相關發展及效能

台北網頁設計公司這麼多該如何選擇?

※智慧手機時代的來臨,RWD網頁設計為架站首選

※評比南投搬家公司費用收費行情懶人包大公開

※幫你省時又省力,新北清潔一流服務好口碑

※回頭車貨運收費標準

簽訂「首爾宣言」 新北市力推電動車

新北市副市長陳伸賢昨出席「國際地方政府環境行動理事會(ICLEI)2015 世界大會」,並與各國代表簽訂 ICLEI「首爾宣言」,宣誓將持續減碳,新北也將推動環保電動車各項措施。   陳伸賢昨與首爾市長朴元淳交流時,對首爾市推動省下一座核電廠政策非常感佩,他表示,面對全球環境汙染、能源消耗及氣候變遷等問題,新北市也努力降低汙染,包括推動黃金里資收站、路燈與交通號誌燈全面 LED 化、綠能屋頂等各項措施。目前新北市綠色能源發電比例已達 5%。   針對車輛產生的汙染,未來新北市將推廣與建設大眾運輸、鼓勵使用綠色交通工具如電動機車、電動車、公共自行車等方式,並將「電動車」列為重點發展產業,持續推動電動車普及化。   (照片:韓國首爾市長朴元淳、新北市副市長陳伸賢。照片來源:新北市政府)

本站聲明:網站內容來源於EnergyTrend https://www.energytrend.com.tw/ev/,如有侵權,請聯繫我們,我們將及時處理

【其他文章推薦】

網頁設計公司推薦不同的風格,搶佔消費者視覺第一線

※廣告預算用在刀口上,台北網頁設計公司幫您達到更多曝光效益

※自行創業缺乏曝光? 網頁設計幫您第一時間規劃公司的形象門面

南投搬家公司費用需注意的眉眉角角,別等搬了再說!

新北清潔公司,居家、辦公、裝潢細清專業服務

台歐盟電動車研討會登場!助台廠入全球供應鏈

為推動台歐盟雙方未來在電動車領域的合作,經濟部標準檢驗局、國際貿易局及歐洲經貿辦事處於 4 月 10 日共同舉辦「臺歐盟電動車研討會」。   台灣具有良好資通訊產業基礎及發展智慧車輛模組系統能量,發展電動車產業有競爭潛力,如能獲得歐盟相關經驗,必可切入全球電動車之零件與系統模組供應鏈,促成國內電動車產業迅速發展。   標準檢驗局劉明忠局長表示,為加速推動台灣電動車發展,自 2011 年便積極推動電動車運行環境的標準,至 2014 年底已完成包括整車、鋰電池系統,電動機/驅動器及共通詞彙/符號等總計 34 種電動車國家標準,已完成包括最高速率、電能消耗、行駛距離、加速能力及爬坡速率等超過 50 個以上測試項目之實車驗證。

本站聲明:網站內容來源於EnergyTrend https://www.energytrend.com.tw/ev/,如有侵權,請聯繫我們,我們將及時處理

【其他文章推薦】

※自行創業缺乏曝光? 網頁設計幫您第一時間規劃公司的形象門面

網頁設計一頭霧水該從何著手呢? 台北網頁設計公司幫您輕鬆架站!

※想知道最厲害的網頁設計公司"嚨底家"!

※幫你省時又省力,新北清潔一流服務好口碑

※別再煩惱如何寫文案,掌握八大原則!

FreeSql 使用 ToTreeList/AsTreeCte 查詢無限級分類表

關於無限級分類

第一種方案:
使用遞歸算法,也是使用頻率最多的,大部分開源程序也是這麼處理,不過一般都只用到四級分類。 這種算法的數據庫結構設計最為簡單。category表中一個字段id,一個字段fid(父id)。這樣可以根據WHERE id = fid來判斷上一級內容,運用遞歸至最頂層。
分析:通過這種數據庫設計出的無限級,可以說讀取的時候相當費勁,所以大部分的程序最多3-4級分類,這就足以滿足需求,從而一次性讀出所有的數據,再對得到數組或者對象進行遞歸。本身負荷還是沒太大問題。但是如果分類到更多級,那是不可取的辦法。
這樣看來這種分類有個好處,就是增刪改的時候輕鬆了…然而就二級分類而言,採用這種算法就應該算最優先了。

第二種方案:
設置fid字段類型為varchar,將父類id都集中在這個字段里,用符號隔開,比如:1,3,6
這樣可以比較容易得到各上級分類的ID,而且在查詢分類下的信息的時候,
可以使用:SELECT * FROM category WHERE pid LIKE “1,3%”。

分 析:相比於遞歸算法,在讀取數據方面優勢非常大,但是若查找該分類的所有 父分類 或者 子分類 查詢的效率也不是很高,至少也要二次query,從某種意義看上,個人覺得不太符合數據庫範式的設計。倘若遞增到無限級,還需考慮字段是否達到要求,而且 在修改分類和轉移分類的時候操作將非常麻煩。
暫時,在自己項目中用的就是類似第二種方案的解決辦法。就該方案在我的項目中存在這樣的問題, 如果當所有數據記錄達到上萬甚至10W以上后,一次性將所以分類,有序分級的現實出來,效率很低。極有可能是項目處理數據代碼效率低帶來的。現在正在改良。

第三種方案:
  無限級分類—-改進前序遍歷樹
那 么理想中的樹型結構應具備哪些特點呢?數據存儲冗餘小、直觀性強;方便返回整個樹型結構數據;可以很輕鬆的返回某一子樹(方便分層加載);快整獲以某節點 的祖譜路徑;插入、刪除、移動節點效率高等等。帶着這些需求我查找了很多資料,發現了一種理想的樹型結構數據存儲及操作算法,改進的前序遍歷樹模型 (The Nested Set Model)。
原理:
我們先把樹按照水平方式擺開。從根節點開始(“Food”),然後他的左邊寫 上1。然後按照樹的順序(從上到下)給“Fruit”的左邊寫上2。這樣,你沿着樹的邊界走啊走(這就是“遍歷”),然後同時在每個節點的左邊和右邊寫上 数字。最後,我們回到了根節點“Food”在右邊寫上18。下面是標上了数字的樹,同時把遍歷的順序用箭頭標出來了。

我 們稱這些数字為左值和右值(如,“Food”的左值是1,右值是18)。正如你所見,這些数字按時了每個節點之間的關係。因為“Red”有3和6兩個值, 所以,它是有擁有1-18值的“Food”節點的後續。同樣的,我們可以推斷所有左值大於2並且右值小於11的節點,都是有2-11的“Fruit” 節點的後續。這樣,樹的結構就通過左值和右值儲存下來了。這種數遍整棵樹算節點的方法叫做“改進前序遍歷樹”算法。

表結構設計:

那 么我們怎樣才能通過一個SQL語句把所有的分類都查詢出來呢,而且要求如果是子類的話前面要打幾個空格以表現是子分類。要想查詢出所有分類很好 辦:SELECT * FROM category WHERE lft>1 AND lft<18 ORDER BY lft這樣的話所有的分類都出來了,但是誰是誰的子類卻分不清,那麼怎麼辦呢?我們仔細看圖不難發現如果相鄰的兩條記錄的右值第一條的右值比第二條的大那 么就是他的父類,比如food的右值是18而fruit的右值是11 那麼food是fruit的父類,但是又要考慮到多級目錄。於是有了這樣的設計,我們用一個數組來存儲上一條記錄的右值,再把它和本條記錄的右值比較,如 果前者比後者小,說明不是父子關係,就用array_pop彈出數組,否則就保留,之後根據數組的大小來打印空格。

以上內容引用出處:https://www.cnblogs.com/badboys/p/9945296.html

關於第三種設計的更多資料請點擊查看原文,因為過於複雜(過重)被使用的頻率不高。

引出痛點

無限級分類(父子)是一種比較常用的表設計,每種設計方式突出優勢的同時也帶來缺陷,如:

  • 第一種方案:表設計中只有 parent_id 字段,寫入數據方便,困擾:查詢麻煩,許多使用了 ORM 的項目被迫使用 SQL 解決該場景;
  • 第二種方案:表設計中冗餘子級id便於查詢,困擾:添加/更新/刪除的時候需要重新計算;
  • 第三種方案:表設計中存儲左右值編碼,困擾:同上;

第一種方案的設計最簡單,本文後面的內容是在該基礎上,使用 FreeSql 實現 ToTreeList(內存加工樹型)、AsTreeCte(實現遞歸向下/向上查詢),滿足大眾日常使用。

關於 FreeSql

FreeSql 是功能強大的對象關係映射技術(O/RM),支持 .NETCore 2.1+ 或 .NETFramework 4.0+ 或 Xamarin,以 MIT 開源協議託管於 github,單元測試數量 4528個,nuget 下載量 151K,支持 MySql/SqlServer/PostgreSQL/Oracle/Sqlite/達夢/人大金倉/神州通用/Access;

源碼地址:https://github.com/dotnetcore/FreeSql

作者說過:每一個功能代表他的一撮頭髮!

第一步:定義導航屬性

FreeSql 導航屬性之中,有針對父子關係的設置方式,ToTreeList/AsTreeCte 依賴該設置,如下:

public class Area
{
  [Column(IsPrimary = true)]
  public string Code { get; set; }

  public string Name { get; set; }
  public string ParentCode { get; set; }

  [Navigate(nameof(ParentCode)), JsonIgnore] //JsonIgnore 是 json.net 的特性
  public Area Parent { get; set; }
  [Navigate(nameof(ParentCode))]
  public List<Area> Childs { get; set; }
}

關於導航屬性

定義 Parent 屬性,在表達式中可以這樣:

fsql.Select<Area>()
  .Where(a => a.Parent.Parent.Parent.Name == "中國")
  .First();

定義 Childs 屬性,在表達式中可以這樣(子查詢):

fsql.Select<Area>()
  .Where(a => a.Childs.AsSelect().Any(c => c.Name == "北京"))
  .First();

定義 Childs 屬性,還可以使用【級聯保存】、【貪婪加載】 等等操作。

添加測試數據

fsql.Delete<Area>().Where("1=1").ExecuteAffrows();
var repo = fsql.GetRepository<Area>();
repo.DbContextOptions.EnableAddOrUpdateNavigateList = true;
repo.DbContextOptions.NoneParameter = true;
repo.Insert(new Area
{
  Code = "100000",
  Name = "中國",
  Childs = new List<Area>(new[] {
    new Area
    {
      Code = "110000",
      Name = "北京",
      Childs = new List<Area>(new[] {
        new Area{ Code="110100", Name = "北京市" },
        new Area{ Code="110101", Name = "東城區" },
      })
    }
  })
});

第二步:使用 ToTreeList 返回樹型數據

配置好父子屬性之後,就可以這樣用了:

var t1 = fsql.Select<Area>().ToTreeList();
Assert.Single(t1);
Assert.Equal("100000", t1[0].Code);
Assert.Single(t1[0].Childs);
Assert.Equal("110000", t1[0].Childs[0].Code);
Assert.Equal(2, t1[0].Childs[0].Childs.Count);
Assert.Equal("110100", t1[0].Childs[0].Childs[0].Code);
Assert.Equal("110101", t1[0].Childs[0].Childs[1].Code);

查詢數據本來是平面的,ToTreeList 方法將返回的平面數據在內存中加工為樹型 List 返回。

[
  {
    "ParentCode": null,
    "Childs": [
      {
        "ParentCode": "100000",
        "Childs": [
          {
            "ParentCode": "110000",
            "Childs": [],
            "Code": "110100",
            "Name": "北京市"
          },
          {
            "ParentCode": "110000",
            "Childs": [],
            "Code": "110101",
            "Name": "東城區"
          }
        ],
        "Code": "110000",
        "Name": "北京"
      }
    ],
    "Code": "100000",
    "Name": "中國"
  }
]

第三步:使用 AsTreeCte 遞歸查詢

若不做數據冗餘的無限級分類表設計,遞歸查詢少不了,AsTreeCte 正是解決遞歸查詢的封裝,方法參數說明:

參數 描述
(可選) pathSelector 路徑內容選擇,可以設置查詢返回:中國 -> 北京 -> 東城區
(可選) up false(默認):由父級向子級的遞歸查詢,true:由子級向父級的遞歸查詢
(可選) pathSeparator 設置 pathSelector 的連接符,默認:->
(可選) level 設置遞歸層級

通過測試的數據庫:MySql8.0、SqlServer、PostgreSQL、Oracle、Sqlite、達夢、人大金倉

姿勢一:AsTreeCte() + ToTreeList

var t2 = fsql.Select<Area>()
  .Where(a => a.Name == "中國")
  .AsTreeCte() //查詢 中國 下的所有記錄
  .OrderBy(a => a.Code)
  .ToTreeList(); //非必須,也可以使用 ToList(見姿勢二)
Assert.Single(t2);
Assert.Equal("100000", t2[0].Code);
Assert.Single(t2[0].Childs);
Assert.Equal("110000", t2[0].Childs[0].Code);
Assert.Equal(2, t2[0].Childs[0].Childs.Count);
Assert.Equal("110100", t2[0].Childs[0].Childs[0].Code);
Assert.Equal("110101", t2[0].Childs[0].Childs[1].Code);
// WITH "as_tree_cte"
// as
// (
// SELECT 0 as cte_level, a."Code", a."Name", a."ParentCode" 
// FROM "Area" a 
// WHERE (a."Name" = '中國')

// union all

// SELECT wct1.cte_level + 1 as cte_level, wct2."Code", wct2."Name", wct2."ParentCode" 
// FROM "as_tree_cte" wct1 
// INNER JOIN "Area" wct2 ON wct2."ParentCode" = wct1."Code"
// )
// SELECT a."Code", a."Name", a."ParentCode" 
// FROM "as_tree_cte" a 
// ORDER BY a."Code"

姿勢二:AsTreeCte() + ToList

var t3 = fsql.Select<Area>()
  .Where(a => a.Name == "中國")
  .AsTreeCte()
  .OrderBy(a => a.Code)
  .ToList();
Assert.Equal(4, t3.Count);
Assert.Equal("100000", t3[0].Code);
Assert.Equal("110000", t3[1].Code);
Assert.Equal("110100", t3[2].Code);
Assert.Equal("110101", t3[3].Code);
//執行的 SQL 與姿勢一相同

姿勢三:AsTreeCte(pathSelector) + ToList

設置 pathSelector 參數后,如何返回隱藏字段?

var t4 = fsql.Select<Area>()
  .Where(a => a.Name == "中國")
  .AsTreeCte(a => a.Name + "[" + a.Code + "]")
  .OrderBy(a => a.Code)
  .ToList(a => new { 
    item = a, 
    level = Convert.ToInt32("a.cte_level"), 
    path = "a.cte_path" 
  });
Assert.Equal(4, t4.Count);
Assert.Equal("100000", t4[0].item.Code);
Assert.Equal("110000", t4[1].item.Code);
Assert.Equal("110100", t4[2].item.Code);
Assert.Equal("110101", t4[3].item.Code);
Assert.Equal("中國[100000]", t4[0].path);
Assert.Equal("中國[100000] -> 北京[110000]", t4[1].path);
Assert.Equal("中國[100000] -> 北京[110000] -> 北京市[110100]", t4[2].path);
Assert.Equal("中國[100000] -> 北京[110000] -> 東城區[110101]", t4[3].path);
// WITH "as_tree_cte"
// as
// (
// SELECT 0 as cte_level, a."Name" || '[' || a."Code" || ']' as cte_path, a."Code", a."Name", a."ParentCode" 
// FROM "Area" a 
// WHERE (a."Name" = '中國')

// union all

// SELECT wct1.cte_level + 1 as cte_level, wct1.cte_path || ' -> ' || wct2."Name" || '[' || wct2."Code" || ']' as cte_path, wct2."Code", wct2."Name", wct2."ParentCode" 
// FROM "as_tree_cte" wct1 
// INNER JOIN "Area" wct2 ON wct2."ParentCode" = wct1."Code"
// )
// SELECT a."Code" as1, a."Name" as2, a."ParentCode" as5, a.cte_level as6, a.cte_path as7 
// FROM "as_tree_cte" a 
// ORDER BY a."Code"

更多姿勢…請根據代碼註釋進行嘗試

源碼地址:https://github.com/dotnetcore/FreeSql

本站聲明:網站內容來源於博客園,如有侵權,請聯繫我們,我們將及時處理

【其他文章推薦】

※為什麼 USB CONNECTOR 是電子產業重要的元件?

網頁設計一頭霧水該從何著手呢? 台北網頁設計公司幫您輕鬆架站!

※台北網頁設計公司全省服務真心推薦

※想知道最厲害的網頁設計公司"嚨底家"!

新北清潔公司,居家、辦公、裝潢細清專業服務

※推薦評價好的iphone維修中心

前端開發神器Charles從入門到卸載

前言

本文將帶大家學習使用前端開發神器-charles,從基本的下載安裝到常見配置使用,為大家一一講解。

一、花式誇獎Charles

  • 截取 Http 和 Https 網絡封包。
  • 支持重髮網絡請求,方便後端調試。
  • 支持修改網絡請求參數。
  • 支持網絡請求的截獲並動態修改。
  • 支持模擬慢速網絡。

好,騎上我心愛的小摩托,準備上路…

二、下載與安裝

官網下載傳送門

本文所使用的的版本為 mac V4.5.6版本,不同版本間的具體化差異,大家可留言交流。

Charles破解工具可通過關注公眾號「胡哥有話說」,回復關鍵字charles獲得。

三、簡單入門-抓包所有請求

  1. 打開Charles,勾選Proxy下的macOS Proxy(如果是windows,此處為Windows Proxy)
  2. 點擊Proxy->Start Recording,打開瀏覽器訪問任意頁面,可以在Charles中看到請求了。

很好,現在已經上路了,學習的路上永不堵車…

四、設置過濾請求

通過上面的操作,我們已經抓包了所有的請求,實際開發中可能是專門針對某些接口(如百度域名下的接口),我們可以專門配置過濾接口。

  1. 臨時性過濾配置

    在展示界面的Filter中可進行條件過濾

    同時可在右側的settings中配置使用正則來進行過濾

  2. 永久性過濾配置

    通過Proxy->Recording Settings->include中配置過濾條件

Ok,我們又前進了一大步

五、代理轉發請求

通過CharlesMap RemoteMap Local我們也可以配置代理轉發請求。

Map Remote

Map Remote 遠程映射,是將指定的網絡請求重定向到另一個網址

業務場景:
某些服務端的文件請求時限制某些特定域名(*.baidu.com),我們使用localhost啟動項目時,會導致沒有權限訪問。通過配置Map Remote遠程映射解決問題。

配置路徑:
設置Tools->Map Remote

如圖上的配置,本地啟動的項目地址為:http://localhost:8080(或 http://127.0.0.1:8080),現在再訪問,可以使用路徑 http://test.baidu.com訪問即可。

注意Enable Map Remote一定要勾選,以及相應規則也要勾選,否則不會生效

Map Local

Map Local 本地映射,是指將指定的網絡請求重定向到本地的文件

業務場景:
在本地化的開發中,接口數據Mock;或者是線上環境問題排查時,將請求重定向到本地文件以方便排查。

配置路徑:
設置Tools->Map Local

通過如上圖的配置,請求 aa.baidu.com:443/index時,會被映射到本地 /xx/index.json

注意Enable Map Local一定要勾選,以及相關規則也要勾選,否則不會生效。

六、手機抓包

手機抓包請求也是我們日常開發中需要用到的,那如何利用Charles抓包手機請求呢。

  1. 設置Charles的代理端口號
    通過設置Proxy->Proxy Settings->Proxies->HTTP Proxy下的Port端口號

  2. 查看本地IP地址
    通過CharlesHelp->Local IP Address查看,本機IP為xx.xx.xx.xx

  3. 手機和電腦需要處於同於wifi網絡內

  4. 手機wifi網絡配置

    以華為mate 30為例,選擇對應的wifi,選擇显示高級選項,設置代理為手動
    設置服務器主機名為:xx.xx.xx.xx(剛才查看的電腦IP)
    設置服務器端口為:8888(剛才設置的port)
    點擊保存后,手機的請求就可以在Charles中查看啦…

    注意鏈接時,Charles會彈出授權窗口,要選擇Allow

七、限速設置

通過設置Proxy->Throttle Settings來進行速度限制

注意:一定要勾選 Enable Throttling選項

小結

以上是給大家分享的Charles的常見使用配置,如有相關問題可留言交流。

後記

以上就是胡哥今天給大家分享的內容,喜歡的小夥伴記得點贊收藏呦,關注胡哥有話說,學習前端不迷路,歡迎多多留言交流…

胡哥有話說,專註於大前端技術領域,分享前端系統架構,框架實現原理,最新最高效的技術實踐!

本站聲明:網站內容來源於博客園,如有侵權,請聯繫我們,我們將及時處理
【其他文章推薦】

USB CONNECTOR掌控什麼技術要點? 帶您認識其相關發展及效能

台北網頁設計公司這麼多該如何選擇?

※智慧手機時代的來臨,RWD網頁設計為架站首選

※評比南投搬家公司費用收費行情懶人包大公開

※幫你省時又省力,新北清潔一流服務好口碑

※回頭車貨運收費標準