Commit 86e29f8a authored by Espen Sollum's avatar Espen Sollum
Browse files

Small changes to ncf attributes, interpolation, time.

parent 35eb1f5f
......@@ -62,9 +62,15 @@ mm1=int(month)
dd1=int(day)
tt1=int(t1)
tt2=int(t2)
dT=3600*(tt1+(tt2-tt1)/2)
#dT=3600*(tt1+(tt2-tt1)/2)
tte=dt.datetime(yy1, mm1, dd1, tt2)
ttt = dt.datetime(yy1, mm1, dd1, tt1)
#dT=3600*(tt2-tt1)
dT = (tte-ttt).seconds
time0 = float((ttt - dt.datetime(2010, 1, 1)).total_seconds())
timeA = time0 + dT/2.0
time_bndsA = [time0, time0+dT]
......@@ -152,6 +158,7 @@ def make_netcdf(filename):
time.standard_name = 'time'
time.long_name = 'reference time for the measurements'
time.units = 'seconds since 2010-01-01 00:00:00'
time.bounds = 'time_bnds'
time[:] = timeA
time_bnds = ncf.createVariable('time_bnds','i4',('time_bnds',))
......@@ -161,31 +168,33 @@ def make_netcdf(filename):
time_bnds[:] = time_bndsA
#dBT = ncf.createVariable('dBT','f4',('lat','lon'),fill_value=9.96921e+36)
dBT = ncf.createVariable('dBT','f4',('lat','lon'))
dBT = ncf.createVariable('dBT','f4',('time', 'lat','lon'))
dBT.standard_name = 'dBT'
dBT.long_name = 'Brightness temperature difference (1231.5-1097.25 cm-1)'
dBT.units = 'K'
dBT[:,:] = comp1
dBT.ancillary_variables = 'flag'
dBT[0,:,:] = comp1
dBT_SeviriBand = ncf.createVariable('dBT_SeviriBand','f4',('lat','lon'))
dBT_SeviriBand = ncf.createVariable('dBT_SeviriBand','f4',('time','lat','lon'))
dBT_SeviriBand.standard_name = 'dBT'
dBT_SeviriBand.long_name = 'Brightness temperature difference (10-12 cm-1)'
dBT_SeviriBand.long_name = 'Brightness temperature difference (10-12 um)'
dBT_SeviriBand.units = 'K'
dBT_SeviriBand[:,:] = comp2
dBT_SeviriBand.ancillary_variables = 'flag'
dBT_SeviriBand[0,:,:] = comp2
dBT_flag = ncf.createVariable('dBT_flag','i4',('lat','lon'),fill_value=-9999)
dBT_flag = ncf.createVariable('dBT_flag','i4',('time','lat','lon'),fill_value=-9999)
dBT_flag.standard_name = 'status_flag'
dBT_flag.long_name = 'Ash detection flag'
dBT_flag.flag_values = 0, 1, 2
dBT_flag.flag_meanings = 'No_ash@dBT.lt.+1.5 Uncertain Ash@dBT.gt.+2.5'
dBT_flag[:,:] = comp3
dBT_flag[0,:,:] = comp3
dBT_SeviriBand_flag = ncf.createVariable('dBT_SeviriBand_flag','i4',('lat','lon'),fill_value=-9999)
dBT_SeviriBand_flag = ncf.createVariable('dBT_SeviriBand_flag','i4',('time','lat','lon'),fill_value=-9999)
dBT_SeviriBand_flag.standard_name = 'status_flag'
dBT_SeviriBand_flag.long_name = 'Ash detection flag (Seviri band)'
dBT_SeviriBand_flag.flag_values = 0, 1, 2
dBT_SeviriBand_flag.flag_meanings = 'No_ash@dBT.gt.-0.2 Uncertain Ash@dBT.lt.-0.5)'
dBT_SeviriBand_flag[:,:] = comp4
dBT_SeviriBand_flag[0,:,:] = comp4
ncf.close()
......
......@@ -3,7 +3,7 @@
### Run script (bash, fortran and python):
### ./regrid.sh Combined_IASI_20100417_1200-2400.nc
path_in='/home/toves/Askevarsel/Latlon/'
path_in=./
file=$1
year=${file:14:4}
......@@ -64,4 +64,4 @@ lonmax=50
python3 MakeIASI_netcdf_and_Plot.py
rm lat.txt lon.txt dBT.txt SEVIRI_dBT.txt
\ No newline at end of file
rm lat.txt lon.txt dBT.txt SEVIRI_dBT.txt
......@@ -3,7 +3,7 @@ Program regrid_IASI
Implicit none
Integer I,J,ILINE,IO,II, INDEX1, INDEX2
real :: mm,dd,avg1, avg2
real :: dx, dy,sensX, sensY, min_err, GridresX, GridresY, rlon,rlat
real :: dx, dy,sensX, sensXorg, sensY, min_err, GridresX, GridresY, rlon,rlat
character*50 :: path
character FILE1*20,FILE2*20,FILE3*20,FILE4*20
character FILEgrid*17,yyt*4, mmt*2, ddt*2, time*11
......@@ -44,7 +44,8 @@ read(11,*,END=50) FILE4
!iline=IO/3 - 2
iline=IO -2
sensX=sensX/2.0
! eso: scale sensX with latitude (keep roughly original values at latmin)
sensXorg=sensX/2.0*abs(cos(latmin*3.14/180.))
sensY=sensY/2.0
50 continue
......@@ -113,6 +114,7 @@ avg1=0.0
avg2=0.0
do j=1,iline
if (abs(lat(J)) < 89.) sensX = sensXorg/abs(cos(lat(J)*3.14/180.))
if (lat(J).ge.(rlat-sensY) .and. lat(J).le.(rlat+sensY) .and. &
lon(J).ge.(rlon-sensX) .and. lon(J).le.(rlon+sensx)) then
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment