Please support this Forum and Neven's Blog

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - seaicesailor

Pages: [1]
1
Developers Corner / Matlab code to plot IMB Buoy profiles
« on: August 01, 2016, 07:31:17 PM »
Here is the Matlab code I used to create the gif of IMB Buoy profiles
  • First copy the code below and put it into a text file called plotBuoyTemperatureProfile.m in whatever folder
  • Download the csv file that is provided in the IMB buoy page and put it in the same folder:
    http://imb.erdc.dren.mil/irid_data/2015F_clean.csv
  • Open Matlab, go to the folder, and write:
    [ data, filteredData ] =  plotBuoyTemperatureProfile( '2015F_clean.csv', '07-15-2016', '08-01-2016', 1 );
    Arguments are: csv file name, initial date, final date, and profile step. If profile step = 1, it will plot all profiles within the dates (six per day) which is very slow (see example attached). Profile step = 6 will plot one profile per day.
The outputs are the data and the filtered data array of the thermistor temperatures.
The function will automatically create a folder called "figs" and will save all the individual png of each plotted profile, as well as the gif. I set the frame delay at 0.3 seconds but it can be changed at line 83

Without Matlab, it may work with Octave but probably will need some modifications.

:
% -------------------------------------------------------------------------
% [ data, filteredData ] = plotBuoyTemperatureProfile(
%             filename, initialDate, finalDate, profileStep )
% -------------------------------------------------------------------------
% s.i.s. July 2016
% - filename: mass balance buoy csv filename such as '2015F_clean.csv'
% - initialDate: date in string 'mm-dd-yy' format
% - finalDate: date in string 'mm-dd-yy' format
% - profileStep: plot only one per profileStep profiles
%       For Buoy 2015F, there are six profiles per day.
% -------------------------------------------------------------------------
% The function generates one png plot per profile, also outputs original
% and filtered arrays of thermistors temperatures
% GPS, air temp, thickness, header, rows with no thermistor temperature
% data... not used
% -------------------------------------------------------------------------

function [ data, filteredData ] = ...
    plotBuoyTemperatureProfile( filename, initialDate, finalDate, profileStep )

    fid = fopen(filename, 'r');
    dataRaw = textscan(fid,'%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s','Delimiter', ',' , 'Headerlines', 1);
    fclose(fid);

    % Parse data, remove rows with blank temperature profiles
    j = 0;
    for idx = 1 : numel(dataRaw{1})
        if ~isempty(dataRaw{11}{idx}(2:end-1))
            j = j + 1;   
            dateStr{j} =  datestr(dataRaw{1}{idx}(2:end-1),'mm-dd-yy');
            dateNum(j) =  datenum(dataRaw{1}{idx}(2:end-1));
           
            % data array with thermistor profiles
            for k = 1:31
               data ( j, k ) =  str2double(dataRaw{k+10}{idx}(2:end-1));
            end
           
        end
       
    end
   
   sizeArray = size(data);
   
   % Filter in the time direction: a parabolic window filter with size 12
   % elements (two days) to remove fluctuations below the 1-day scale
   aux = data;
   for n = 1: sizeArray(2)
     aux(:,n) = filterParabolicWindow(data(:,n), 18);
   end

   % Filter in the direction of the thermistors: a parabolic window filter
   % with 4 elements (40 centimeters) to remove fluctuations below the 20
   % centimeter scale.
   filteredData = aux;
   for n = 1: sizeArray(1);
     filteredData(n,:) = filterParabolicWindow(aux(n,:), 4);
   end
   
   % Find the initial and final profiles depending on the input dates
   initialProfile = find(dateNum >= datenum(initialDate,'mm-dd-yy'),1,'first');
   finalProfile = find(dateNum >= datenum(finalDate,'mm-dd-yy'),1,'first');
   
   % Check correct limits
   if isempty(initialProfile), initialProfile = 1; end
   if isempty(finalProfile), finalProfile = sizeArray(1); end
   finalProfile=max(finalProfile, initialProfile);

   % Finally plot the selected profiles within the dates provided
   figFolder = 'figs';
   mkdir(figFolder);
   
   gifName = fullfile( figFolder, [ filename '_' initialDate '_' finalDate '.gif'] );
   for iG = initialProfile:profileStep:finalProfile
       
      pFig = plotBuoyprofile(1:sizeArray(2), filteredData(iG,1:sizeArray(2)), dateStr{iG}, iG, figFolder);
      drawnow
      frame = getframe(1);
      im = frame2im(frame);
      [imind,cm] = rgb2ind(im,256);
      if iG == initialProfile;
          imwrite(imind,cm,gifName,'gif', 'Loopcount',inf);
      else
          imwrite(imind,cm,gifName,'gif','WriteMode','append','DelayTime',0.3);
      end
      close(pFig);
   end
end


function pfig = plotBuoyprofile(thermistorNumberArray, temperatureArray, dateStr, idx, figFolder)

   % Create figure 
   pfig = figure('PaperSize',[20.98404194812 29.67743169791],...
       'InvertHardcopy','off',...
       'Color',[1 1 1]);
   
   % Create axes
   axes1 = axes('Parent',pfig,'YGrid','on','XGrid','on','FontSize',14);
   xlim(axes1,[0 250]);
   ylim(axes1,[-3 2]);
   box(axes1,'on');
   hold(axes1,'all');
   
   % Create plot
   plot(thermistorNumberArray*10, temperatureArray,'MarkerSize',4,'Marker','o','LineWidth',3,'Color',[0 0 1]);
   
   % Create xlabel
   xlabel('Depth(cm)','FontSize',14);
   
   % Create ylabel
   ylabel('Temperature (^oC)','FontSize',14);
   
   % Create title
   title([ 'Buoy 2015F profile - ' dateStr],'FontSize',14);
   
   % Create multiple lines using matrix input to plot
   plot1 = plot(thermistorNumberArray*10,thermistorNumberArray*0,'LineStyle','--');
   plot2 = plot(thermistorNumberArray*10,-1.8*thermistorNumberArray./thermistorNumberArray,'LineStyle','--');
   set(plot1(1),'LineWidth',3,'Color',[0 0 0]);
   set(plot2(1),'LineWidth',2,'Color',[0.847058832645416 0.160784319043159 0]);
   
   saveas(pfig, fullfile(figFolder, ['date_' dateStr '_' num2str(idx)]), 'png');
   
end

% -------------------------------------------------------------------------
% Classic window filter with parabolic weighting
% -------------------------------------------------------------------------
function filteredVariable = filterParabolicWindow( inputVariable, windowSize )

   sizeInputVariable = size(inputVariable);
   numberOfElements = numel(inputVariable);
   inputVariable = reshape(inputVariable, 1, numberOfElements);
   
     
   % Symmetric parabola equal to zero at borders
   rangeWindow = 1:2*windowSize+1;
   parabolicWindow = (rangeWindow-1).*(2*windowSize+1- rangeWindow);
     
   filteredVariable = inputVariable;
   for ifilter = 1:numberOfElements
       
       % Window shrunk at sides of domain
       indexVar = max(1,ifilter - windowSize):min(ifilter + windowSize, numberOfElements);
       indexHat = indexVar - ifilter + windowSize + 1;
       
       % Apply filtering over the window range
       filteredVariable(ifilter) = sum(parabolicWindow(indexHat).*filteredVariable(indexVar) )/...
           sum(parabolicWindow(indexHat));
   end
   
   filteredVariable = reshape(filteredVariable, sizeInputVariable);

end

2
The idea I had of this thread (if possible) is that, rather than discussing, we collected material on Arctic ice divergence and compaction under low/high pressure systems, and associated Ekman upwelling/downwelling.
Please feel encouraged to add your input/link/reference. If possible, but not necessarily, accessible to a wide audience, written in layman terms. If we use this thread as a reference, we can stop recurrent discussions on this matter that are off-topic in other threads.

I will be collecting suggested links or references below.

- Check out the videos related to Ekman layer from A. Muncheow webpage:
http://muenchow.cms.udel.edu/html/classes/gfd/notes.html
------

- Video: Watch a 5-min. explanation of Ekman Spiral starting at 3:00-ish
https://www.youtube.com/watch?v=InX6gw5yJc8
------

- Chapter on the Ekman layer from a Geophysical Fluid Dynamics textbook (from the web of Andreas Muenchow department, U. Delaware):
http://muenchow.cms.udel.edu/html/classes/gfd/book/IntroGFDChapt5.pdf
It deals with both the bottom atmospheric layer, the top ocean layer, and the problem of both combined. Requires medium/advanced knowledge on Fluid Mechanics. The whole book on GFD is available from that web.
------

- This interesting (but advanced) grad course text deals with the coupling of atmospheric and ocean Ekman layers from page 26 thereon:
http://www.rsmas.miami.edu/users/isavelyev/GFD-2/Ekman
------

- Abstract on Ekman transport and Upwelling in the Arctic Ocean
http://www.whoi.edu/fileserver.do?id=92424&pt=2&p=44107
------

- Wikipedia entries
https://en.wikipedia.org/wiki/Ekman_layer
https://en.wikipedia.org/wiki/Ekman_spiral
https://en.wikipedia.org/wiki/Ekman_transport

----------------------------

- Paper: On the Link Between Arctic Sea Ice Decline and the Freshwater Content of the Beaufort Gyre: Insights From a Simple Process Model
http://goo.gl/IMgwBM

This paper deals with the dynamics of the Beaufort Gyre and associated downwelling and eddy (turbulent?) stresses; the authors develop a simple model to understand how its strength has been changing over the recent years and seasonally, caused by ice loss; reciprocally, how this change affects the ice.

A-Team has made a great summary of the paper for all of us (thank you!):

Here is the first round of notes I took on this first not-great but recent paper, just cutting out redundant verbiage and too technical parts. Then I highlighted a few core concepts that will most likely be in all Ekman pumping Arctic papers and looked for web site data displays.

Note first that no one is talking about Ekman pumping except in the Beauford Gyre. Second, this is about large scale wind patterns and seasonal drag on water and ice. Ekman pumping is balanced by something called eddy diffusion. Ekman pumping here has nothing to do with warming lower waters melting more ice but rather potentially affects North Atlantic processes.

So far, there are just a handful of ideas. With 3-4 more papers, we would have these better explained and possibly a few more additional concepts. So it is not a mammoth project but a few hours of work from where we are now.

On the link between Arctic sea ice decline and the freshwater content of the Beaufort Gyre
PED Davis, C Lique, HL Johnson - Journal of Climate, 2014
http://journals.ametsoc.org/doi/abs/10.1175/JCLI-D-14-00090.1

The rate of freshwater accumulation in the Beaufort Gyre of the Arctic Ocean has accelerated over the past decade (coinciding with the dramatic decline observed in Arctic sea ice cover) which will modify momentum transfer into the upper ocean. We find a linear relationship between the annual mean momentum flux and the amount of freshwater accumulated in the Beaufort Gyre.

A balance between Ekman pumping and eddy-induced volume flux determine the response time scale and total quantity of freshwater accumulated. Eddies are an important adjustment of the Arctic Ocean to a change in forcing. The decline in Arctic sea ice cover impacts the magnitude and seasonality of the freshwater export into North Atlantic Deep Water -- that's the potential significance.

The Arctic Ocean receives inputs of freshwater from Eurasian and North American river runoff, net precipitation over evaporation (positive P2E), and sea ice melt. The Atlantic contributes relatively salty water via Fram Strait and the Barents Sea, and the Pacific contributes relatively freshwater via the Bering Strait.

Freshwater is exported both as liquid and ice into the Nordic and Labrador Seas through Fram Strait and CAA. A moderate freshening of the surface waters in these exit regions may impact the formation of North Atlantic Deep Water and thus affect both the global thermohaline circulation and the global climate.

Within the Arctic Ocean itself, more than 70 000 km^3 of freshwater is stored within a very fresh surface layer separated by a strong halocline from relatively warm and saline Atlantic-derived layer beneath. The largest freshening occurs in the Beaufort Gyre, a permanent anticyclonic circulation driven by the winds associated with the Beaufort high. These winds cause water to converge in the center of the gyre, and the resulting downwelling (Ekman pumping) leads to an accumulation of freshwater through the mechanical deformation of the salinity field.

During an anticyclonic regime, freshwater is accumulated within the Beaufort Gyre over several years because of a strengthened atmospheric Beaufort high. In contrast, during the cyclonic regime the atmospheric Beaufort high weakens, and freshwater is released to the shelves where it may be exported into the North Atlantic. As a result, there is a strong linear relationship between the freshwater content of the Beaufort Gyre and the wind stress curl on interannual time scales.

Since 1997, the Arctic has been in the longest anticyclonic regime on record, leading to a large excess accumulation of freshwater within the Beaufort Gyre, some 8400 km^3 of freshwater between 1995 and 2012.

The positive trend in the sea surface height associated with the Beaufort Gyre and the negative trend in the curl of the wind field toward more anticyclonic have a clear spatial but not seasonal correlation, the correlation is less clear. Winds drive more effective freshwater accumulation via more efficient momentum transfer into the upper ocean.

Another theory proposes Eurasian river water have shifted their input pathways because of a positive phase of the Arctic Oscillation during 2005–08 with no role played by the Beaufort Gyre wind-driven circulation.

In a partly ice-covered Arctic, momentum transfer is determined by surface wind and icewater stress components, in proportion to sea ice concentration.

In the past, the thick and extensive Arctic sea ice cover reduced momentum transfer as large internal ice stresses reduced the ice-water stress component, shielding the ocean from direct wind forcing. However, as the sea ice cover has begun to break up and retreat farther and longer each year and the number of leads, melt ponds, and ice floe edges has increased, changing the shape of the ice pack.

A thinner and weaker sea ice cover is more easily forced by winds. The changing shape of the ice pack provides more near-vertical faces for the wind to push against. As a result, not only is the annual mean ocean surface stress increasing (net forcing), but its seasonality is also changing.

The form drag coefficient measures the efficiency of momentum transfer into the upper ocean; it exhibits a small positive trend over the Beaufort Gyre in summer between 1990 and 2012.
 
The dynamical response of the Beaufort Gyre to the thinning, weakening, and changing shape of the Arctic sea ice cover will depend upon exactly how much more stress is transferred from the surface of the ice pack to the ocean below and how the seasonal distribution changes. Processes such as stratification, atmospheric boundary layer stability, ocean circulation, and sea ice conditions also affect momentum transfer through sea ice.

The model is forced with an anticyclonic ocean surface stress centered over the domain. The magnitude of the curl of the stress field (which is proportional to the strength of the Ekman pumping) is at a maximum in the center of the domain, and is zero at the boundaries and in the outflow.

To balance the input of vorticity from the winds, the effect of eddies and diapycnal [perpendicular to isopycnal direction: surfaces of constant density not always horizontal because of wind] mixing have been incorporated.

Ekman transport driven by the anticyclonic ocean surface stress will cause water to accumulate in the center of the domain, steepening the pressure gradient and driving an anticyclonic geostrophic current. Baroclinic instability associated with this current will result in an eddy-induced bolus transport toward the boundary of the domain.

While eddies are the most important process responsible for balancing Ekman pumping , lateral friction against the Chukchi Cap [?] may play a role.

Away from the boundaries, however, Kelvin waves have little effect.

The efficiency of momentum transfer into the upper ocean is at an optimum when the sea ice concentration is approximately 80% (i.e., in fall and spring). Above this point, a thick and extensive sea ice cover damps the transfer of momentum due to the large internal ice stresses and shielding of the ocean from direct wind forcing. Below this point, the momentum transfer into the upper ocean decreases, as the drag associated with drifting sea ice is greater than that of open water.

At some point, the accelerated accumulation of freshwater in the Beaufort Gyre will stop and no longer be supported by Ekman pumping.

Fig. 8 shows the annual cycle in liquid freshwater content between both the isohaline from upward-looking sonar deployed as part of the Beaufort Gyre Exploration Project and the magnitude of the annual cycle in Ekman pumping from the ERA-Interim reanalysis.

Freshwater peaks in December–January due to stronger Ekman pumping during winter and is at a minimum during August–September due to weaker Ekman pumping and a relaxation of the salinity field.

Given the far-reaching consequences that changes in the export of freshwater to either side of Greenland may have on the circulation of the Atlantic Ocean, future studies should aim to quantify the contribution that the seasonal release of freshwater from the Beaufort Gyre has on the total freshwater export from the Arctic Ocean.

In Great Salinity Anomaly events the subpolar North Atlantic and Nordic seas underwent decadal periods freshening affecting formation of North Atlantic Deep Water. Consequently, the accelerated accumulation of freshwater in the Beaufort Gyre may exacerbate the effects of a switch to a cyclonic wind regime, by making the Arctic even more anomalously fresh beforehand, and thus increasing the quantity of freshwater that may be exported into the North Atlantic.

The total quantity of freshwater accumulated for a given change in ocean surface stress depends on the eddy diffusivity (i.e., on the length of time it takes for the eddy field to balance the change in Ekman pumping).

As Arctic sea ice is becoming weaker, thinner, and more broken up, the annually averaged momentum flux into the upper ocean is increasing for the same wind speed, resulting in an accelerated linear accumulation of freshwater through an enhanced mechanical deformation of the salinity field.

The upward-looking sonar data were collected and made available by the Beaufort Gyre Exploration Project based at the Woods Hole Oceano- graphic Institution http://www.whoi.edu/beaufortgyre

---------------------------------------------------------------------------------------------

The Seasonal Variability of the Arctic Ocean Ekman Transport and Its Role in the Mixed Layer Heat and Salt Fluxes
Jiayan Yang
http://journals.ametsoc.org/doi/full/10.1175/JCLI3892.1 free full





3
During April and May melt front advances through Bering, Okhotsk, Barentz, and so. The front as a whole is broken and limited in size.

It happens in June that ice along the shores of Beaufort, Chukchi, ESS , Laptev, and Kara ( the internal shores of the Arctic properly speaking) starts melting or compacting, and so opening new melt fronts.

If the opening happens in one or two weeks, suddenly a very long front from Beaufort to Kara is established that may support much faster melting during June, advancing thru the internal peripheral seas.

I think this is a good moment to share this idea since HYCOM shows for the coming week what seems big compaction caused by this anticyclone that is coming over Chukchi; a large melt front from Baeufort to Kara may be established.

I think this geographic effect might be a main contributor of the  acceleration of extent loss known as June cliff, although not the sole factor.

In May the front does not exist and in July it is well established (not fully otherwise there would be open route already); the area melting rate by an advancing "circular" arc of such dimensions can be very big even when the average front velocity is not so espectacular. My only supporting evidence.

Pages: [1]