Project

General

Profile

How to generate a description file from Himawari netCDF file?

Added by Bob Rabin 10 months ago

Hello, I would like to remap Himawari satellite data to equal latitude-longitude grid files.

The expect to use the following command:

cdo remapbil,mygrid -setgrid,gridfile.txt input.nc output.nc

where mygrid describes the latitude-longitude grid file. I would like to know how to generate the description file for the input grid (gridfile.txt).

I tried executing the following command to create a description file, but the output appears to be lacking sufficient information to perform the remapping:

cdo griddes input.nc > gridfile.txt

The output of cdo remapbil gives:
cdo(1) setgrid: Process started
Warning (find_time_vars): Time variable >scan_lines< not found!

cdo remapbil (Abort): Unsupported generic coordinates (Variable: pixel_latitude)!
terminate called without an active exception
Aborted

Note: The original version of input.nc was missing units for "pixel_latitude" and "pixel_longitude. I executed the following command to add these unit descriptors:
ncatted -O -a units,pixel_latitude,c,c,degrees north -a units,pixel_longitude,c,c,degrees east input.nc"

Please see these attached files: input.nc, gridfile.txt, mygrid


Replies (9)

RE: How to generate a description file from Himawari netCDF file? - Added by Ralf Mueller 10 months ago

hi!

you input is VERY far from being nc-conform. So CDO is unlikely to be useful with it. I recommend to use gdal

cheers
ralf

RE: How to generate a description file from Himawari netCDF file? - Added by Karin Meier-Fleischer 10 months ago

Hi Bob,

I've tested to remap the variable ACHA_mode_8_Tc_Lower_Cloud from the file input.nc to a global 0.05x0.05 grid and it works quite well, but you have to do some steps before.

1. add coordinates attribute to the variable

ncatted -a coordinates,ACHA_mode_8_Tc_Lower_Cloud,c,c,"pixel_longitude pixel_latitude" input.nc lower_cloud.nc

2. extract the variable ACHA_mode_8_Tc_Lower_Cloud from input.nc

cdo -selname,ACHA_mode_8_Tc_Lower_Cloud lower_cloud.nc lower_cloud_with_coordinates.nc

3. remap to global 0.05x0.05 degree lonlat grid

cdo -remapbil,global_0.05 lower_cloud_with_coordinates.nc lower_cloud_remap.nc

RE: How to generate a description file from Himawari netCDF file? - Added by Bob Rabin 7 months ago

Karin,

I would like to remap another type of netCDF file. It appears that this file may need to be modified differently than the previous file that you we able to remap.

In this case, I would like to remap the variable "PRES" found in the attached file input2.nc. As before, mygrid describes the latitude-longitude grid file.

Thank you for your help!

-Bob Rabin

input2.nc (28.2 MB) input2.nc

RE: How to generate a description file from Himawari netCDF file? - Added by Karin Meier-Fleischer 7 months ago

Sorry, but I wasn't able to get any correct result.

RE: How to generate a description file from Himawari netCDF file? - Added by Bob Rabin 7 months ago

Thank you for checking.
I think the problem may be that the netCDF doesn't contain arrays of latitude and longitude locations. Instead they are arrays of x,y positions relative to a satellite grid.

RE: How to generate a description file from Himawari netCDF file? - Added by Karin Meier-Fleischer 7 months ago

I guess, you can remap the data to a lonlat grid with CDO but you need to know the correct projection. The following gridfile unfortunately is not fully correct but maybe you can start with it.

ncatted -O -a coordinates,PRES,o,c,"y x" input2.nc input2_coords.nc

gridfile.txt:

gridtype  = projection
gridsize  = 29419776
xsize     = 5424
ysize     = 5424
xname     = x
xlongname = "GOES fixed grid projection x-coordinate" 
xunits    = "radians" 
yname     = y
ylongname = "GOES fixed grid projection y-coordinate" 
yunits    = "radians" 
xfirst    = -0.151844
xinc      = 5.6e-05
yfirst    = 0.151844
yinc      = -5.6e-05
grid_mapping = goes_imager_projection
grid_mapping_name = geostationary
long_name = "GOES-R ABI fixed grid projection" 
perspective_point_height = 35786023.
semi_major_axis = 6378137.
semi_minor_axis = 6356752.31414
inverse_flattening = 298.2572221
latitude_of_projection_origin = 0.
longitude_of_projection_origin = -75.
sweep_angle_axis = "x" 
proj_params = "+proj=geos +h=35786023.0 +lon_0=-75.0 +sweep=x" 

targetgrid.txt:

gridtype  = lonlat
gridsize  = 240000
xsize     = 600
ysize     = 400
xname     = lon
xunits    = "degrees_east" 
yname     = lat
yunits    = "degrees_north" 
xfirst    = -120.
xinc      = 0.1
yfirst    = -55.0
yinc      = 0.1
cdo -b F32 -P 8 -remapnn,targetgrid.txt -setgrid,gridfile.txt -selname,PRES input2_coords.nc outfile.nc

NOAA provides a Python function that uses the GOES-R ABI fixed grid projection to calculate the latitude and longitude values.

https://www.star.nesdis.noaa.gov/atmospheric-composition-training/python_abi_lat_lon.php

So, maybe you better should go with Python.

RE: How to generate a description file from Himawari netCDF file? - Added by Bob Rabin 7 months ago

Thank you! This is very helpful. I will try these suggestions.
-Bob

    (1-9/9)