[GRASS-user] using GDAL to view netcdf files in GRASS

Carbonari, Katie (IS) Katie.Carbonari at ngc.com
Mon Nov 30 16:15:18 EST 2009


Hello. I'm trying to use GDAL to convert my netcdf file into a GTiff so it can be read into GRASS. I tried using  "gdal_translate -of GTiff -b 1 NETCDF:FILE.nc:Outfile Outfile.tiff"
but this won't geolocate my file. I ran the same command, adding -a_ullr -90.32483 42.5327 -58.66088 26.8966, with the coordinates corresponding with the max/min of the lat/lon coordinates of the netcdf file. This is a bit better, with the resulting raster image now being in the general correct area. But the projection is wrong. The file is a Lambert conformal projection. Is there an "easy" way to tell GDAL how to geolocate this file (and for it to get the correct projection)? Or can I geolocate the file after the fact, in GRASS? Any suggestions would be appreciated, I'm getting quite frustrated with displaying netcdf files in GRASS. 

Thanks,
Katie

For more information, here is the header to the netcdf file I'm trying to visualize in GRASS: 
   netcdf d03_heat_stress_2060_08 {
dimensions:
        Time = UNLIMITED ; // (1 currently)
        DateStrLen = 19 ;
        west_east = 198 ;
        south_north = 198 ;
        bottom_top = 27 ;
        bottom_top_stag = 28 ;
        soil_layers_stag = 4 ;
        west_east_stag = 199 ;
        south_north_stag = 199 ;
variables:
        char Times(Time, DateStrLen) ;
        float HSI(Time, south_north, west_east) ;
                HSI:FieldType = 104 ;
                HSI:MemoryOrder = "XY " ;
                HSI:description = "HEAT STRESS INDEX" ;
                HSI:units = "deg C" ;
                HSI:stagger = "" ;
                HSI:coordinates = "XLONG XLAT" ;
        float XLAT(Time, south_north, west_east) ;
                XLAT:FieldType = 104 ;
                XLAT:MemoryOrder = "XY " ;
                XLAT:description = "LATITUDE, SOUTH IS NEGATIVE" ;
                XLAT:units = "degree_north" ;
                XLAT:stagger = "" ;
        float XLONG(Time, south_north, west_east) ;
                XLONG:FieldType = 104 ;
                XLONG:MemoryOrder = "XY " ;
                XLONG:description = "LONGITUDE, WEST IS NEGATIVE" ;
                XLONG:units = "degree_east" ;
                XLONG:stagger = "" ;

// global attributes:
                :TITLE = " OUTPUT FROM WRF V3.1.1 MODEL" ;
                :START_DATE = "2060-10-01_00:00:00" ;
                :SIMULATION_START_DATE = "2059-01-01_00:00:00" ;
                :WEST-EAST_GRID_DIMENSION = 199 ;
                :SOUTH-NORTH_GRID_DIMENSION = 199 ;
                :BOTTOM-TOP_GRID_DIMENSION = 28 ;
                :DX = 12000.f ;
                :DY = 12000.f ;
                :GRIDTYPE = "C" ;
                :DIFF_OPT = 1 ;
                :KM_OPT = 4 ;
                :DAMP_OPT = 0 ;
                :DAMPCOEF = 0.01f ;
                :KHDIF = 0.f ;
                :KVDIF = 0.f ;
                :MP_PHYSICS = 4 ;
                :RA_LW_PHYSICS = 3 ;
                :RA_SW_PHYSICS = 3 ;
                :SF_SFCLAY_PHYSICS = 1 ;
                :SF_SURFACE_PHYSICS = 2 ;
                :BL_PBL_PHYSICS = 1 ;
                :CU_PHYSICS = 1 ;
                :SURFACE_INPUT_SOURCE = 1 ;
                :SST_UPDATE = 1 ;
                :GRID_FDDA = 0 ;
                :GFDDA_INTERVAL_M = 360 ;
                :GFDDA_END_H = 744000 ;
                :GRID_SFDDA = 0 ;
                :SGFDDA_INTERVAL_M = 0 ;
:SGFDDA_END_H = 0 ;
                :SF_URBAN_PHYSICS = 0 ;
                :FEEDBACK = 0 ;
                :SMOOTH_OPTION = 0 ;
                :SWRAD_SCAT = 1.f ;
                :W_DAMPING = 1 ;
                :MOIST_ADV_OPT = 1 ;
                :SCALAR_ADV_OPT = 1 ;
                :TKE_ADV_OPT = 1 ;
                :DIFF_6TH_OPT = 0 ;
                :DIFF_6TH_FACTOR = 0.12f ;
                :OBS_NUDGE_OPT = 0 ;
                :WEST-EAST_PATCH_START_UNSTAG = 1 ;
                :WEST-EAST_PATCH_END_UNSTAG = 198 ;
                :WEST-EAST_PATCH_START_STAG = 1 ;
                :WEST-EAST_PATCH_END_STAG = 199 ;
                :SOUTH-NORTH_PATCH_START_UNSTAG = 1 ;
                :SOUTH-NORTH_PATCH_END_UNSTAG = 198 ;
                :SOUTH-NORTH_PATCH_START_STAG = 1 ;
                :SOUTH-NORTH_PATCH_END_STAG = 199 ;
                :BOTTOM-TOP_PATCH_START_UNSTAG = 1 ;
                :BOTTOM-TOP_PATCH_END_UNSTAG = 27 ;
                :BOTTOM-TOP_PATCH_START_STAG = 1 ;
                :BOTTOM-TOP_PATCH_END_STAG = 28 ;
                :GRID_ID = 3 ;
                :PARENT_ID = 2 ;
                :I_PARENT_START = 18 ;
                :J_PARENT_START = 24 ;
                :PARENT_GRID_RATIO = 3 ;
                :DT = 40.f ;
                :CEN_LAT = 35.79343f ;
                :CEN_LON = -76.1796f ;
                :TRUELAT1 = 33.f ;
                :TRUELAT2 = 45.f ;
                :MOAD_CEN_LAT = 40.f ;
                :STAND_LON = -97.f ;
                :POLE_LAT = 90.f ;
                :POLE_LON = 0.f ;
                :GMT = 0.f ;
                :JULYR = 2060 ;
                :JULDAY = 275 ;
                :MAP_PROJ = 1 ;
                :MMINLU = "USGS" ;
                :NUM_LAND_CAT = 24 ;
                :ISWATER = 16 ;
                :ISLAKE = -1 ;
                :ISICE = 24 ;
                :ISURBAN = 1 ;
                :ISOILWATER = 14 ;
data:

 Times =
  "" ;

 HSI =
  -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, 
    -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, 
    -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, -999, 
    -999, -999, -999, 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/grass-user/attachments/20091130/6fca6ad7/attachment-0001.html


More information about the grass-user mailing list