[gradsusr] Can Grads convert NOAA AVHRR netcdf file into a georeferenced Gtiff file

Stephen Woodbridge stephenwoodbridge37 at gmail.com
Tue Mar 5 21:17:51 EST 2019


Hi All,

I'm struggling to find a way to convert NOAA AVHRR SST netcdf file into 
a georeferenced GTiff file, like:

ftp://ftp.star.nesdis.noaa.gov/pub/socd2/coastwatch/sst/nrt/avhrr_gac/noaa18/l2p/2019/063/20190304200000-OSPO-L2P_GHRSST-SSTsubskin-AVHRR18_G-ACSPO_V2.41-v02.0-fv01.0.nc

My standard goto too is normally GDAL but it does not handle files like 
this where every pixel has its own lat/lon. I seems like you need to 
convert the irregular points into a gridded x-y array in some projection 
then write that out to a gtiff, but I'm lost on how to do this.

I have only used Grads once before to convert a grads script into a 
gradspy script to extract date that had been getting plotted to a data 
array.

Any help would be appreciated.

Thanks,
   -Steve W

below are and ncdump -h and gdalinfo output:

$ ncdump -h 
20190304200000-OSPO-L2P_GHRSST-SSTsubskin-AVHRR18_G-ACSPO_V2.41-v02.0-fv01.0.nc
netcdf 
\20190304200000-OSPO-L2P_GHRSST-SSTsubskin-AVHRR18_G-ACSPO_V2.41-v02.0-fv01.0 
{
dimensions:
         ni = 409 ;
         nj = 7200 ;
         time = 1 ;
variables:
         int time(time) ;
                 time:comment = "seconds since 1981-01-01 00:00:00" ;
                 time:long_name = "reference time of sst file" ;
                 time:standard_name = "time" ;
                 time:units = "seconds since 1981-01-01 00:00:00" ;
                 time:calendar = "Gregorian" ;
                 time:axis = "T" ;
         short sst_dtime(time, nj, ni) ;
                 sst_dtime:add_offset = 0.f ;
                 sst_dtime:comment = "time plus sst_dtime gives seconds 
since 1981-01-01 00:00:00 UTC" ;
                 sst_dtime:coordinates = "lon lat" ;
                 sst_dtime:long_name = "time difference from reference 
time" ;
                 sst_dtime:scale_factor = 0.25f ;
                 sst_dtime:units = "seconds" ;
                 sst_dtime:valid_max = 32767s ;
                 sst_dtime:valid_min = -32767s ;
                 sst_dtime:_FillValue = -32768s ;
         byte dt_analysis(time, nj, ni) ;
                 dt_analysis:add_offset = 0.f ;
                 dt_analysis:comment = "Deviation from reference SST, 
i.e., dt_analysis = SST - reference SST" ;
                 dt_analysis:coordinates = "lon lat" ;
                 dt_analysis:long_name = "deviation from SST reference" ;
                 dt_analysis:source = "CMC0.2deg-CMC-L4-GLOB-v2.0" ;
                 dt_analysis:scale_factor = 0.1f ;
                 dt_analysis:units = "kelvin" ;
                 dt_analysis:valid_max = 127b ;
                 dt_analysis:valid_min = -127b ;
                 dt_analysis:_FillValue = -128b ;
         float lat(nj, ni) ;
                 lat:comment = "Latitude of retrievals" ;
                 lat:long_name = "latitude" ;
                 lat:standard_name = "latitude" ;
                 lat:units = "degrees_north" ;
                 lat:valid_max = 90.f ;
                 lat:valid_min = -90.f ;
         float lon(nj, ni) ;
                 lon:comment = "Longitude of retrievals" ;
                 lon:long_name = "longitude" ;
                 lon:standard_name = "longitude" ;
                 lon:units = "degrees_east" ;
                 lon:valid_max = 180.f ;
                 lon:valid_min = -180.f ;
         byte satellite_zenith_angle(time, nj, ni) ;
                 satellite_zenith_angle:add_offset = 0.f ;
                 satellite_zenith_angle:comment = "satellite zenith angle" ;
                 satellite_zenith_angle:coordinates = "lon lat" ;
                 satellite_zenith_angle:long_name = "satellite zenith 
angle" ;
                 satellite_zenith_angle:scale_factor = 1.f ;
                 satellite_zenith_angle:units = "degrees" ;
                 satellite_zenith_angle:valid_max = 127b ;
                 satellite_zenith_angle:valid_min = -127b ;
                 satellite_zenith_angle:_FillValue = -128b ;
         short sea_surface_temperature(time, nj, ni) ;
                 sea_surface_temperature:add_offset = 273.15f ;
                 sea_surface_temperature:comment = "SST obtained by 
regression with buoy measurements" ;
                 sea_surface_temperature:coordinates = "lon lat" ;
                 sea_surface_temperature:long_name = "sea surface skin 
temperature" ;
                 sea_surface_temperature:scale_factor = 0.01f ;
                 sea_surface_temperature:source = "NOAA" ;
                 sea_surface_temperature:standard_name = 
"sea_surface_skin_temperature" ;
                 sea_surface_temperature:units = "kelvin" ;
                 sea_surface_temperature:valid_max = 32767s ;
                 sea_surface_temperature:valid_min = -32767s ;
                 sea_surface_temperature:_FillValue = -32768s ;
         byte sses_bias(time, nj, ni) ;
                 sses_bias:add_offset = 0.f ;
                 sses_bias:comment = "Estimated based on buoys 
measurements" ;
                 sses_bias:coordinates = "lon lat" ;
                 sses_bias:long_name = "SSES bias estimate" ;
                 sses_bias:scale_factor = 0.016f ;
                 sses_bias:units = "kelvin" ;
                 sses_bias:valid_max = 127b ;
                 sses_bias:valid_min = -127b ;
                 sses_bias:_FillValue = -128b ;
         byte sses_standard_deviation(time, nj, ni) ;
                 sses_standard_deviation:add_offset = 1.f ;
                 sses_standard_deviation:comment = "Estimated based on 
buoys measurements" ;
                 sses_standard_deviation:coordinates = "lon lat" ;
                 sses_standard_deviation:long_name = "SSES standard 
deviation" ;
                 sses_standard_deviation:scale_factor = 0.01f ;
                 sses_standard_deviation:units = "kelvin" ;
                 sses_standard_deviation:valid_max = 127b ;
                 sses_standard_deviation:valid_min = -127b ;
                 sses_standard_deviation:_FillValue = -128b ;
         byte sea_ice_fraction(time, nj, ni) ;
                 sea_ice_fraction:add_offset = 0.f ;
                 sea_ice_fraction:comment = "Fractional sea ice cover 
from reference SST" ;
                 sea_ice_fraction:coordinates = "lon lat" ;
                 sea_ice_fraction:long_name = "sea ice fraction" ;
                 sea_ice_fraction:scale_factor = 0.01f ;
                 sea_ice_fraction:source = "CMC0.2deg-CMC-L4-GLOB-v2.0" ;
                 sea_ice_fraction:standard_name = "sea_ice_area_fraction" ;
                 sea_ice_fraction:units = "1" ;
                 sea_ice_fraction:valid_max = 100b ;
                 sea_ice_fraction:valid_min = 0b ;
                 sea_ice_fraction:_FillValue = -128b ;
         short l2p_flags(time, nj, ni) ;
                 l2p_flags:comment = "L2P common flags in bits 1-6 and 
data provider flags (from ACSPO mask) in bits 9-16: bit01 (0=IR: 
1=microwave); bit02 (0=ocean; 1=land); bit03 (0=no ice; 1=ice); 
bits04-08 (reserved,set to 0); bit09 (0=radiance valid; 1=invalid); 
bit10 (0=night; 1=day); bit11 (0=ocean; 1=land); bit12 (0=good quality 
data; 1=degraded quality data due to \"twilight\" region); bit13 (0=no 
glint; 1=glint); bit14 (0=no snow/ice; 1=snow/ice); bits15-16 (00=clear; 
01=probably clear; 10=cloudy; 11=clear-sky mask undefined)" ;
                 l2p_flags:coordinates = "lon lat" ;
                 l2p_flags:flag_masks = 1s, 2s, 4s, 256s, 512s, 1024s, 
2048s, 4096s, 8192s, -16384s ;
                 l2p_flags:flag_meanings = "microwave land ice invalid 
day land twilight glint ice probably_clear_or_cloudy_or_undefined" ;
                 l2p_flags:long_name = "L2P flags" ;
                 l2p_flags:valid_max = 32767s ;
                 l2p_flags:valid_min = -32768s ;
         byte quality_level(time, nj, ni) ;
                 quality_level:comment = "Based on l2p_flags" ;
                 quality_level:coordinates = "lon lat" ;
                 quality_level:flag_meanings = "invalid not_used 
not_used cloudy probably_clear clear" ;
                 quality_level:flag_values = 0b, 1b, 2b, 3b, 4b, 5b ;
                 quality_level:long_name = "quality level of SST pixel" ;
                 quality_level:valid_max = 5b ;
                 quality_level:valid_min = 0b ;
                 quality_level:_FillValue = 0b ;
         byte wind_speed(time, nj, ni) ;
                 wind_speed:add_offset = 0.f ;
                 wind_speed:comment = "Typically represents surface 
winds (10 meters above the sea surface)" ;
                 wind_speed:coordinates = "lon lat" ;
                 wind_speed:height = "10 m" ;
                 wind_speed:long_name = "wind speed" ;
                 wind_speed:scale_factor = 0.15f ;
                 wind_speed:source = "Wind speed from NCEP GFS data" ;
                 wind_speed:standard_name = "wind_speed" ;
                 wind_speed:units = "m s-1" ;
                 wind_speed:valid_max = 127b ;
                 wind_speed:valid_min = -127b ;
                 wind_speed:_FillValue = -128b ;
         short brightness_temperature_11um(time, nj, ni) ;
                 brightness_temperature_11um:add_offset = 273.15f ;
                 brightness_temperature_11um:comment = "non L2P core 
field; brightness temperature for 10.8 um channel AVHRR Ch. 4" ;
                 brightness_temperature_11um:coordinates = "lon lat" ;
                 brightness_temperature_11um:long_name = "brightness 
temperature for 10.8 um channel" ;
                 brightness_temperature_11um:scale_factor = 0.01f ;
                 brightness_temperature_11um:source = "AVHRR channel 4" ;
                 brightness_temperature_11um:units = "kelvin" ;
                 brightness_temperature_11um:valid_max = 32767s ;
                 brightness_temperature_11um:valid_min = -32767s ;
                 brightness_temperature_11um:_FillValue = -32768s ;
         short brightness_temperature_12um(time, nj, ni) ;
                 brightness_temperature_12um:add_offset = 273.15f ;
                 brightness_temperature_12um:comment = "non L2P core 
field; brightness temperature for 12.0 um channel AVHRR Ch. 5" ;
                 brightness_temperature_12um:coordinates = "lon lat" ;
                 brightness_temperature_12um:long_name = "brightness 
temperature for 12.0 um channel" ;
                 brightness_temperature_12um:scale_factor = 0.01f ;
                 brightness_temperature_12um:source = "AVHRR channel 5" ;
                 brightness_temperature_12um:units = "kelvin" ;
                 brightness_temperature_12um:valid_max = 32767s ;
                 brightness_temperature_12um:valid_min = -32767s ;
                 brightness_temperature_12um:_FillValue = -32768s ;
         short brightness_temperature_4um(time, nj, ni) ;
                 brightness_temperature_4um:add_offset = 273.15f ;
                 brightness_temperature_4um:comment = "non L2P core 
field; brightness temperature for 3.7 um channel AVHRR Ch. 3b" ;
                 brightness_temperature_4um:coordinates = "lon lat" ;
                 brightness_temperature_4um:long_name = "brightness 
temperature for 3.7 um channel" ;
                 brightness_temperature_4um:scale_factor = 0.01f ;
                 brightness_temperature_4um:source = "AVHRR channel 3b" ;
                 brightness_temperature_4um:units = "kelvin" ;
                 brightness_temperature_4um:valid_max = 32767s ;
                 brightness_temperature_4um:valid_min = -32767s ;
                 brightness_temperature_4um:_FillValue = -32768s ;

// global attributes:
                 :geospatial_bounds = "POLYGON((   3.520  14.209, 
176.005  20.284, -156.649  15.860,  -23.493   9.963,    3.520 14.209))" ;
                 :geospatial_first_scanline_first_fov_lat = 20.28396f ;
                 :geospatial_first_scanline_first_fov_lon = 176.0049f ;
                 :geospatial_first_scanline_last_fov_lat = 15.86f ;
                 :geospatial_first_scanline_last_fov_lon = -156.6491f ;
                 :geospatial_last_scanline_first_fov_lat = 14.20918f ;
                 :geospatial_last_scanline_first_fov_lon = 3.520287f ;
                 :geospatial_last_scanline_last_fov_lat = 9.962526f ;
                 :geospatial_last_scanline_last_fov_lon = -23.49267f ;
                 :Conventions = "CF-1.6" ;
                 :Metadata_Conventions = "Unidata Dataset Discovery v1.0" ;
                 :acknowledgment = "Please acknowledge the use of these 
data with the following statement: These data were provided by Group for 
High Resolution Sea Surface Temperature (GHRSST) and the National 
Oceanic and Atmospheric Administration (NOAA)." ;
                 :cdm_data_type = "swath" ;
                 :comment = "none" ;
                 :creator_email = "Alex.Ignatov at noaa.gov" ;
                 :creator_name = "Alex Ignatov" ;
                 :creator_url = "http://www.star.nesdis.noaa.gov" ;
                 :date_created = "20190304T214051Z" ;
                 :easternmost_longitude = 180.f ;
                 :file_quality_level = 3s ;
                 :gds_version_id = "02.0" ;
                 :geospatial_lat_resolution = 0.0099f ;
                 :geospatial_lat_units = "degrees_north" ;
                 :geospatial_lon_resolution = 0.0099f ;
                 :geospatial_lon_units = "degrees_east" ;
                 :history = "Created by Advanced Clear-Sky Processor for 
Oceans (ACSPO)-AVHRR at NOAA/NESDIS/OSPO." ;
                 :id = "AVHRR18_G-OSPO-L2P-v2.41" ;
                 :institution = "NOAA/NESDIS/OSPO" ;
                 :keywords = "Oceans > Ocean Temperature > Sea Surface 
Temperature" ;
                 :keywords_vocabulary = "NASA Global Change Master 
Directory (GCMD) Science Keywords" ;
                 :license = "GHRSST protocol describes data use as free 
and open" ;
                 :metadata_link = 
"http://podaac.jpl.nasa.gov/ws/metadata/dataset/?format=iso&shortName=AVHRR18_G-OSPO-L2P-v2.41" 
;
                 :naming_authority = "org.ghrsst" ;
                 :northernmost_latitude = 20.28396f ;
                 :platform = "NOAA-18" ;
                 :processing_level = "L2P" ;
                 :product_version = "2.41" ;
                 :project = "Group for High Resolution Sea Surface 
Temperature" ;
                 :publisher_email = "ghrsst-po at nceo.ac.uk" ;
                 :publisher_name = "The GHRSST Project Office" ;
                 :publisher_url = "http://www.ghrsst.org" ;
                 :references = "Data convention: GHRSST Data 
Specification (GDS) v2.0. Algorithms: ACSPO-AVHRR ATBD (NOAA/NESDIS/STAR)" ;
                 :sensor = "AVHRR_GAC" ;
                 :source = 
"AVHRR_L1b,CMC0.2deg-CMC-L4-GLOB-v2.0,NOAA-NCEP-GFS" ;
                 :southernmost_latitude = -90.f ;
                 :spatial_resolution = "1.1 km at nadir" ;
                 :standard_name_vocabulary = "CF Standard Name Table 
(v26, 08 November 2013)" ;
                 :start_time = "20190304T200000Z" ;
                 :stop_time = "20190304T205959Z" ;
                 :summary = "Sea surface temperature retrievals produced 
by NOAA/NESDIS/OSPO office from AVHRR sensor" ;
                 :time_coverage_end = "20190304T205959Z" ;
                 :time_coverage_start = "20190304T200000Z" ;
                 :title = "AVHRR L2P SST" ;
                 :uuid = "2eaa373c-3ec6-11e9-ac15-f9642917379f" ;
                 :westernmost_longitude = -180.f ;
                 :netcdf_version_id = "4.3.2 of Sep 24 2015 08:51:38 $" ;
}


$ gdalinfo 
NETCDF:20190304200000-OSPO-L2P_GHRSST-SSTsubskin-AVHRR18_G-ACSPO_V2.41-v02.0-fv01.0.nc:sea_surface_temperature
Warning 1: dimension #2 (ni) is not a Longitude/X dimension.
Warning 1: dimension #1 (nj) is not a Latitude/Y dimension.
Driver: netCDF/Network Common Data Format
Files: 
20190304200000-OSPO-L2P_GHRSST-SSTsubskin-AVHRR18_G-ACSPO_V2.41-v02.0-fv01.0.nc
Size is 409, 7200
Coordinate System is `'
Metadata:
   NC_GLOBAL#acknowledgment=Please acknowledge the use of these data 
with the following statement: These data were provided by Group for High 
Resolution Sea Surface Temperature (GHRSST) and the National Oceanic and 
Atmospheric Administration (NOAA).
   NC_GLOBAL#cdm_data_type=swath
   NC_GLOBAL#comment=none
   NC_GLOBAL#Conventions=CF-1.6
   NC_GLOBAL#creator_email=Alex.Ignatov at noaa.gov
   NC_GLOBAL#creator_name=Alex Ignatov
   NC_GLOBAL#creator_url=http://www.star.nesdis.noaa.gov
   NC_GLOBAL#date_created=20190304T214051Z
   NC_GLOBAL#easternmost_longitude=180
   NC_GLOBAL#file_quality_level=3
   NC_GLOBAL#gds_version_id=02.0
   NC_GLOBAL#geospatial_bounds=POLYGON((   3.520  14.209,  176.005 
20.284, -156.649  15.860,  -23.493   9.963,    3.520  14.209))
   NC_GLOBAL#geospatial_first_scanline_first_fov_lat=20.283962
   NC_GLOBAL#geospatial_first_scanline_first_fov_lon=176.00494
   NC_GLOBAL#geospatial_first_scanline_last_fov_lat=15.859998
   NC_GLOBAL#geospatial_first_scanline_last_fov_lon=-156.64908
   NC_GLOBAL#geospatial_last_scanline_first_fov_lat=14.20918
   NC_GLOBAL#geospatial_last_scanline_first_fov_lon=3.5202866
   NC_GLOBAL#geospatial_last_scanline_last_fov_lat=9.9625263
   NC_GLOBAL#geospatial_last_scanline_last_fov_lon=-23.492666
   NC_GLOBAL#geospatial_lat_resolution=0.0098999999
   NC_GLOBAL#geospatial_lat_units=degrees_north
   NC_GLOBAL#geospatial_lon_resolution=0.0098999999
   NC_GLOBAL#geospatial_lon_units=degrees_east
   NC_GLOBAL#history=Created by Advanced Clear-Sky Processor for Oceans 
(ACSPO)-AVHRR at NOAA/NESDIS/OSPO.
   NC_GLOBAL#id=AVHRR18_G-OSPO-L2P-v2.41
   NC_GLOBAL#institution=NOAA/NESDIS/OSPO
   NC_GLOBAL#keywords=Oceans > Ocean Temperature > Sea Surface Temperature
   NC_GLOBAL#keywords_vocabulary=NASA Global Change Master Directory 
(GCMD) Science Keywords
   NC_GLOBAL#license=GHRSST protocol describes data use as free and open
   NC_GLOBAL#Metadata_Conventions=Unidata Dataset Discovery v1.0
NC_GLOBAL#metadata_link=http://podaac.jpl.nasa.gov/ws/metadata/dataset/?format=iso&shortName=AVHRR18_G-OSPO-L2P-v2.41
   NC_GLOBAL#naming_authority=org.ghrsst
   NC_GLOBAL#netcdf_version_id=4.3.2 of Sep 24 2015 08:51:38 $
   NC_GLOBAL#northernmost_latitude=20.283962
   NC_GLOBAL#platform=NOAA-18
   NC_GLOBAL#processing_level=L2P
   NC_GLOBAL#product_version=2.41
   NC_GLOBAL#project=Group for High Resolution Sea Surface Temperature
   NC_GLOBAL#publisher_email=ghrsst-po at nceo.ac.uk
   NC_GLOBAL#publisher_name=The GHRSST Project Office
   NC_GLOBAL#publisher_url=http://www.ghrsst.org
   NC_GLOBAL#references=Data convention: GHRSST Data Specification (GDS) 
v2.0. Algorithms: ACSPO-AVHRR ATBD (NOAA/NESDIS/STAR)
   NC_GLOBAL#sensor=AVHRR_GAC
NC_GLOBAL#source=AVHRR_L1b,CMC0.2deg-CMC-L4-GLOB-v2.0,NOAA-NCEP-GFS
   NC_GLOBAL#southernmost_latitude=-90
   NC_GLOBAL#spatial_resolution=1.1 km at nadir
   NC_GLOBAL#standard_name_vocabulary=CF Standard Name Table (v26, 08 
November 2013)
   NC_GLOBAL#start_time=20190304T200000Z
   NC_GLOBAL#stop_time=20190304T205959Z
   NC_GLOBAL#summary=Sea surface temperature retrievals produced by 
NOAA/NESDIS/OSPO office from AVHRR sensor
   NC_GLOBAL#time_coverage_end=20190304T205959Z
   NC_GLOBAL#time_coverage_start=20190304T200000Z
   NC_GLOBAL#title=AVHRR L2P SST
   NC_GLOBAL#uuid=2eaa373c-3ec6-11e9-ac15-f9642917379f
   NC_GLOBAL#westernmost_longitude=-180
   NETCDF_DIM_EXTRA={time}
   NETCDF_DIM_time_DEF={1,4}
   NETCDF_DIM_time_VALUES=1204574400
   sea_surface_temperature#_FillValue=-32768
   sea_surface_temperature#add_offset=273.14999
   sea_surface_temperature#comment=SST obtained by regression with buoy 
measurements
   sea_surface_temperature#coordinates=lon lat
   sea_surface_temperature#long_name=sea surface skin temperature
   sea_surface_temperature#scale_factor=0.0099999998
   sea_surface_temperature#source=NOAA
sea_surface_temperature#standard_name=sea_surface_skin_temperature
   sea_surface_temperature#units=kelvin
   sea_surface_temperature#valid_max=32767
   sea_surface_temperature#valid_min=-32767
   time#axis=T
   time#calendar=Gregorian
   time#comment=seconds since 1981-01-01 00:00:00
   time#long_name=reference time of sst file
   time#standard_name=time
   time#units=seconds since 1981-01-01 00:00:00
Geolocation:
   LINE_OFFSET=0
   LINE_STEP=1
   PIXEL_OFFSET=0
   PIXEL_STEP=1
   SRS=GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 
84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9108"]],AUTHORITY["EPSG","4326"]]
   X_BAND=1
X_DATASET=NETCDF:"20190304200000-OSPO-L2P_GHRSST-SSTsubskin-AVHRR18_G-ACSPO_V2.41-v02.0-fv01.0.nc":lon
   Y_BAND=1
Y_DATASET=NETCDF:"20190304200000-OSPO-L2P_GHRSST-SSTsubskin-AVHRR18_G-ACSPO_V2.41-v02.0-fv01.0.nc":lat
Corner Coordinates:
Upper Left  (    0.0,    0.0)
Lower Left  (    0.0, 7200.0)
Upper Right (  409.0,    0.0)
Lower Right (  409.0, 7200.0)
Center      (  204.5, 3600.0)
Band 1 Block=409x1024 Type=Int16, ColorInterp=Undefined
   NoData Value=-32768
   Offset: 273.149993896484,   Scale:0.00999999977648258
   Metadata:
     _FillValue=-32768
     add_offset=273.14999
     comment=SST obtained by regression with buoy measurements
     coordinates=lon lat
     long_name=sea surface skin temperature
     NETCDF_DIM_time=1204574400
     NETCDF_VARNAME=sea_surface_temperature
     scale_factor=0.0099999998
     source=NOAA
     standard_name=sea_surface_skin_temperature
     units=kelvin
     valid_max=32767
     valid_min=-32767


---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus



More information about the gradsusr mailing list