Skip to content
Snippets Groups Projects
Commit 2123df7e authored by Lars Kaleschke's avatar Lars Kaleschke
Browse files

Instructions for download and extraction of data

parent eb3ea04c
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id:32432818 tags: %% Cell type:markdown id:32432818 tags:
   
# SMOS-derived Antarctic thin sea-ice thickness from 2010 to 2020: data description and validation in the Weddell Sea # SMOS-derived Antarctic thin sea-ice thickness from 2010 to 2020: data description and validation in the Weddell Sea
   
This is the main notebook that generates figures and statistics used in the ESSD paper with the same title. This is the main notebook that generates figures and statistics used in the ESSD paper with the same title.
   
   
## SMOS data ## SMOS data
   
Tian-Kunze, Xiangshan; Kaleschke, Lars (2021): SMOS-derived sea ice thickness in the Antarctic from 2010 to 2020. PANGAEA, https://doi.org/10.1594/PANGAEA.934732 Tian-Kunze, Xiangshan; Kaleschke, Lars (2021): SMOS-derived sea ice thickness in the Antarctic from 2010 to 2020. PANGAEA, https://doi.org/10.1594/PANGAEA.934732
   
   
As a first step the notebook entitled **SMOS sea ice thickness monthly mean and climatology** has to be used to generate monthly means and the climatology from the daily product. As a first step the notebook entitled **SMOS sea ice thickness monthly mean and climatology** has to be used to generate monthly means and the climatology from the daily product.
   
   
## Validation data ## Validation data
   
Three main datasets are used Three main datasets are used
   
* Helicopter-based EM Bird (HEM) data¶ * Helicopter-based EM Bird (HEM) data¶
* Surface and Under-Ice Trawl (SUIT) * Surface and Under-Ice Trawl (SUIT)
* Upward-Looking Sonars (ULS) * Upward-Looking Sonars (ULS)
   
The data sources are given below.
## Module versions
The code runs with the following versions:
python 3.9.9 h62f1059_0_cpython conda-forge
xarray 0.19.0 pyhd8ed1ab_0 conda-forge
matplotlib 3.4.2 py39hf3d152e_0 conda-forge
basemap 1.2.2 py39h2103e0b_3 conda-forge
pandas 1.3.1 py39hde0f152_0 conda-forge
pyproj 3.2.1 py39ha9a7ae0_2 conda-forge
%% Cell type:code id:718fd223 tags: %% Cell type:code id:718fd223 tags:
   
``` python ``` python
# Directory for daily product (data source) # Directory for daily product (data source)
smos_datadir ='/isibhv/projects/siral/product/smos/SMOS_v620_L3C_Sea_v3/south/' smos_datadir ='/isibhv/projects/siral/product/smos/SMOS_v620_L3C_Sea_v3/south/'
# Directory for program output # Directory for program output
smos_monthly ='repo_data/SMOS_monthly/' smos_monthly ='repo_data/SMOS_monthly/'
``` ```
   
%% Cell type:markdown id:7102d92a tags: %% Cell type:markdown id:7102d92a tags:
   
## Helicopter-based EM Bird (HEM) data ## Helicopter-based EM Bird (HEM) data
   
HEM data have been submitted to Pangaea but the reference is not yet available. Therefore, the HEM data are included in this repository. HEM data have been submitted to Pangaea but the reference is not yet available. Therefore, the HEM data are included in this repository.
   
%% Cell type:code id:5a5c52c4 tags: %% Cell type:code id:5a5c52c4 tags:
   
``` python ``` python
# This directory contains the HEM data, profiles and gridded. # This directory contains the HEM data, profiles and gridded.
grdvaldir='repo_data/HEM' grdvaldir='repo_data/HEM'
valdir='repo_data/HEM' valdir='repo_data/HEM'
#!ls $grdvaldir #!ls $grdvaldir
!ls $valdir !ls $valdir
``` ```
   
%% Output %% Output
   
Ant_HEM_2013-06-19_1343_sit.nc HEM_Ant29_20130619T134315_20130619T134258.nc Ant_HEM_2013-06-19_1343_sit.nc HEM_Ant29_20130619T134315_20130619T134258.nc
Ant_HEM_2013-06-20_1405_sit.nc HEM_Ant29_20130620T140530_20130620T132327.nc Ant_HEM_2013-06-20_1405_sit.nc HEM_Ant29_20130620T140530_20130620T132327.nc
Ant_HEM_2013-06-21_1145_sit.nc HEM_Ant29_20130621T114536_20130621T114519.nc Ant_HEM_2013-06-21_1145_sit.nc HEM_Ant29_20130621T114536_20130621T114519.nc
Ant_HEM_2013-07-07_1221_sit.nc HEM_Ant29_20130707T122107_20130707T122051.nc Ant_HEM_2013-07-07_1221_sit.nc HEM_Ant29_20130707T122107_20130707T122051.nc
   
%% Cell type:code id:c27b6af0 tags: %% Cell type:code id:c27b6af0 tags:
   
``` python ``` python
#!gzip repo_data/HEM/*.nc #!gzip repo_data/HEM/*.nc
!gunzip repo_data/HEM/*.gz !gunzip repo_data/HEM/*.gz
``` ```
   
%% Cell type:markdown id:50a679c0 tags: %% Cell type:markdown id:50a679c0 tags:
   
## SMOS grid definitions ## SMOS grid definitions
   
%% Cell type:code id:712e8b75 tags: %% Cell type:code id:712e8b75 tags:
   
``` python ``` python
%matplotlib notebook %matplotlib notebook
from pylab import * from pylab import *
from mpl_toolkits.basemap import Basemap from mpl_toolkits.basemap import Basemap
from matplotlib.colors import LinearSegmentedColormap,ListedColormap,Normalize from matplotlib.colors import LinearSegmentedColormap,ListedColormap,Normalize
import cmocean import cmocean
import pandas as pd import pandas as pd
import xarray as xr import xarray as xr
import glob import glob
import os.path import os.path
import pyproj import pyproj
   
pol=pyproj.Proj("+init=EPSG:3412") # NSIDC Polar Stereographic South pol=pyproj.Proj("+init=EPSG:3412") # NSIDC Polar Stereographic South
   
def mapxy(x,y): def mapxy(x,y):
lon,lat=pol(x*1000,y*1000, inverse=True) lon,lat=pol(x*1000,y*1000, inverse=True)
return lat,lon return lat,lon
   
def mapll(lat,lon): def mapll(lat,lon):
x,y=pol(lon,lat, inverse=False) x,y=pol(lon,lat, inverse=False)
return x,y return x,y
   
def def_grids(): def def_grids():
grids={} grids={}
grids.update({'Arc': [1,3750.0,5850.0,-3850.0,-5350.0]}) grids.update({'Arc': [1,3750.0,5850.0,-3850.0,-5350.0]})
grids.update({'Ant': [-1,3950.0,4350.0,-3950.0,-3950.0]}) grids.update({'Ant': [-1,3950.0,4350.0,-3950.0,-3950.0]})
return grids return grids
   
   
hemis='Ant' hemis='Ant'
grids=def_grids() grids=def_grids()
cs=12.5 cs=12.5
sgn,cds= grids[hemis][0],grids[hemis][1:5] sgn,cds= grids[hemis][0],grids[hemis][1:5]
X0,Y0,X2,Y2=cds[0],cds[1],cds[2],cds[3] X0,Y0,X2,Y2=cds[0],cds[1],cds[2],cds[3]
x0,y0,x2,y2=cds[0],cds[1],cds[2],cds[3] x0,y0,x2,y2=cds[0],cds[1],cds[2],cds[3]
   
``` ```
   
%% Output %% Output
   
/isibhv/projects/SMOS_ESL/isibhv_miniconda3/envs/jupyterlab/lib/python3.9/site-packages/pyproj/crs/crs.py:131: FutureWarning: '+init=<authority>:<code>' syntax is deprecated. '<authority>:<code>' is the preferred initialization method. When making the change, be mindful of axis order changes: https://pyproj4.github.io/pyproj/stable/gotchas.html#axis-order-changes-in-proj-6 /isibhv/projects/SMOS_ESL/isibhv_miniconda3/envs/jupyterlab/lib/python3.9/site-packages/pyproj/crs/crs.py:131: FutureWarning: '+init=<authority>:<code>' syntax is deprecated. '<authority>:<code>' is the preferred initialization method. When making the change, be mindful of axis order changes: https://pyproj4.github.io/pyproj/stable/gotchas.html#axis-order-changes-in-proj-6
in_crs_string = _prepare_from_proj_string(in_crs_string) in_crs_string = _prepare_from_proj_string(in_crs_string)
   
%% Cell type:markdown id:3f57b058 tags: %% Cell type:markdown id:3f57b058 tags:
   
### SMOS climatological monthly mean and interannual standard deviation ### SMOS climatological monthly mean and interannual standard deviation
   
%% Cell type:code id:acca6c4f tags: %% Cell type:code id:acca6c4f tags:
   
``` python ``` python
smos_months=['04','05','06','07','08','09','10'] smos_months=['04','05','06','07','08','09','10']
sy,sx=(664, 632) sy,sx=(664, 632)
SIT=zeros((sy,sx,7)) SIT=zeros((sy,sx,7))
   
fdir='/isibhv/projects/siral/product/smos/SMOS_v620_L3C_Sea_v3/south/monthly/' fdir='/isibhv/projects/siral/product/smos/SMOS_v620_L3C_Sea_v3/south/monthly/'
#fdir='/isibhv/projects/siral/product/smos/SMOS_v724_L3C_Sea_v3.3/south/monthly/' #fdir='/isibhv/projects/siral/product/smos/SMOS_v724_L3C_Sea_v3.3/south/monthly/'
   
for i,month in enumerate(smos_months): for i,month in enumerate(smos_months):
smos_fn=fdir+'climatology_SMOS_Icethickness_v3.2_south_'+month+'.nc' smos_fn=fdir+'climatology_SMOS_Icethickness_v3.2_south_'+month+'.nc'
#smos_fn=fdir+'monthly_SMOS_Icethickness_v3.2_south_2010'+month+'.nc' #smos_fn=fdir+'monthly_SMOS_Icethickness_v3.2_south_2010'+month+'.nc'
print(smos_fn) print(smos_fn)
sit=xr.open_dataarray(smos_fn) sit=xr.open_dataarray(smos_fn)
SIT[:,:,i]=sit SIT[:,:,i]=sit
SIT=ma.masked_invalid(SIT) SIT=ma.masked_invalid(SIT)
sitm=SIT.mean(axis=2) sitm=SIT.mean(axis=2)
   
# Interannual variability (std) # Interannual variability (std)
smos_months=['04','05','06','07','08','09','10'] smos_months=['04','05','06','07','08','09','10']
sy,sx=(664, 632) sy,sx=(664, 632)
SITs=zeros((sy,sx,7)) SITs=zeros((sy,sx,7))
   
fdir='/isibhv/projects/siral/product/smos/SMOS_v620_L3C_Sea_v3/south/monthly/' fdir='/isibhv/projects/siral/product/smos/SMOS_v620_L3C_Sea_v3/south/monthly/'
#fdir='/isibhv/projects/siral/product/smos/SMOS_v724_L3C_Sea_v3.3/south/monthly/' #fdir='/isibhv/projects/siral/product/smos/SMOS_v724_L3C_Sea_v3.3/south/monthly/'
   
for i,month in enumerate(smos_months): for i,month in enumerate(smos_months):
smos_fn=fdir+'climatology_SMOS_Icethickness_v3.2_south_'+month+'.nc' smos_fn=fdir+'climatology_SMOS_Icethickness_v3.2_south_'+month+'.nc'
#smos_fn=fdir+'monthly_SMOS_Icethickness_v3.2_south_2010'+month+'.nc' #smos_fn=fdir+'monthly_SMOS_Icethickness_v3.2_south_2010'+month+'.nc'
flistpat=fdir+'monthly_SMOS_Icethickness_v3.2_south_20??'+month+'.nc' flistpat=fdir+'monthly_SMOS_Icethickness_v3.2_south_20??'+month+'.nc'
flist=!ls $flistpat flist=!ls $flistpat
   
nry=len(flist) # number years nry=len(flist) # number years
SITsy=zeros((sy,sx,nry)) SITsy=zeros((sy,sx,nry))
for j,smos_fn in enumerate(flist): for j,smos_fn in enumerate(flist):
#print(j,smos_fn) #print(j,smos_fn)
sit=xr.open_dataarray(smos_fn) sit=xr.open_dataarray(smos_fn)
SITsy[:,:,j]=sit SITsy[:,:,j]=sit
SITsy=ma.masked_invalid(SITsy) SITsy=ma.masked_invalid(SITsy)
sits=SITsy.std(axis=2) sits=SITsy.std(axis=2)
SITs[:,:,i]=sits SITs[:,:,i]=sits
   
``` ```
   
%% Output %% Output
   
/isibhv/projects/siral/product/smos/SMOS_v620_L3C_Sea_v3/south/monthly/climatology_SMOS_Icethickness_v3.2_south_04.nc /isibhv/projects/siral/product/smos/SMOS_v620_L3C_Sea_v3/south/monthly/climatology_SMOS_Icethickness_v3.2_south_04.nc
/isibhv/projects/siral/product/smos/SMOS_v620_L3C_Sea_v3/south/monthly/climatology_SMOS_Icethickness_v3.2_south_05.nc /isibhv/projects/siral/product/smos/SMOS_v620_L3C_Sea_v3/south/monthly/climatology_SMOS_Icethickness_v3.2_south_05.nc
/isibhv/projects/siral/product/smos/SMOS_v620_L3C_Sea_v3/south/monthly/climatology_SMOS_Icethickness_v3.2_south_06.nc /isibhv/projects/siral/product/smos/SMOS_v620_L3C_Sea_v3/south/monthly/climatology_SMOS_Icethickness_v3.2_south_06.nc
/isibhv/projects/siral/product/smos/SMOS_v620_L3C_Sea_v3/south/monthly/climatology_SMOS_Icethickness_v3.2_south_07.nc /isibhv/projects/siral/product/smos/SMOS_v620_L3C_Sea_v3/south/monthly/climatology_SMOS_Icethickness_v3.2_south_07.nc
/isibhv/projects/siral/product/smos/SMOS_v620_L3C_Sea_v3/south/monthly/climatology_SMOS_Icethickness_v3.2_south_08.nc /isibhv/projects/siral/product/smos/SMOS_v620_L3C_Sea_v3/south/monthly/climatology_SMOS_Icethickness_v3.2_south_08.nc
/isibhv/projects/siral/product/smos/SMOS_v620_L3C_Sea_v3/south/monthly/climatology_SMOS_Icethickness_v3.2_south_09.nc /isibhv/projects/siral/product/smos/SMOS_v620_L3C_Sea_v3/south/monthly/climatology_SMOS_Icethickness_v3.2_south_09.nc
/isibhv/projects/siral/product/smos/SMOS_v620_L3C_Sea_v3/south/monthly/climatology_SMOS_Icethickness_v3.2_south_10.nc /isibhv/projects/siral/product/smos/SMOS_v620_L3C_Sea_v3/south/monthly/climatology_SMOS_Icethickness_v3.2_south_10.nc
   
%% Cell type:markdown id:37887b6b tags: %% Cell type:markdown id:37887b6b tags:
   
## ULS Data ## ULS Data
   
### References ### References
   
Behrendt, A., Dierking, W., Fahrbach, E., and Witte, H.: Sea ice draft in the Weddell Sea, measured by upward looking sonars, Earth Syst. Sci. Data, 5, 209–226, https://doi.org/10.5194/essd-5-209-2013, 2013. Behrendt, A., Dierking, W., Fahrbach, E., and Witte, H.: Sea ice draft in the Weddell Sea, measured by upward looking sonars, Earth Syst. Sci. Data, 5, 209–226, https://doi.org/10.5194/essd-5-209-2013, 2013.
   
Behrendt, A., W. Dierking, and H. Witte(2015), Thermodynamic sea ice growthin the central Weddell Sea, observed inupward-looking sonar data,J. Geophys.Res. Oceans,120, 2270–2286,doi:10.1002/2014JC010408 Behrendt, A., W. Dierking, and H. Witte (2015), Thermodynamic sea ice growth in the central Weddell Sea, observed in upward-looking sonar data, J. Geophys. Res. Oceans,120, 2270–2286,doi:10.1002/2014JC010408
   
The sea ice thickness in the Atlantic sector of the Southern Ocean, PhD thesis Axel Behrendt, 2013 The sea ice thickness in the Atlantic sector of the Southern Ocean, PhD thesis Axel Behrendt, 2013
http://wwwdb.dbod.de/login?url=https://d-nb.info/1072077566/34 http://wwwdb.dbod.de/login?url=https://d-nb.info/1072077566/34
   
Harms, S., Fahrbach, E., & Strass, V. H. (2001). Sea ice transports in the Weddell Sea. Journal of Geophysical Research: Oceans, 106(C5), 9057-9073. Harms, S., Fahrbach, E., & Strass, V. H. (2001). Sea ice transports in the Weddell Sea. Journal of Geophysical Research: Oceans, 106(C5), 9057-9073.
   
Behrendt, Axel; Dierking, Wolfgang; Fahrbach, Eberhard; Witte, Hannelore (2013): Sea ice draft measured by upward looking sonars in the Weddell Sea (Antarctica). PANGAEA, https://doi.org/10.1594/PANGAEA.785565, Supplement to: Behrendt, A et al. (2013): Sea ice draft in the Weddell Sea, measured by upward looking sonars. Earth System Science Data, 5(1), 209-226, https://doi.org/10.5194/essd-5-209-2013 Behrendt, Axel; Dierking, Wolfgang; Fahrbach, Eberhard; Witte, Hannelore (2013): Sea ice draft measured by upward looking sonars in the Weddell Sea (Antarctica). PANGAEA, https://doi.org/10.1594/PANGAEA.785565, Supplement to: Behrendt, A et al. (2013): Sea ice draft in the Weddell Sea, measured by upward looking sonars. Earth System Science Data, 5(1), 209-226, https://doi.org/10.5194/essd-5-209-2013
   
%% Cell type:code id:e6b5bd4c tags: %% Cell type:code id:e6b5bd4c tags:
   
``` python ``` python
# Download data from Pangaea https://doi.org/10.5194/essd-5-209-2013 # Download data from Pangaea https://doi.org/10.5194/essd-5-209-2013
# and store in the directory ULS_dir # and store in the directory ULS_dir.
# Download ZIP file containing all datasets as tab-delimited text # Download ZIP file containing all datasets as tab-delimited text
# unzip Behrendt_2013.zip
ULS_dir="repo_data/ULS_Ant_Behrendt_2013/" ULS_dir="repo_data/ULS_Ant_Behrendt_2013/"
!ls $ULS_dir !ls $ULS_dir
``` ```
   
%% Output %% Output
   
AWI206-4_sea-ice_draft.tab AWI229-6_sea-ice_draft.tab AWI206-4_sea-ice_draft.tab AWI229-6_sea-ice_draft.tab
AWI206-6_sea-ice_draft.tab AWI229-8_sea-ice_draft.tab AWI206-6_sea-ice_draft.tab AWI229-8_sea-ice_draft.tab
AWI207-2_sea-ice_draft.tab AWI230-2_sea-ice_draft.tab AWI207-2_sea-ice_draft.tab AWI230-2_sea-ice_draft.tab
AWI207-4_sea-ice_draft.tab AWI230-3_sea-ice_draft.tab AWI207-4_sea-ice_draft.tab AWI230-3_sea-ice_draft.tab
AWI207-6_sea-ice_draft.tab AWI231-1_sea-ice_draft.tab AWI207-6_sea-ice_draft.tab AWI231-1_sea-ice_draft.tab
AWI207-7_sea-ice_draft.tab AWI231-2_sea-ice_draft.tab AWI207-7_sea-ice_draft.tab AWI231-2_sea-ice_draft.tab
AWI208-3_sea-ice_draft.tab AWI231-3_sea-ice_draft.tab AWI208-3_sea-ice_draft.tab AWI231-3_sea-ice_draft.tab
AWI208-5_sea-ice_draft.tab AWI231-4_sea-ice_draft.tab AWI208-5_sea-ice_draft.tab AWI231-4_sea-ice_draft.tab
AWI209-3_sea-ice_draft.tab AWI231-6_sea-ice_draft.tab AWI209-3_sea-ice_draft.tab AWI231-6_sea-ice_draft.tab
AWI210-2_sea-ice_draft.tab AWI231-7_sea-ice_draft.tab AWI210-2_sea-ice_draft.tab AWI231-7_sea-ice_draft.tab
AWI212-2_sea-ice_draft.tab AWI232-1_sea-ice_draft.tab AWI212-2_sea-ice_draft.tab AWI232-1_sea-ice_draft.tab
AWI217_sea-ice_draft.tab AWI232-4_sea-ice_draft.tab AWI217_sea-ice_draft.tab AWI232-4_sea-ice_draft.tab
AWI227-3_sea-ice_draft.tab AWI232-5_sea-ice_draft.tab AWI227-3_sea-ice_draft.tab AWI232-5_sea-ice_draft.tab
AWI227-4_sea-ice_draft.tab AWI232-6_sea-ice_draft.tab AWI227-4_sea-ice_draft.tab AWI232-6_sea-ice_draft.tab
AWI227-6_sea-ice_draft.tab AWI232-8_sea-ice_draft.tab AWI227-6_sea-ice_draft.tab AWI232-8_sea-ice_draft.tab
AWI229-1_sea-ice_draft.tab AWI232-9_sea-ice_draft.tab AWI229-1_sea-ice_draft.tab AWI232-9_sea-ice_draft.tab
AWI229-2_sea-ice_draft.tab AWI233-2_sea-ice_draft.tab AWI229-2_sea-ice_draft.tab AWI233-2_sea-ice_draft.tab
AWI229-3_sea-ice_draft.tab AWI233-6_sea-ice_draft.tab AWI229-3_sea-ice_draft.tab AWI233-6_sea-ice_draft.tab
AWI229-4_sea-ice_draft.tab summary.txt AWI229-4_sea-ice_draft.tab summary.txt
AWI229-5_sea-ice_draft.tab AWI229-5_sea-ice_draft.tab
   
%% Cell type:markdown id:2a8102d4 tags: %% Cell type:markdown id:2a8102d4 tags:
   
### Functions to read in ULS data ### Functions to read in ULS data
   
%% Cell type:code id:9334555e tags: %% Cell type:code id:9334555e tags:
   
``` python ``` python
from pylab import * from pylab import *
import pandas as pd import pandas as pd
import xarray as xr import xarray as xr
import glob import glob
import os.path import os.path
   
def ts_fillnan(ts): def ts_fillnan(ts):
dr=pd.date_range(ts.index[0],ts.index[-1]) dr=pd.date_range(ts.index[0],ts.index[-1])
ind=pd.Series(data=ones(len(dr)),index=dr) ind=pd.Series(data=ones(len(dr)),index=dr)
ind[:]=nan ind[:]=nan
ind[ts.index]=ts[ts.index] ind[ts.index]=ts[ts.index]
return ind return ind
   
def headerlenght(fn): def headerlenght(fn):
fid=open(fn) fid=open(fn)
for l in range(40): for l in range(40):
line=fid.readline() line=fid.readline()
if "*/" in line: if "*/" in line:
return(l+1) return(l+1)
   
def latlon_fromheader(fn): def latlon_fromheader(fn):
fid=open(fn) fid=open(fn)
for l in range(40): for l in range(40):
line=fid.readline() line=fid.readline()
if "Coverage:" in line: if "Coverage:" in line:
lat,lon=line.replace('\n','').split('LATITUDE: ')[1].split('* LONGITUDE:') lat,lon=line.replace('\n','').split('LATITUDE: ')[1].split('* LONGITUDE:')
lat,lon=float(lat),float(lon) lat,lon=float(lat),float(lon)
return(lat,lon) return(lat,lon)
   
fl=!ls $ULS_dir/*.tab fl=!ls $ULS_dir/*.tab
   
L=[] L=[]
for fn in fl: for fn in fl:
awi_id=os.path.basename(fn)[0:6] awi_id=os.path.basename(fn)[0:6]
L.append(awi_id) L.append(awi_id)
   
awi_ids=unique(array(L)) awi_ids=unique(array(L))
print('Unique ULS data positions', awi_ids) print('Unique ULS data positions', awi_ids)
``` ```
   
%% Output %% Output
   
Unique ULS data positions ['AWI206' 'AWI207' 'AWI208' 'AWI209' 'AWI210' 'AWI212' 'AWI217' 'AWI227' Unique ULS data positions ['AWI206' 'AWI207' 'AWI208' 'AWI209' 'AWI210' 'AWI212' 'AWI217' 'AWI227'
'AWI229' 'AWI230' 'AWI231' 'AWI232' 'AWI233'] 'AWI229' 'AWI230' 'AWI231' 'AWI232' 'AWI233']
   
%% Cell type:markdown id:05037629 tags: %% Cell type:markdown id:05037629 tags:
   
### Read ULS data and calculate monthly means ### Read ULS data and calculate monthly means
   
%% Cell type:code id:58aef07b tags: %% Cell type:code id:58aef07b tags:
   
``` python ``` python
ULS_Dict_daily={} ULS_Dict_daily={}
ULS_Dict_monthly={} ULS_Dict_monthly={}
ULS_latlon={} ULS_latlon={}
   
for uls_id in awi_ids: for uls_id in awi_ids:
fl=glob.glob(ULS_dir+uls_id+'*.tab') fl=glob.glob(ULS_dir+uls_id+'*.tab')
fl.sort() fl.sort()
ULS_dict={} ULS_dict={}
for fn in fl: for fn in fl:
print(fn) print(fn)
ULS_name=os.path.basename(fn)[0:8] ULS_name=os.path.basename(fn)[0:8]
skiprows=headerlenght(fn) skiprows=headerlenght(fn)
ULS_latlon[ULS_name[0:6]]=latlon_fromheader(fn) ULS_latlon[ULS_name[0:6]]=latlon_fromheader(fn)
uls=pd.read_csv(fn,sep='\t',skiprows=skiprows) uls=pd.read_csv(fn,sep='\t',skiprows=skiprows)
#print(ULS_name,uls.keys()) #print(ULS_name,uls.keys())
for k in uls.keys(): for k in uls.keys():
if 'Draft' in k: if 'Draft' in k:
if 'model' in k: if 'model' in k:
draft_param=k draft_param=k
else: else:
if 'zero line' in k: if 'zero line' in k:
draft_param=k draft_param=k
print('--> Selected parameter:',draft_param) print('--> Selected parameter:',draft_param)
draft=array(uls[draft_param].values).astype(float) draft=array(uls[draft_param].values).astype(float)
index=pd.to_datetime(uls['Date/Time']) index=pd.to_datetime(uls['Date/Time'])
index.name='Date' index.name='Date'
ULS_dict[ULS_name]=pd.Series(data=draft,index=index) ULS_dict[ULS_name]=pd.Series(data=draft,index=index)
ULS_1d={} ULS_1d={}
for ULS_name in ULS_dict: for ULS_name in ULS_dict:
print('Calculating daily averages', ULS_name) print('Calculating daily averages', ULS_name)
ULS_1d[ULS_name]=ULS_dict[ULS_name].resample('1d').mean() ULS_1d[ULS_name]=ULS_dict[ULS_name].resample('1d').mean()
L=[] L=[]
for uls in ULS_1d: for uls in ULS_1d:
L.append(ULS_1d[uls]) L.append(ULS_1d[uls])
ts=pd.concat(L) ts=pd.concat(L)
ts1m=ts.resample('m').mean() ts1m=ts.resample('m').mean()
ULS_Dict_monthly[uls_id]=ts1m ULS_Dict_monthly[uls_id]=ts1m
print('Finished ',uls_id) print('Finished ',uls_id)
   
xa1=xr.Dataset(ULS_Dict_monthly)# Monthly mean xa1=xr.Dataset(ULS_Dict_monthly)# Monthly mean
``` ```
   
%% Output %% Output
   
repo_data/ULS_Ant_Behrendt_2013/AWI206-4_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI206-4_sea-ice_draft.tab
--> Selected parameter: Draft [m] (zero line correction, Calculated) --> Selected parameter: Draft [m] (zero line correction, Calculated)
repo_data/ULS_Ant_Behrendt_2013/AWI206-6_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI206-6_sea-ice_draft.tab
--> Selected parameter: Draft [m] (zero line correction, Calculated) --> Selected parameter: Draft [m] (zero line correction, Calculated)
Calculating daily averages AWI206-4 Calculating daily averages AWI206-4
Calculating daily averages AWI206-6 Calculating daily averages AWI206-6
Finished AWI206 Finished AWI206
repo_data/ULS_Ant_Behrendt_2013/AWI207-2_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI207-2_sea-ice_draft.tab
--> Selected parameter: Draft [m] (model correction, Calculated) --> Selected parameter: Draft [m] (model correction, Calculated)
repo_data/ULS_Ant_Behrendt_2013/AWI207-4_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI207-4_sea-ice_draft.tab
--> Selected parameter: Draft [m] (model correction, Calculated) --> Selected parameter: Draft [m] (model correction, Calculated)
repo_data/ULS_Ant_Behrendt_2013/AWI207-6_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI207-6_sea-ice_draft.tab
--> Selected parameter: Draft [m] (model correction, Calculated) --> Selected parameter: Draft [m] (model correction, Calculated)
repo_data/ULS_Ant_Behrendt_2013/AWI207-7_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI207-7_sea-ice_draft.tab
--> Selected parameter: Draft [m] (model correction, Calculated) --> Selected parameter: Draft [m] (model correction, Calculated)
Calculating daily averages AWI207-2 Calculating daily averages AWI207-2
Calculating daily averages AWI207-4 Calculating daily averages AWI207-4
Calculating daily averages AWI207-6 Calculating daily averages AWI207-6
Calculating daily averages AWI207-7 Calculating daily averages AWI207-7
Finished AWI207 Finished AWI207
repo_data/ULS_Ant_Behrendt_2013/AWI208-3_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI208-3_sea-ice_draft.tab
--> Selected parameter: Draft [m] (model correction, Calculated) --> Selected parameter: Draft [m] (model correction, Calculated)
repo_data/ULS_Ant_Behrendt_2013/AWI208-5_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI208-5_sea-ice_draft.tab
--> Selected parameter: Draft [m] (model correction, Calculated) --> Selected parameter: Draft [m] (model correction, Calculated)
Calculating daily averages AWI208-3 Calculating daily averages AWI208-3
Calculating daily averages AWI208-5 Calculating daily averages AWI208-5
Finished AWI208 Finished AWI208
repo_data/ULS_Ant_Behrendt_2013/AWI209-3_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI209-3_sea-ice_draft.tab
--> Selected parameter: Draft [m] (model correction, Calculated) --> Selected parameter: Draft [m] (model correction, Calculated)
Calculating daily averages AWI209-3 Calculating daily averages AWI209-3
Finished AWI209 Finished AWI209
repo_data/ULS_Ant_Behrendt_2013/AWI210-2_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI210-2_sea-ice_draft.tab
--> Selected parameter: Draft [m] (model correction, Calculated) --> Selected parameter: Draft [m] (model correction, Calculated)
Calculating daily averages AWI210-2 Calculating daily averages AWI210-2
Finished AWI210 Finished AWI210
repo_data/ULS_Ant_Behrendt_2013/AWI212-2_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI212-2_sea-ice_draft.tab
--> Selected parameter: Draft [m] (model correction, Calculated) --> Selected parameter: Draft [m] (model correction, Calculated)
Calculating daily averages AWI212-2 Calculating daily averages AWI212-2
Finished AWI212 Finished AWI212
repo_data/ULS_Ant_Behrendt_2013/AWI217_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI217_sea-ice_draft.tab
--> Selected parameter: Draft [m] (model correction, Calculated) --> Selected parameter: Draft [m] (model correction, Calculated)
Calculating daily averages AWI217_s Calculating daily averages AWI217_s
Finished AWI217 Finished AWI217
repo_data/ULS_Ant_Behrendt_2013/AWI227-3_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI227-3_sea-ice_draft.tab
--> Selected parameter: Draft [m] (zero line correction, Calculated) --> Selected parameter: Draft [m] (zero line correction, Calculated)
repo_data/ULS_Ant_Behrendt_2013/AWI227-4_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI227-4_sea-ice_draft.tab
--> Selected parameter: Draft [m] (model correction, Calculated) --> Selected parameter: Draft [m] (model correction, Calculated)
repo_data/ULS_Ant_Behrendt_2013/AWI227-6_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI227-6_sea-ice_draft.tab
--> Selected parameter: Draft [m] (model correction, Calculated) --> Selected parameter: Draft [m] (model correction, Calculated)
Calculating daily averages AWI227-3 Calculating daily averages AWI227-3
Calculating daily averages AWI227-4 Calculating daily averages AWI227-4
Calculating daily averages AWI227-6 Calculating daily averages AWI227-6
Finished AWI227 Finished AWI227
repo_data/ULS_Ant_Behrendt_2013/AWI229-1_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI229-1_sea-ice_draft.tab
--> Selected parameter: Draft [m] (zero line correction, Calculated) --> Selected parameter: Draft [m] (zero line correction, Calculated)
repo_data/ULS_Ant_Behrendt_2013/AWI229-2_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI229-2_sea-ice_draft.tab
--> Selected parameter: Draft [m] (zero line correction, Calculated) --> Selected parameter: Draft [m] (zero line correction, Calculated)
repo_data/ULS_Ant_Behrendt_2013/AWI229-3_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI229-3_sea-ice_draft.tab
--> Selected parameter: Draft [m] (zero line correction, Calculated) --> Selected parameter: Draft [m] (zero line correction, Calculated)
repo_data/ULS_Ant_Behrendt_2013/AWI229-4_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI229-4_sea-ice_draft.tab
--> Selected parameter: Draft [m] (zero line correction, Calculated) --> Selected parameter: Draft [m] (zero line correction, Calculated)
repo_data/ULS_Ant_Behrendt_2013/AWI229-5_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI229-5_sea-ice_draft.tab
--> Selected parameter: Draft [m] (zero line correction, Calculated) --> Selected parameter: Draft [m] (zero line correction, Calculated)
repo_data/ULS_Ant_Behrendt_2013/AWI229-6_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI229-6_sea-ice_draft.tab
--> Selected parameter: Draft [m] (zero line correction, Calculated) --> Selected parameter: Draft [m] (zero line correction, Calculated)
repo_data/ULS_Ant_Behrendt_2013/AWI229-8_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI229-8_sea-ice_draft.tab
--> Selected parameter: Draft [m] (zero line correction, Calculated) --> Selected parameter: Draft [m] (zero line correction, Calculated)
Calculating daily averages AWI229-1 Calculating daily averages AWI229-1
Calculating daily averages AWI229-2 Calculating daily averages AWI229-2
Calculating daily averages AWI229-3 Calculating daily averages AWI229-3
Calculating daily averages AWI229-4 Calculating daily averages AWI229-4
Calculating daily averages AWI229-5 Calculating daily averages AWI229-5
Calculating daily averages AWI229-6 Calculating daily averages AWI229-6
Calculating daily averages AWI229-8 Calculating daily averages AWI229-8
Finished AWI229 Finished AWI229
repo_data/ULS_Ant_Behrendt_2013/AWI230-2_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI230-2_sea-ice_draft.tab
--> Selected parameter: Draft [m] (zero line correction, Calculated) --> Selected parameter: Draft [m] (zero line correction, Calculated)
repo_data/ULS_Ant_Behrendt_2013/AWI230-3_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI230-3_sea-ice_draft.tab
--> Selected parameter: Draft [m] (model correction, Calculated) --> Selected parameter: Draft [m] (model correction, Calculated)
Calculating daily averages AWI230-2 Calculating daily averages AWI230-2
Calculating daily averages AWI230-3 Calculating daily averages AWI230-3
Finished AWI230 Finished AWI230
repo_data/ULS_Ant_Behrendt_2013/AWI231-1_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI231-1_sea-ice_draft.tab
--> Selected parameter: Draft [m] (model correction, Calculated) --> Selected parameter: Draft [m] (model correction, Calculated)
repo_data/ULS_Ant_Behrendt_2013/AWI231-2_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI231-2_sea-ice_draft.tab
--> Selected parameter: Draft [m] (model correction, Calculated) --> Selected parameter: Draft [m] (model correction, Calculated)
repo_data/ULS_Ant_Behrendt_2013/AWI231-3_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI231-3_sea-ice_draft.tab
--> Selected parameter: Draft [m] (model correction, Calculated) --> Selected parameter: Draft [m] (model correction, Calculated)
repo_data/ULS_Ant_Behrendt_2013/AWI231-4_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI231-4_sea-ice_draft.tab
--> Selected parameter: Draft [m] (model correction, Calculated) --> Selected parameter: Draft [m] (model correction, Calculated)
repo_data/ULS_Ant_Behrendt_2013/AWI231-6_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI231-6_sea-ice_draft.tab
--> Selected parameter: Draft [m] (model correction, Calculated) --> Selected parameter: Draft [m] (model correction, Calculated)
repo_data/ULS_Ant_Behrendt_2013/AWI231-7_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI231-7_sea-ice_draft.tab
--> Selected parameter: Draft [m] (model correction, Calculated) --> Selected parameter: Draft [m] (model correction, Calculated)
Calculating daily averages AWI231-1 Calculating daily averages AWI231-1
Calculating daily averages AWI231-2 Calculating daily averages AWI231-2
Calculating daily averages AWI231-3 Calculating daily averages AWI231-3
Calculating daily averages AWI231-4 Calculating daily averages AWI231-4
Calculating daily averages AWI231-6 Calculating daily averages AWI231-6
Calculating daily averages AWI231-7 Calculating daily averages AWI231-7
Finished AWI231 Finished AWI231
repo_data/ULS_Ant_Behrendt_2013/AWI232-1_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI232-1_sea-ice_draft.tab
--> Selected parameter: Draft [m] (model correction, Calculated) --> Selected parameter: Draft [m] (model correction, Calculated)
repo_data/ULS_Ant_Behrendt_2013/AWI232-4_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI232-4_sea-ice_draft.tab
--> Selected parameter: Draft [m] (model correction, Calculated) --> Selected parameter: Draft [m] (model correction, Calculated)
repo_data/ULS_Ant_Behrendt_2013/AWI232-5_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI232-5_sea-ice_draft.tab
--> Selected parameter: Draft [m] (model correction, Calculated) --> Selected parameter: Draft [m] (model correction, Calculated)
repo_data/ULS_Ant_Behrendt_2013/AWI232-6_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI232-6_sea-ice_draft.tab
--> Selected parameter: Draft [m] (model correction, Calculated) --> Selected parameter: Draft [m] (model correction, Calculated)
repo_data/ULS_Ant_Behrendt_2013/AWI232-8_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI232-8_sea-ice_draft.tab
--> Selected parameter: Draft [m] (model correction, Calculated) --> Selected parameter: Draft [m] (model correction, Calculated)
repo_data/ULS_Ant_Behrendt_2013/AWI232-9_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI232-9_sea-ice_draft.tab
--> Selected parameter: Draft [m] (model correction, Calculated) --> Selected parameter: Draft [m] (model correction, Calculated)
Calculating daily averages AWI232-1 Calculating daily averages AWI232-1
Calculating daily averages AWI232-4 Calculating daily averages AWI232-4
Calculating daily averages AWI232-5 Calculating daily averages AWI232-5
Calculating daily averages AWI232-6 Calculating daily averages AWI232-6
Calculating daily averages AWI232-8 Calculating daily averages AWI232-8
Calculating daily averages AWI232-9 Calculating daily averages AWI232-9
Finished AWI232 Finished AWI232
repo_data/ULS_Ant_Behrendt_2013/AWI233-2_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI233-2_sea-ice_draft.tab
--> Selected parameter: Draft [m] (model correction, Calculated) --> Selected parameter: Draft [m] (model correction, Calculated)
repo_data/ULS_Ant_Behrendt_2013/AWI233-6_sea-ice_draft.tab repo_data/ULS_Ant_Behrendt_2013/AWI233-6_sea-ice_draft.tab
--> Selected parameter: Draft [m] (model correction, Calculated) --> Selected parameter: Draft [m] (model correction, Calculated)
Calculating daily averages AWI233-2 Calculating daily averages AWI233-2
Calculating daily averages AWI233-6 Calculating daily averages AWI233-6
Finished AWI233 Finished AWI233
   
%% Cell type:markdown id:95268a3d tags: %% Cell type:markdown id:95268a3d tags:
   
### Calculate seasonal cycle - climatological monthly means and interannual standard deviation ### Calculate seasonal cycle - climatological monthly means and interannual standard deviation
   
%% Cell type:code id:1572d837 tags: %% Cell type:code id:1572d837 tags:
   
``` python ``` python
ULS_seasonal={} ULS_seasonal={}
ULS_seasonal_std={} ULS_seasonal_std={}
   
for k in xa1: for k in xa1:
ts=xa1[k] ts=xa1[k]
dates=pd.to_datetime(ts.indexes['Date']) dates=pd.to_datetime(ts.indexes['Date'])
month_index=dates.to_period(freq='M') month_index=dates.to_period(freq='M')
df=pd.DataFrame(ts) df=pd.DataFrame(ts)
df=pd.DataFrame(data=ts.data,index=dates,columns=['Draft']) df=pd.DataFrame(data=ts.data,index=dates,columns=['Draft'])
#df.index.name='Date' #df.index.name='Date'
df['year-month']=month_index df['year-month']=month_index
df['month']=month_index.month df['month']=month_index.month
seasonal=df.groupby('month').mean() seasonal=df.groupby('month').mean()
seasonal_std=df.groupby('month').std() seasonal_std=df.groupby('month').std()
   
ULS_seasonal[k]=seasonal ULS_seasonal[k]=seasonal
ULS_seasonal_std[k]=seasonal_std ULS_seasonal_std[k]=seasonal_std
   
xas1=xr.Dataset(ULS_seasonal) xas1=xr.Dataset(ULS_seasonal)
xass1=xr.Dataset(ULS_seasonal_std) xass1=xr.Dataset(ULS_seasonal_std)
xas2=xr.Dataset(ULS_seasonal,attrs=ULS_latlon) xas2=xr.Dataset(ULS_seasonal,attrs=ULS_latlon)
#xas2.to_netcdf('ULS_draft_monthly_seasonal.nc') #xas2.to_netcdf('ULS_draft_monthly_seasonal.nc')
``` ```
   
%% Cell type:markdown id:2cd221dc tags: %% Cell type:markdown id:2cd221dc tags:
   
### Select suitable ULS data ### Select suitable ULS data
   
The data have to fulfill following criteria: The data have to fulfill following criteria:
   
* Range of SMOS sea ice thickness 0 - 1.5 m * Range of SMOS sea ice thickness 0 - 1.5 m
* Long time series, at least 3 years of data * Long time series, at least 3 years of data
   
%% Cell type:code id:0e0dc14c tags: %% Cell type:code id:0e0dc14c tags:
   
``` python ``` python
for k in xa1: for k in xa1:
if xa1[k].max()<1.5: if xa1[k].max()<1.5:
xa1[k].plot(label=k) xa1[k].plot(label=k)
ylabel('Draft [m]') ylabel('Draft [m]')
legend(fontsize=8) legend(fontsize=8)
title('ULS < 1.5 m') title('ULS < 1.5 m')
   
figure() figure()
   
#Selected: AWI227, AWI229, AWI231 #Selected: AWI227, AWI229, AWI231
k='AWI227' k='AWI227'
xa1[k].plot(label=k) xa1[k].plot(label=k)
k='AWI229' k='AWI229'
xa1[k].plot(label=k) xa1[k].plot(label=k)
k='AWI231' k='AWI231'
xa1[k].plot(label=k) xa1[k].plot(label=k)
legend() legend()
title('Selected ULS with 47+ months of data') title('Selected ULS with 47+ months of data')
``` ```
   
%% Output %% Output
   
   
   
   
   
Text(0.5, 1.0, 'Selected ULS with 47+ months of data') Text(0.5, 1.0, 'Selected ULS with 47+ months of data')
   
%% Cell type:markdown id:98affb73 tags: %% Cell type:markdown id:98affb73 tags:
   
### Extract SMOS values at ULS positions ### Extract SMOS values at ULS positions
   
%% Cell type:code id:08558000 tags: %% Cell type:code id:08558000 tags:
   
``` python ``` python
SMOS_dict={} SMOS_dict={}
SMOS_dict_s={} SMOS_dict_s={}
   
for k in xas2: for k in xas2:
lat,lon=xas2.attrs[k] lat,lon=xas2.attrs[k]
ts1=xas2[k] ts1=xas2[k]
psxy=mapll(lat,lon) psxy=mapll(lat,lon)
posxy=(int((psxy[0]/1000-x2)/cs),int((psxy[1]/1000-y2)/cs)) posxy=(int((psxy[0]/1000-x2)/cs),int((psxy[1]/1000-y2)/cs))
xi,yi=posxy xi,yi=posxy
#SIT_0[yi-1:yi+1,xi-1:xi+1]=-1 #SIT_0[yi-1:yi+1,xi-1:xi+1]=-1
#print(k,lat,lon,xi,yi) #print(k,lat,lon,xi,yi)
L=[nan]*3 # Month 1-3 not available L=[nan]*3 # Month 1-3 not available
Ls=[nan]*3 Ls=[nan]*3
for mi in range(7): for mi in range(7):
L.append(SIT[yi,xi,mi]) L.append(SIT[yi,xi,mi])
Ls.append(SITs[yi,xi,mi]) Ls.append(SITs[yi,xi,mi])
   
L.append(nan) L.append(nan)
L.append(nan) L.append(nan)
Ls.append(nan) Ls.append(nan)
Ls.append(nan) Ls.append(nan)
   
SMOS_dict[k]=array(L) SMOS_dict[k]=array(L)
SMOS_dict_s[k]=array(Ls) SMOS_dict_s[k]=array(Ls)
``` ```
   
%% Cell type:code id:32971b21 tags: %% Cell type:code id:32971b21 tags:
   
``` python ``` python
selected=['AWI209','AWI227','AWI229','AWI231'] selected=['AWI209','AWI227','AWI229','AWI231']
selected=['AWI227','AWI229','AWI231'] selected=['AWI227','AWI229','AWI231']
symdic={'AWI227':'o','AWI229':'v','AWI231':'^'} symdic={'AWI227':'o','AWI229':'v','AWI231':'^'}
coldic={'AWI227':'b','AWI229':'r','AWI231':'c'} coldic={'AWI227':'b','AWI229':'r','AWI231':'c'}
coldic={'AWI227':'k','AWI229':'k','AWI231':'k'} coldic={'AWI227':'k','AWI229':'k','AWI231':'k'}
   
XL=[] # List for mean XL=[] # List for mean
YL=[] YL=[]
XLS=[] # Std XLS=[] # Std
YLS=[] YLS=[]
Lab=[] # Labels Lab=[] # Labels
   
xx=arange(12)+1 xx=arange(12)+1
ci=1 ci=1
for k in selected: for k in selected:
subplot(3,1,ci) subplot(3,1,ci)
lat,lon=xas2.attrs[k] lat,lon=xas2.attrs[k]
mu=float(xas2[k].mean()) mu=float(xas2[k].mean())
mumax=float(xas2[k].max()) mumax=float(xas2[k].max())
nrm=sum(isfinite(array(xa1[k]))) nrm=sum(isfinite(array(xa1[k])))
print(k,nrm) print(k,nrm)
ts1=xas2[k].values[:,0] ts1=xas2[k].values[:,0]
ts1=0.028+ts1*1.012 ts1=0.028+ts1*1.012
tss1=xass1[k].values[:,0] tss1=xass1[k].values[:,0]
fill_between(xx,ts1-tss1,ts1+tss1,alpha=0.3,color=coldic[k]) fill_between(xx,ts1-tss1,ts1+tss1,alpha=0.3,color=coldic[k])
   
plot(xx,ts1,label='ULS '+k,linestyle=':',color=coldic[k]) plot(xx,ts1,label='ULS '+k,linestyle=':',color=coldic[k])
ts2=SMOS_dict[k] ts2=SMOS_dict[k]
tss2=SMOS_dict_s[k] tss2=SMOS_dict_s[k]
errorbar(xx,ts2,yerr=tss2,color=coldic[k],label='SMOS @'+k) errorbar(xx,ts2,yerr=tss2,color=coldic[k],label='SMOS @'+k)
ci+=1 ci+=1
xlim([3.9,10.5]) xlim([3.9,10.5])
ylim([0,1.3]) ylim([0,1.3])
   
legend(fontsize=8,loc=2) legend(fontsize=8,loc=2)
xticks([]) xticks([])
ylabel('Thickness [m]') ylabel('Thickness [m]')
# Store value pairs into list (mean, std) # Store value pairs into list (mean, std)
ind=isfinite(ts2) ind=isfinite(ts2)
YL.extend(ts2[ind]) YL.extend(ts2[ind])
XL.extend(ts1[ind]) XL.extend(ts1[ind])
XLS.extend(tss1[ind]) XLS.extend(tss1[ind])
YLS.extend(tss2[ind]) YLS.extend(tss2[ind])
Lab.extend(array(((k+',')*12).split(',')[:-1])[ind]) Lab.extend(array(((k+',')*12).split(',')[:-1])[ind])
   
xticks(ticks=[4,5,6,7,8,9,10],labels=['April','May','June','July','Aug.','Sept.','Oct.']) xticks(ticks=[4,5,6,7,8,9,10],labels=['April','May','June','July','Aug.','Sept.','Oct.'])
tight_layout() tight_layout()
#savefig('Seasonal_thickness_ULS_SMOS.pdf') #savefig('Seasonal_thickness_ULS_SMOS.pdf')
x=array(XL) # ULS x=array(XL) # ULS
y=array(YL) # SMOS y=array(YL) # SMOS
xstd=array(XLS) xstd=array(XLS)
ystd=array(YLS) ystd=array(YLS)
``` ```
   
%% Output %% Output
   
   
   
AWI227 47 AWI227 47
AWI229 129 AWI229 129
AWI231 99 AWI231 99
   
%% Cell type:code id:0041713f tags: %% Cell type:code id:0041713f tags:
   
``` python ``` python
from sklearn.metrics import mean_squared_error from sklearn.metrics import mean_squared_error
import scipy.stats as stats import scipy.stats as stats
   
slope, intercept, r_value, p_value, std_err = stats.linregress(x, y) slope, intercept, r_value, p_value, std_err = stats.linregress(x, y)
   
print('Standard metric -----------') print('Standard metric -----------')
print("Mean VAL, SMOS: %1.2f +- %1.2f , %1.2f +- %1.2f" % (mean(x),std(x),mean(y),std(y))) print("Mean VAL, SMOS: %1.2f +- %1.2f , %1.2f +- %1.2f" % (mean(x),std(x),mean(y),std(y)))
print("N: ",len(x)) print("N: ",len(x))
md=np.mean(x-y) md=np.mean(x-y)
print("Mean difference VAL-SMOS: %1.2f" % md) print("Mean difference VAL-SMOS: %1.2f" % md)
rmsd=mean_squared_error(x,y,squared=False) rmsd=mean_squared_error(x,y,squared=False)
print("RMSD VAL-SMOS: %1.2f" % rmsd) print("RMSD VAL-SMOS: %1.2f" % rmsd)
print("R: %1.2f" % r_value) print("R: %1.2f" % r_value)
   
plt.figure(figsize=(6,6)) plt.figure(figsize=(6,6))
xn=np.linspace(0,1.4) xn=np.linspace(0,1.4)
plt.plot(xn,xn,'k:',label='Identity') plt.plot(xn,xn,'k:',label='Identity')
plt.plot(xn,xn*slope+intercept,'k-',label='Regression') plt.plot(xn,xn*slope+intercept,'k-',label='Regression')
   
for i,lab in enumerate(Lab): for i,lab in enumerate(Lab):
marker=symdic[lab] marker=symdic[lab]
if i/7==int(i/7): if i/7==int(i/7):
label=lab label=lab
else: else:
label='' label=''
plt.plot([x[i]],[y[i]],color='k',marker=marker,ms=10,alpha=1.0,label=label) plt.plot([x[i]],[y[i]],color='k',marker=marker,ms=10,alpha=1.0,label=label)
   
plt.errorbar(x,y,xerr=xstd,yerr=ystd,fmt='.',color='k') plt.errorbar(x,y,xerr=xstd,yerr=ystd,fmt='.',color='k')
   
   
grid() grid()
xlabel('ULS sea ice thickness [m]') xlabel('ULS sea ice thickness [m]')
ylabel('SMOS sea ice thickness [m]') ylabel('SMOS sea ice thickness [m]')
   
xlim([-0.1,1.3]) xlim([-0.1,1.3])
ylim([-0.1,1.3]) ylim([-0.1,1.3])
   
legend() legend()
tight_layout() tight_layout()
#savefig('Scatter_SMOS_ULS_seasonal.pdf') #savefig('Scatter_SMOS_ULS_seasonal.pdf')
#savefig('Scatter_SMOS_ULS_seasonal.png') #savefig('Scatter_SMOS_ULS_seasonal.png')
   
``` ```
   
%% Output %% Output
   
Standard metric ----------- Standard metric -----------
Mean VAL, SMOS: 0.46 +- 0.32 , 0.49 +- 0.38 Mean VAL, SMOS: 0.46 +- 0.32 , 0.49 +- 0.38
N: 21 N: 21
Mean difference VAL-SMOS: -0.03 Mean difference VAL-SMOS: -0.03
RMSD VAL-SMOS: 0.14 RMSD VAL-SMOS: 0.14
R: 0.94 R: 0.94
   
   
   
%% Cell type:markdown id:68f8da1c tags: %% Cell type:markdown id:68f8da1c tags:
   
### SUIT ### SUIT
   
Castellani, Giulia; Flores, Hauke; Lange, Benjamin Allen; Schaafsma, Fokje L; Ehrlich, Julia; David, Carmen L; van Franeker, Jan Andries; Meijboom, Andre; van Dorssen, Michiel; Vortkamp, Martina; Van de Putte, Anton P (2019): Sea ice draft, under-ice irradiance and radiance, and surface water temperature, salinity and chlorophyl a from Surface and Under Ice Trawl (SUIT) measurements in 2012-2017. Alfred Wegener Institute, Helmholtz Centre for Polar and Marine Research, Bremerhaven, PANGAEA, https://doi.org/10.1594/PANGAEA.902056 Castellani, Giulia; Flores, Hauke; Lange, Benjamin Allen; Schaafsma, Fokje L; Ehrlich, Julia; David, Carmen L; van Franeker, Jan Andries; Meijboom, Andre; van Dorssen, Michiel; Vortkamp, Martina; Van de Putte, Anton P (2019): Sea ice draft, under-ice irradiance and radiance, and surface water temperature, salinity and chlorophyl a from Surface and Under Ice Trawl (SUIT) measurements in 2012-2017. Alfred Wegener Institute, Helmholtz Centre for Polar and Marine Research, Bremerhaven, PANGAEA, https://doi.org/10.1594/PANGAEA.902056
   
%% Cell type:code id:9506be52 tags: %% Cell type:code id:9506be52 tags:
   
``` python ``` python
fn0='repo_data/PANGAEA_902260_PS81.tab' fn0='repo_data/PANGAEA_902260_PS81.tab'
dat=pd.read_csv(fn0,sep='\t',skiprows=35) dat=pd.read_csv(fn0,sep='\t',skiprows=35)
di=pd.to_datetime(dat['Date/Time'])+pd.to_timedelta(dat['Time [s]'].values,unit='s') di=pd.to_datetime(dat['Date/Time'])+pd.to_timedelta(dat['Time [s]'].values,unit='s')
Lat=pd.Series(data=dat['Latitude'].values,index=di) Lat=pd.Series(data=dat['Latitude'].values,index=di)
Lon=pd.Series(data=dat['Longitude'].values,index=di) Lon=pd.Series(data=dat['Longitude'].values,index=di)
Thick=pd.Series(data=dat['Ice thick [m]'].values,index=di) Thick=pd.Series(data=dat['Ice thick [m]'].values,index=di)
Distance=pd.Series(data=dat['Distance [m]'].values,index=di) Distance=pd.Series(data=dat['Distance [m]'].values,index=di)
   
from numpy import unique, array from numpy import unique, array
   
days=unique(array(dat['Date/Time'])) days=unique(array(dat['Date/Time']))
for day in days: for day in days:
print(day) print(day)
   
dat.head() dat.head()
``` ```
   
%% Output %% Output
   
2013-08-29 2013-08-29
2013-09-09 2013-09-09
2013-09-10 2013-09-10
2013-09-11 2013-09-11
2013-09-12 2013-09-12
2013-09-16 2013-09-16
2013-09-28 2013-09-28
2013-09-29 2013-09-29
2013-09-30 2013-09-30
2013-10-02 2013-10-02
   
Event Date/Time Latitude Longitude Haul Station Time [s] \ Event Date/Time Latitude Longitude Haul Station Time [s] \
0 PS81/549-1 2013-08-29 -61.251660 -42.066770 2 549 43027.002375 0 PS81/549-1 2013-08-29 -61.251660 -42.066770 2 549 43027.002375
1 PS81/549-1 2013-08-29 -61.249863 -42.066779 2 549 43028.032945 1 PS81/549-1 2013-08-29 -61.249863 -42.066779 2 549 43028.032945
2 PS81/549-1 2013-08-29 -61.252591 -42.066787 2 549 43029.054942 2 PS81/549-1 2013-08-29 -61.252591 -42.066787 2 549 43029.054942
3 PS81/549-1 2013-08-29 -61.251435 -42.066796 2 549 43030.066205 3 PS81/549-1 2013-08-29 -61.251435 -42.066796 2 549 43030.066205
4 PS81/549-1 2013-08-29 -61.251739 -42.066805 2 549 43031.082798 4 PS81/549-1 2013-08-29 -61.251739 -42.066805 2 549 43031.082798
Distance [m] Sea ice draft [m] Ice thick [m] Chl a [mg/m**3] Temp [°C] \ Distance [m] Sea ice draft [m] Ice thick [m] Chl a [mg/m**3] Temp [°C] \
0 0.0 -0.802515 0.875152 0.122137 -1.859637 0 0.0 -0.802515 0.875152 0.122137 -1.859637
1 0.5 -0.698829 0.762081 0.126799 -1.859591 1 0.5 -0.698829 0.762081 0.126799 -1.859591
2 1.0 -0.426149 0.464721 0.130338 -1.859484 2 1.0 -0.426149 0.464721 0.130338 -1.859484
3 1.5 -0.711586 0.775993 0.132577 -1.859596 3 1.5 -0.711586 0.775993 0.132577 -1.859596
4 2.0 -0.801220 0.873740 0.134420 -1.859658 4 2.0 -0.801220 0.873740 0.134420 -1.859658
Sal Sal
0 34.241937 0 34.241937
1 34.186280 1 34.186280
2 34.247329 2 34.247329
3 34.253710 3 34.253710
4 34.194110 4 34.194110
   
%% Cell type:code id:ea04ace6 tags: %% Cell type:code id:ea04ace6 tags:
   
``` python ``` python
# Create SUIT profile plots, not used in the paper # Create SUIT profile plots, not used in the paper
close('all') close('all')
figure(figsize=(9,18)) figure(figsize=(9,18))
spn=1 spn=1
thresh=0.03 thresh=0.03
   
L=[] L=[]
for day in days: for day in days:
thick0=Thick.loc[day] thick0=Thick.loc[day]
dist0=Distance.loc[day] dist0=Distance.loc[day]
lat0=Lat.loc[day] lat0=Lat.loc[day]
lon0=Lon.loc[day] lon0=Lon.loc[day]
mlat=mean(lat0) mlat=mean(lat0)
mlon=mean(lon0) mlon=mean(lon0)
if len(thick0)>1000: if len(thick0)>1000:
subplot(9,1,spn) subplot(9,1,spn)
spn+=1 spn+=1
plot(dist0,thick0,'.',ms=1,alpha=0.5) plot(dist0,thick0,'.',ms=1,alpha=0.5)
h_median=median(thick0) h_median=median(thick0)
h_mean=mean(thick0) h_mean=mean(thick0)
h0_str='$h_{median}$'+str('={:01.2f} m'.format(h_median)) h0_str='$h_{median}$'+str('={:01.2f} m'.format(h_median))
h1_str='$h_{mean}$'+str('={:01.2f} m'.format(h_mean)) h1_str='$h_{mean}$'+str('={:01.2f} m'.format(h_mean))
x0,x1=0,max(dist0) x0,x1=0,max(dist0)
plot([x0,x1],[h_median,h_median],'k:',label=h0_str) plot([x0,x1],[h_median,h_median],'k:',label=h0_str)
plot([x0,x1],[h_mean,h_mean],'k.-',ms=0,lw=0.5,label=h1_str) plot([x0,x1],[h_mean,h_mean],'k.-',ms=0,lw=0.5,label=h1_str)
# Ice concentration / open water fraction # Ice concentration / open water fraction
c0=thick0<=0.05 c0=thick0<=0.05
c1=thick0>0.05 c1=thick0>0.05
ice_conc=100-sum(c0)/sum(c1)*100 ice_conc=100-sum(c0)/sum(c1)*100
c_str=str('$C$={:01.1f} %'.format(ice_conc)) c_str=str('$C$={:01.1f} %'.format(ice_conc))
plot(dist0[c0],thick0[c0],'r.',ms=1,alpha=0.5,label=c_str) plot(dist0[c0],thick0[c0],'r.',ms=1,alpha=0.5,label=c_str)
legend(loc=1,fontsize=8,title=day) legend(loc=1,fontsize=8,title=day)
ylim([-0.1,5]) ylim([-0.1,5])
L.append([day,mlat,mlon,h_median,h_mean,ice_conc]) L.append([day,mlat,mlon,h_median,h_mean,ice_conc])
ylabel('Thickness [m]',fontsize=8) ylabel('Thickness [m]',fontsize=8)
xlabel('SUIT profile length [m]') xlabel('SUIT profile length [m]')
#savefig('figs/SUIT_profiles.pdf',dpi=200) #savefig('figs/SUIT_profiles.pdf',dpi=200)
   
L=array(L) L=array(L)
D={'Date':L[:,0],'Latitude':L[:,1].astype(float),'Longitude':L[:,2].astype(float), D={'Date':L[:,0],'Latitude':L[:,1].astype(float),'Longitude':L[:,2].astype(float),
'H median':L[:,3].astype(float),'H mean':L[:,4].astype(float),'Ice concentration':L[:,5].astype(float)} 'H median':L[:,3].astype(float),'H mean':L[:,4].astype(float),'Ice concentration':L[:,5].astype(float)}
SUIT_xa=xr.Dataset(D) SUIT_xa=xr.Dataset(D)
#SUIT_xa.to_netcdf('data/SUIT_thickness_validation.nc') #SUIT_xa.to_netcdf('data/SUIT_thickness_validation.nc')
#close('all') #close('all')
``` ```
   
%% Output %% Output
   
   
   
%% Cell type:markdown id:65151b57 tags: %% Cell type:markdown id:65151b57 tags:
   
### Generate overview map ### Generate overview map
   
%% Cell type:code id:61064cd1 tags: %% Cell type:code id:61064cd1 tags:
   
``` python ``` python
import warnings import warnings
warnings.filterwarnings('ignore') warnings.filterwarnings('ignore')
   
i=4 i=4
# 0 April 1 May 2 June 3 July 4 August 5 Septmber 6 October # 0 April 1 May 2 June 3 July 4 August 5 Septmber 6 October
#sit0=SIT[:,:,i] #sit0=SIT[:,:,i]
sit0=sitm sit0=sitm
#sit0=SIT[:,:] # September 2010 #sit0=SIT[:,:] # September 2010
if True: if True:
sit0=ma.masked_invalid(sit0) sit0=ma.masked_invalid(sit0)
   
#Extract subimage #Extract subimage
x0,y0,x2,y2=1200,3700.0,-3000.0,700.0 x0,y0,x2,y2=1200,3700.0,-3000.0,700.0
   
sit_region=sit0[int((y2-Y2)/cs):int((y0-Y2)/cs),int((x2-X2)/cs):int((x0-X2)/cs)] sit_region=sit0[int((y2-Y2)/cs):int((y0-Y2)/cs),int((x2-X2)/cs):int((x0-X2)/cs)]
   
Cur=array(mapxy(x0,y0)) Cur=array(mapxy(x0,y0))
Cll=array(mapxy(x2,y2)) Cll=array(mapxy(x2,y2))
   
palette = cm.gist_earth#bone palette = cm.gist_earth#bone
palette = cm.viridis palette = cm.viridis
palette = cm.plasma palette = cm.plasma
   
palette.set_over("#ffffff") palette.set_over("#ffffff")
palette.set_bad("#d0d0d0") palette.set_bad("#d0d0d0")
palette.set_under("#0000f0") palette.set_under("#0000f0")
   
close() close()
fig=plt.figure() fig=plt.figure()
   
m = Basemap(projection='stere',resolution='l',llcrnrlon=Cll[1],llcrnrlat=Cll[0],\ m = Basemap(projection='stere',resolution='l',llcrnrlon=Cll[1],llcrnrlat=Cll[0],\
urcrnrlon=Cur[1],urcrnrlat=Cur[0],lat_ts=-70,lon_0=0,lat_0=-90,rsphere=(6378273.,6356889.))#,round=True) urcrnrlon=Cur[1],urcrnrlat=Cur[0],lat_ts=-70,lon_0=0,lat_0=-90,rsphere=(6378273.,6356889.))#,round=True)
   
m.imshow(sit_region,interpolation='nearest',cmap=palette,vmin=0,vmax=1.0) m.imshow(sit_region,interpolation='nearest',cmap=palette,vmin=0,vmax=1.0)
m.drawmeridians(arange(0, 360, 30),labels=[0,0,1,0],linewidth=0.5) m.drawmeridians(arange(0, 360, 30),labels=[0,0,1,0],linewidth=0.5)
m.drawparallels(arange(-90, 90, 5),labels=[0,0,0,1],linewidth=0.5) m.drawparallels(arange(-90, 90, 5),labels=[0,0,0,1],linewidth=0.5)
   
plt.colorbar(shrink=0.5,extend='max',ticks=[0,0.5,1.0],pad=0.01,orientation='vertical').set_label(label='Sea-ice thickness [m]',size=10)#.set_label_position('left') plt.colorbar(shrink=0.5,extend='max',ticks=[0,0.5,1.0],pad=0.01,orientation='vertical').set_label(label='Sea-ice thickness [m]',size=10)#.set_label_position('left')
for k in ['AWI227', 'AWI229', 'AWI231']: for k in ['AWI227', 'AWI229', 'AWI231']:
lat,lon=xas2.attrs[k] lat,lon=xas2.attrs[k]
   
#mu=float(xas2[k][i+4].mean()) #mu=float(xas2[k][i+4].mean())
mu=float(xas2[k].mean()) mu=float(xas2[k].mean())
   
xsc,ysc=m(lon,lat) xsc,ysc=m(lon,lat)
ec='k' ec='k'
mumax=float(xas2[k].max()) mumax=float(xas2[k].max())
label='' label=''
ec='w' ec='w'
label='ULS '+k label='ULS '+k
msize=50 msize=50
scatter(xsc,ysc,s=msize,color=palette(mu),vmin=0,vmax=1,edgecolors=ec,label=label) scatter(xsc,ysc,s=msize,color=palette(mu),vmin=0,vmax=1,edgecolors=ec,label=label)
va='bottom' va='bottom'
text(xsc,ysc,k[3:],va=va,fontsize=10) text(xsc,ysc,k[3:],va=va,fontsize=10)
# SUIT # SUIT
for day in days: for day in days:
thick0=mean(Thick.loc[day]) thick0=mean(Thick.loc[day])
dist0=Distance.loc[day] dist0=Distance.loc[day]
lat0=Lat.loc[day] lat0=Lat.loc[day]
lon0=Lon.loc[day] lon0=Lon.loc[day]
mlat=mean(lat0) mlat=mean(lat0)
mlon=mean(lon0) mlon=mean(lon0)
xsc,ysc=m(mlon,mlat) xsc,ysc=m(mlon,mlat)
ec='g' ec='g'
label='' label=''
scatter(xsc,ysc,s=30,marker='s',color=palette(thick0),vmin=0,vmax=1,edgecolors=ec,label=label) scatter(xsc,ysc,s=30,marker='s',color=palette(thick0),vmin=0,vmax=1,edgecolors=ec,label=label)
label='SUIT' label='SUIT'
scatter(xsc,ysc,s=30,marker='s',color=palette(thick0),vmin=0,vmax=1,edgecolors=ec,label=label) scatter(xsc,ysc,s=30,marker='s',color=palette(thick0),vmin=0,vmax=1,edgecolors=ec,label=label)
   
# HEM # HEM
fl=!ls $valdir/HEM_Ant29*.nc fl=!ls $valdir/HEM_Ant29*.nc
   
for fn in fl: for fn in fl:
xhem=xr.open_mfdataset(fn) xhem=xr.open_mfdataset(fn)
thickness=xhem.THICKNESS.values thickness=xhem.THICKNESS.values
ind=isfinite(thickness) ind=isfinite(thickness)
thickness=thickness[ind] thickness=thickness[ind]
xlat=xhem.LATITUDE.values[ind][::100] xlat=xhem.LATITUDE.values[ind][::100]
xlon=xhem.LONGITUDE.values[ind][::100] xlon=xhem.LONGITUDE.values[ind][::100]
x,y=m(xlon,xlat) x,y=m(xlon,xlat)
#plot(x,y,'c.',ms=0.1) #plot(x,y,'c.',ms=0.1)
mxlat=mean(xlat) mxlat=mean(xlat)
mxlon=mean(xlon) mxlon=mean(xlon)
mthickness=mean(thickness) mthickness=mean(thickness)
xsc,ysc=m(mxlon,mxlat) xsc,ysc=m(mxlon,mxlat)
ec='c' ec='c'
label='' label=''
scatter(xsc,ysc,marker='d',s=40,color=palette(mthickness),vmin=0,vmax=1,edgecolors=ec,label=label) scatter(xsc,ysc,marker='d',s=40,color=palette(mthickness),vmin=0,vmax=1,edgecolors=ec,label=label)
label='HEM' label='HEM'
scatter(xsc,ysc,marker='d',s=40,color=palette(mthickness),vmin=0,vmax=1,edgecolors=ec,label=label) scatter(xsc,ysc,marker='d',s=40,color=palette(mthickness),vmin=0,vmax=1,edgecolors=ec,label=label)
   
legend(loc='lower right',title='Validation sites',fontsize=6) legend(loc='lower right',title='Validation sites',fontsize=6)
tight_layout() tight_layout()
#savefig('ULS_map_SMOS_mean.pdf') #savefig('ULS_map_SMOS_mean.pdf')
print('finished') print('finished')
``` ```
   
%% Output %% Output
   
   
   
finished finished
   
%% Cell type:markdown id:33fa8270 tags: %% Cell type:markdown id:33fa8270 tags:
   
## SUIT single days ## SUIT single days
   
%% Cell type:code id:4972e4b9 tags: %% Cell type:code id:4972e4b9 tags:
   
``` python ``` python
Outdir0=smos_datadir Outdir0=smos_datadir
   
year2=2020 # This year year2=2020 # This year
year1=2010 # Start of SMOS data year1=2010 # Start of SMOS data
Ny=year2-year1 Ny=year2-year1
years=list(range(year1,year2+1)) years=list(range(year1,year2+1))
dr=pd.date_range(str(year1)+'-01-01',str(year2)+'-12-31',freq='1d') dr=pd.date_range(str(year1)+'-01-01',str(year2)+'-12-31',freq='1d')
#dr=dr.to_period('D') #dr=dr.to_period('D')
Nd=len(dr) # Total days in period Nd=len(dr) # Total days in period
nans=zeros(Nd) nans=zeros(Nd)
nans[:]=nan nans[:]=nan
ts2=pd.Series(data=nans,index=dr) ts2=pd.Series(data=nans,index=dr)
   
ts=pd.Series() ts=pd.Series()
df=pd.DataFrame() df=pd.DataFrame()
   
date_list=list(dr.astype(str)) date_list=list(dr.astype(str))
   
fl=[] fl=[]
L_date=[] L_date=[]
for datestr in date_list: for datestr in date_list:
yyyy,mm,dd,hh=datestr[0:4],datestr[5:7],datestr[8:10],datestr[11:13] yyyy,mm,dd,hh=datestr[0:4],datestr[5:7],datestr[8:10],datestr[11:13]
Outdir=Outdir0+'/'+yyyy+'/'+mm+'/' Outdir=Outdir0+'/'+yyyy+'/'+mm+'/'
fn=Outdir+'SMOS_Icethickness_v3.2_south_'+yyyy+mm+dd+'.nc' fn=Outdir+'SMOS_Icethickness_v3.2_south_'+yyyy+mm+dd+'.nc'
   
fl1=glob.glob(Outdir+'*'+yyyy+mm+dd+'*.nc') fl1=glob.glob(Outdir+'*'+yyyy+mm+dd+'*.nc')
if fl1==[]: if fl1==[]:
fn='' fn=''
else: else:
fn=fl1[0] fn=fl1[0]
if os.path.exists(fn): if os.path.exists(fn):
L_date.append(pd.to_datetime( yyyy+mm+dd)) L_date.append(pd.to_datetime( yyyy+mm+dd))
fl.append(fn) fl.append(fn)
ind=array(L_date) ind=array(L_date)
   
ind2=pd.Series(data=ones(len(ind)),index=ind) ind2=pd.Series(data=ones(len(ind)),index=ind)
#ind2=ind2.to_period('12h') #ind2=ind2.to_period('12h')
smos_index=ts2.add(ind2,fill_value=0) smos_index=ts2.add(ind2,fill_value=0)
file_ind=pd.Series(array(fl),index=ind) file_ind=pd.Series(array(fl),index=ind)
   
figure(figsize=(15,5)) figure(figsize=(15,5))
isfinite(smos_index).astype(float).plot.area(stacked=False) isfinite(smos_index).astype(float).plot.area(stacked=False)
#savefig('SMOS_L3_TB_NH_available.png',dpi=150) #savefig('SMOS_L3_TB_NH_available.png',dpi=150)
#savefig('SMOS_L3_SH_available.png',dpi=150) #savefig('SMOS_L3_SH_available.png',dpi=150)
``` ```
   
%% Output %% Output
   
   
   
<AxesSubplot:> <AxesSubplot:>
   
%% Cell type:code id:960ee8b3 tags: %% Cell type:code id:960ee8b3 tags:
   
``` python ``` python
file_ind=pd.Series(array(fl),index=ind) file_ind=pd.Series(array(fl),index=ind)
fn0=file_ind[day] fn0=file_ind[day]
xa=xr.open_mfdataset(fn0) xa=xr.open_mfdataset(fn0)
land=array(xa.land)[0,:,:] land=array(xa.land)[0,:,:]
sit=array(xa.sea_ice_thickness)[0,:,:] sit=array(xa.sea_ice_thickness)[0,:,:]
sy,sx=sit.shape[0],sit.shape[1] sy,sx=sit.shape[0],sit.shape[1]
lat=array(xa.latitude) lat=array(xa.latitude)
lon=array(xa.longitude) lon=array(xa.longitude)
tc='k' tc='k'
#sit=sit0 #sit=sit0
``` ```
   
%% Cell type:code id:d8f63bf7 tags: %% Cell type:code id:d8f63bf7 tags:
   
``` python ``` python
days=array(['2013-08-29', '2013-09-09', '2013-09-10', '2013-09-11', days=array(['2013-08-29', '2013-09-09', '2013-09-10', '2013-09-11',
'2013-09-12', '2013-09-16', '2013-09-28', '2013-09-29', '2013-09-12', '2013-09-16', '2013-09-28', '2013-09-29',
'2013-09-30', '2013-10-02'], dtype=object) '2013-09-30', '2013-10-02'], dtype=object)
   
days2=array(['2013-08-29', '2013-09-09', '2013-09-10', '2013-09-11', days2=array(['2013-08-29', '2013-09-09', '2013-09-10', '2013-09-11',
'2013-09-12', '2013-09-16', '2013-09-29', '2013-09-12', '2013-09-16', '2013-09-29',
'2013-09-30', ], dtype=object) '2013-09-30', ], dtype=object)
#days=days2 #days=days2
   
dayL=[] dayL=[]
fl0=[] fl0=[]
for day in days: for day in days:
fn0=file_ind[day] fn0=file_ind[day]
fl0.append(fn0) fl0.append(fn0)
   
   
xa=xr.open_mfdataset(fl0) xa=xr.open_mfdataset(fl0)
sit=xa.sea_ice_thickness.mean(dim='time') sit=xa.sea_ice_thickness.mean(dim='time')
situ=xa.ice_thickness_uncertainty.mean(dim='time') situ=xa.ice_thickness_uncertainty.mean(dim='time')
satr=xa.saturation_ratio.mean(dim='time') satr=xa.saturation_ratio.mean(dim='time')
``` ```
   
%% Cell type:code id:b05dfedd tags: %% Cell type:code id:b05dfedd tags:
   
``` python ``` python
SITL=[] SITL=[]
   
vals=[] vals=[]
#days_selected=days #days_selected=days
days=array(['2013-08-29', '2013-09-09', '2013-09-10', '2013-09-11', days=array(['2013-08-29', '2013-09-09', '2013-09-10', '2013-09-11',
'2013-09-12', '2013-09-16', '2013-09-28', '2013-09-29', '2013-09-12', '2013-09-16', '2013-09-28', '2013-09-29',
'2013-09-30', '2013-10-02'], dtype=object) '2013-09-30', '2013-10-02'], dtype=object)
   
days2=array(['2013-08-29', '2013-09-09', '2013-09-10', '2013-09-11', days2=array(['2013-08-29', '2013-09-09', '2013-09-10', '2013-09-11',
'2013-09-12', '2013-09-16', '2013-09-29', '2013-09-12', '2013-09-16', '2013-09-29',
'2013-09-30', ], dtype=object) '2013-09-30', ], dtype=object)
#days=days2 #days=days2
   
dayL=[] dayL=[]
   
for day in days: for day in days:
fn0=file_ind[day] fn0=file_ind[day]
xa=xr.open_mfdataset(fn0) xa=xr.open_mfdataset(fn0)
sit=ma.masked_invalid((xa.sea_ice_thickness)[0,:,:]) sit=ma.masked_invalid((xa.sea_ice_thickness)[0,:,:])
situ=ma.masked_invalid((xa.ice_thickness_uncertainty)[0,:,:]) situ=ma.masked_invalid((xa.ice_thickness_uncertainty)[0,:,:])
satr=ma.masked_invalid((xa.saturation_ratio)[0,:,:]) satr=ma.masked_invalid((xa.saturation_ratio)[0,:,:])
   
#SITL.append(sit) #SITL.append(sit)
lat0=Lat.loc[day].median() lat0=Lat.loc[day].median()
lon0=Lon.loc[day].median() lon0=Lon.loc[day].median()
thick0=Thick.loc[day]#.median() thick0=Thick.loc[day]#.median()
mthick=thick0.median() mthick=thick0.median()
#mthick=thick0.mean() #mthick=thick0.mean()
   
sthick=thick0.std() sthick=thick0.std()
q25thick=quantile(thick0,0.25) q25thick=quantile(thick0,0.25)
q75thick=quantile(thick0,0.75) q75thick=quantile(thick0,0.75)
   
c0=thick0<=0.05 c0=thick0<=0.05
c1=thick0>0.05 c1=thick0>0.05
ice_conc=100-sum(c0)/sum(c1)*100 ice_conc=100-sum(c0)/sum(c1)*100
#if day=='2013-10-02': #if day=='2013-10-02':
   
   
if len(Thick.loc[day])>1000: if len(Thick.loc[day])>1000:
iy,ix=unravel_index(argmin(abs(lat[:]-lat0)+abs(lon[:]-lon0)),lat.shape) # get closest index iy,ix=unravel_index(argmin(abs(lat[:]-lat0)+abs(lon[:]-lon0)),lat.shape) # get closest index
vals.append([mthick,sthick,q25thick,q75thick,ice_conc,(sit[iy,ix]),situ[iy,ix],satr[iy,ix]]) vals.append([mthick,sthick,q25thick,q75thick,ice_conc,(sit[iy,ix]),situ[iy,ix],satr[iy,ix]])
dayL.append(day) dayL.append(day)
   
v=array(vals) v=array(vals)
``` ```
   
%% Cell type:code id:9a11a24b tags: %% Cell type:code id:9a11a24b tags:
   
``` python ``` python
from sklearn.metrics import mean_squared_error from sklearn.metrics import mean_squared_error
   
#x,y,xe,ye=v[:,0],v[:,3],v[:,1],v[:,4] #x,y,xe,ye=v[:,0],v[:,3],v[:,1],v[:,4]
x,y,xe0,xe1,ye1=v[:,0],v[:,5],v[:,2],v[:,3],v[:,6] x,y,xe0,xe1,ye1=v[:,0],v[:,5],v[:,2],v[:,3],v[:,6]
dmax=v[:,5]/v[:,7]*100 dmax=v[:,5]/v[:,7]*100
   
   
ye=array([ye1,dmax-y]) ye=array([ye1,dmax-y])
   
xe=array([xe0,xe1]) xe=array([xe0,xe1])
   
slope, intercept, r_value, p_value, std_err = stats.linregress(x, y) slope, intercept, r_value, p_value, std_err = stats.linregress(x, y)
print("slope: %f intercept: %f" % (slope, intercept)) print("slope: %f intercept: %f" % (slope, intercept))
print("R: %f" % r_value) print("R: %f" % r_value)
   
print("R-squared: %f" % r_value**2) print("R-squared: %f" % r_value**2)
   
print("Std err: %f" % std_err) print("Std err: %f" % std_err)
md=np.mean(x-y) md=np.mean(x-y)
print("Mean difference VAL-SMOS: %f" % md) print("Mean difference VAL-SMOS: %f" % md)
   
   
print('Standard metric -----------') print('Standard metric -----------')
print("Mean VAL, SMOS: %1.2f +- %1.2f , %1.2f +- %1.2f" % (mean(x),std(x),mean(y),std(y))) print("Mean VAL, SMOS: %1.2f +- %1.2f , %1.2f +- %1.2f" % (mean(x),std(x),mean(y),std(y)))
print("N: ",len(x)) print("N: ",len(x))
md=np.mean(x-y) md=np.mean(x-y)
print("Mean difference VAL-SMOS: %1.2f" % md) print("Mean difference VAL-SMOS: %1.2f" % md)
rmsd=mean_squared_error(x,y,squared=False) rmsd=mean_squared_error(x,y,squared=False)
print("RMSD VAL-SMOS: %1.2f" % rmsd) print("RMSD VAL-SMOS: %1.2f" % rmsd)
print("R: %1.2f" % r_value) print("R: %1.2f" % r_value)
   
#plt.plot(x,y,'o') #plt.plot(x,y,'o')
plt.figure(figsize=(6,6)) plt.figure(figsize=(6,6))
xn=np.linspace(0,2) xn=np.linspace(0,2)
plt.plot(xn,xn,'k:',label='Identity') plt.plot(xn,xn,'k:',label='Identity')
#plt.plot(xn,xn*slope+intercept,'k-',label='Ordinary regression') #plt.plot(xn,xn*slope+intercept,'k-',label='Ordinary regression')
plt.plot(x,y,'ko',ms=5,alpha=1.0,label='SMOS pixel based') plt.plot(x,y,'ko',ms=5,alpha=1.0,label='SMOS pixel based')
plt.errorbar(x,y,ms=5,xerr=xe,yerr=ye,fmt='ko',alpha=1.0) plt.errorbar(x,y,ms=5,xerr=xe,yerr=ye,fmt='ko',alpha=1.0)
   
#plt.errorbar(x,y,xerr=xe,yerr=ye,fmt='ko',alpha=0.2,label='SMOS pixel based') #plt.errorbar(x,y,xerr=xe,yerr=ye,fmt='ko',alpha=0.2,label='SMOS pixel based')
plt.plot(x,dmax,'r^',ms=5,alpha=1.0,label='$d_{max}$') plt.plot(x,dmax,'r^',ms=5,alpha=1.0,label='$d_{max}$')
#plt.plot(xn,xn*wslope+wintercept,'k:',label='Weighted regression') #plt.plot(xn,xn*wslope+wintercept,'k:',label='Weighted regression')
   
#plt.plot(xn,xn,'k:') #plt.plot(xn,xn,'k:')
#plt.grid() #plt.grid()
plt.xlabel('Validation thickness [m]') plt.xlabel('Validation thickness [m]')
plt.ylabel('SMOS thickness [m]') plt.ylabel('SMOS thickness [m]')
#plt.title('SMOS SIT version 3.2') #plt.title('SMOS SIT version 3.2')
#plt.title('SMOS SIT version 2') #plt.title('SMOS SIT version 2')
   
plt.legend(loc=2) plt.legend(loc=2)
plt.xlim([-0.1,1.5]) plt.xlim([-0.1,1.5])
plt.ylim([-0.1,1.5]) plt.ylim([-0.1,1.5])
#plt.savefig('SMOS_v2_scatter_fits.png',dpi=200) #plt.savefig('SMOS_v2_scatter_fits.png',dpi=200)
   
   
for i,day in enumerate(dayL): for i,day in enumerate(dayL):
text(x[i]-0.05,y[i]-0.05,day[5:],color='r',fontsize=8) text(x[i]-0.05,y[i]-0.05,day[5:],color='r',fontsize=8)
   
plt.tight_layout() plt.tight_layout()
grid() grid()
#plt.savefig('figs/SMOS_SUIT_scatter.pdf') #plt.savefig('figs/SMOS_SUIT_scatter.pdf')
   
``` ```
   
%% Output %% Output
   
slope: 0.486081 intercept: 0.055360 slope: 0.486081 intercept: 0.055360
R: 0.714217 R: 0.714217
R-squared: 0.510105 R-squared: 0.510105
Std err: 0.180045 Std err: 0.180045
Mean difference VAL-SMOS: 0.246493 Mean difference VAL-SMOS: 0.246493
Standard metric ----------- Standard metric -----------
Mean VAL, SMOS: 0.59 +- 0.24 , 0.34 +- 0.16 Mean VAL, SMOS: 0.59 +- 0.24 , 0.34 +- 0.16
N: 9 N: 9
Mean difference VAL-SMOS: 0.25 Mean difference VAL-SMOS: 0.25
RMSD VAL-SMOS: 0.30 RMSD VAL-SMOS: 0.30
R: 0.71 R: 0.71
   
   
   
%% Cell type:markdown id:fcda86b3 tags: %% Cell type:markdown id:fcda86b3 tags:
   
## HEM single days ## HEM single days
   
%% Cell type:code id:a4b3bcca tags: %% Cell type:code id:a4b3bcca tags:
   
``` python ``` python
XA=xr.open_mfdataset('repo_data/HEM/Ant_*_*_sit.nc') XA=xr.open_mfdataset('repo_data/HEM/Ant_*_*_sit.nc')
XA XA
``` ```
   
%% Output %% Output
   
<xarray.Dataset> <xarray.Dataset>
Dimensions: (x: 632, y: 664, time: 4) Dimensions: (x: 632, y: 664, time: 4)
Coordinates: Coordinates:
* x (x) float64 -3.95e+03 -3.937e+03 ... 3.937e+03 3.95e+03 * x (x) float64 -3.95e+03 -3.937e+03 ... 3.937e+03 3.95e+03
* y (y) float64 -3.95e+03 -3.937e+03 ... 4.337e+03 4.35e+03 * y (y) float64 -3.95e+03 -3.937e+03 ... 4.337e+03 4.35e+03
* time (time) datetime64[ns] 2013-06-19T13:43:00 ... 2013-07-... * time (time) datetime64[ns] 2013-06-19T13:43:00 ... 2013-07-...
Data variables: Data variables:
sea_ice_thickness (time, y, x) float32 dask.array<chunksize=(1, 664, 632), meta=np.ndarray> sea_ice_thickness (time, y, x) float32 dask.array<chunksize=(1, 664, 632), meta=np.ndarray>
   
%% Cell type:code id:ba8503a1 tags: %% Cell type:code id:ba8503a1 tags:
   
``` python ``` python
   
zval=[] zval=[]
zsmos=[] zsmos=[]
zsmosu=[] # Uncertainty zsmosu=[] # Uncertainty
zsmosr=[] # Saturation zsmosr=[] # Saturation
   
zvalm=[] # Mean for days zvalm=[] # Mean for days
zsmosm=[] zsmosm=[]
zvals=[] # std for days zvals=[] # std for days
zsmoss=[] zsmoss=[]
   
   
for ti in XA.time: for ti in XA.time:
SITval=ma.masked_invalid(XA.sel(time=ti).to_array())[0,:,:] SITval=ma.masked_invalid(XA.sel(time=ti).to_array())[0,:,:]
datestr=str(np.array(ti))[0:10] datestr=str(np.array(ti))[0:10]
yyyy,mm,dd,hh=datestr[0:4],datestr[5:7],datestr[8:10],datestr[11:13] yyyy,mm,dd,hh=datestr[0:4],datestr[5:7],datestr[8:10],datestr[11:13]
Outdir=Outdir0+'/'+yyyy+'/'+mm+'/' Outdir=Outdir0+'/'+yyyy+'/'+mm+'/'
fn=Outdir+'SMOS_Icethickness_v3.2_south_'+yyyy+mm+dd+'.nc' fn=Outdir+'SMOS_Icethickness_v3.2_south_'+yyyy+mm+dd+'.nc'
print(fn) print(fn)
xa=xr.open_mfdataset(fn) xa=xr.open_mfdataset(fn)
SIT0=np.array(xa.sea_ice_thickness)[0,:,:] SIT0=np.array(xa.sea_ice_thickness)[0,:,:]
SITU=np.array(xa.ice_thickness_uncertainty)[0,:,:] SITU=np.array(xa.ice_thickness_uncertainty)[0,:,:]
SATR=np.array(xa.saturation_ratio)[0,:,:] SATR=np.array(xa.saturation_ratio)[0,:,:]
   
ind=np.logical_not(SITval.mask) ind=np.logical_not(SITval.mask)
zval.extend(SITval[ind].flatten().data) zval.extend(SITval[ind].flatten().data)
zsmos.extend(SIT0[ind].flatten().data) zsmos.extend(SIT0[ind].flatten().data)
zsmosu.extend(SITU[ind].flatten().data) zsmosu.extend(SITU[ind].flatten().data)
zsmosr.extend(SATR[ind].flatten().data) zsmosr.extend(SATR[ind].flatten().data)
   
zvalm.append(mean(SITval[ind].flatten().data)) zvalm.append(mean(SITval[ind].flatten().data))
zsmosm.append(mean(SIT0[ind].flatten().data)) zsmosm.append(mean(SIT0[ind].flatten().data))
zvals.append(std(SITval[ind].flatten().data)) zvals.append(std(SITval[ind].flatten().data))
zsmoss.append(std(SIT0[ind].flatten().data)) zsmoss.append(std(SIT0[ind].flatten().data))
print(len(zval)) print(len(zval))
   
x=np.array(zval) x=np.array(zval)
y=np.array(zsmos) y=np.array(zsmos)
ye=np.array(zsmosu) ye=np.array(zsmosu)
dmax=y/np.array(zsmosr)*100 dmax=y/np.array(zsmosr)*100
   
   
xm=np.array(zvalm) xm=np.array(zvalm)
ym=np.array(zsmosm) ym=np.array(zsmosm)
   
xms=np.array(zvals) xms=np.array(zvals)
yms=np.array(zsmoss) yms=np.array(zsmoss)
   
``` ```
   
%% Output %% Output
   
/isibhv/projects/siral/product/smos/SMOS_v620_L3C_Sea_v3/south//2013/06/SMOS_Icethickness_v3.2_south_20130619.nc /isibhv/projects/siral/product/smos/SMOS_v620_L3C_Sea_v3/south//2013/06/SMOS_Icethickness_v3.2_south_20130619.nc
11 11
/isibhv/projects/siral/product/smos/SMOS_v620_L3C_Sea_v3/south//2013/06/SMOS_Icethickness_v3.2_south_20130620.nc /isibhv/projects/siral/product/smos/SMOS_v620_L3C_Sea_v3/south//2013/06/SMOS_Icethickness_v3.2_south_20130620.nc
25 25
/isibhv/projects/siral/product/smos/SMOS_v620_L3C_Sea_v3/south//2013/06/SMOS_Icethickness_v3.2_south_20130621.nc /isibhv/projects/siral/product/smos/SMOS_v620_L3C_Sea_v3/south//2013/06/SMOS_Icethickness_v3.2_south_20130621.nc
41 41
/isibhv/projects/siral/product/smos/SMOS_v620_L3C_Sea_v3/south//2013/07/SMOS_Icethickness_v3.2_south_20130707.nc /isibhv/projects/siral/product/smos/SMOS_v620_L3C_Sea_v3/south//2013/07/SMOS_Icethickness_v3.2_south_20130707.nc
53 53
   
%% Cell type:code id:c42f298b tags: %% Cell type:code id:c42f298b tags:
   
``` python ``` python
ye2=array([ye,dmax-y]) ye2=array([ye,dmax-y])
ye3=array([0,dmax-y]) ye3=array([0,dmax-y])
plt.figure(figsize=(6,6)) plt.figure(figsize=(6,6))
xn=np.linspace(0,2) xn=np.linspace(0,2)
plt.plot(xn,xn,'k:',label='Identity') plt.plot(xn,xn,'k:',label='Identity')
plt.plot(x,y,'ko',ms=3,alpha=0.5,label='SMOS pixel based') plt.plot(x,y,'ko',ms=3,alpha=0.5,label='SMOS pixel based')
plt.errorbar(xm,ym,xerr=xms,yerr=yms,ms=10,fmt='ko',label='Flight mean') plt.errorbar(xm,ym,xerr=xms,yerr=yms,ms=10,fmt='ko',label='Flight mean')
plt.plot(x,dmax,'r^',ms=5,alpha=1.0,label='$d_{max}$') plt.plot(x,dmax,'r^',ms=5,alpha=1.0,label='$d_{max}$')
plt.errorbar(x,y,yerr=ye2,ms=3,fmt='ko',alpha=0.3)#,label='SMOS pixel based') plt.errorbar(x,y,yerr=ye2,ms=3,fmt='ko',alpha=0.3)#,label='SMOS pixel based')
plt.xlabel('Validation thickness [m]') plt.xlabel('Validation thickness [m]')
plt.ylabel('SMOS thickness [m]') plt.ylabel('SMOS thickness [m]')
plt.legend(loc=2) plt.legend(loc=2)
plt.xlim([0.0,2.0]) plt.xlim([0.0,2.0])
plt.ylim([0.0,2.0]) plt.ylim([0.0,2.0])
plt.grid() plt.grid()
#savefig('Ant_Val_HEM_Suit_Scatter.png',dpi=300) #savefig('Ant_Val_HEM_Suit_Scatter.png',dpi=300)
#savefig('figs/Ant_Val_HEM_Scatter.pdf') #savefig('figs/Ant_Val_HEM_Scatter.pdf')
``` ```
   
%% Output %% Output
   
   
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment