[ncl-talk] gsn_csm_contour_map_ce error, flat field
Alan Brammer
abrammer at albany.edu
Tue Oct 7 17:35:12 MDT 2014
The error gives you a good starting point. So the coords of d are yc and
xc which have no information associated with them. You've read in lat and
lon, you just need to match that up to the plotting variable. It looks
like the coords are 2 dimensional (maybe even 3 dimensional? )
Take a look at example 3 here:
https://www.ncl.ucar.edu/Applications/raster.shtml
Based on that I would do the below. There may be some more resources
needed which will be in that example, or the 2 extra lines below may do it
for you.
...
d at lat2d = new_lat(111,:,:)
d at lon2d = new_lon(111,:,:)
plot = gsn_csm_contour_map_ce(wks,d(111,:,:), res)
Good Luck,
Alan Brammer
On Tue, Oct 7, 2014 at 7:24 PM, David Adams <dave.k.adams at gmail.com> wrote:
> Hi NCLers (sorry if multiply posted, I am having trouble with my
> registration)
>
> I am trying to plot of map of GOES IR Brightness temperature, but am
> getting a flat field. When I print the data they're fine, the values are
> correct.
>
> The file I am using I created with
> ncrcat
> to put all of the 15 minutes GOES netcdf images into a daily file. Maybe
> I erred here, maybe something wrong with the time dimension.
>
> Here is ncdump -h of the file I want to plot
>
> -------------------------------------------------------------------------------
> ncdump -h test.nc
> netcdf test {
> dimensions:
> yc = 221 ;
> xc = 141 ;
> time = UNLIMITED ; // (130 currently)
> variables:
> float new_temp(time, yc, xc) ;
> new_temp:time = 1372896900 ;
> new_temp:units = "K" ;
> new_temp:coordinates = "lon lat" ;
> new_temp:type = "GVAR" ;
> new_temp:long_name = "Temperature" ;
> float new_lat(time, yc, xc) ;
> new_lat:units = "degrees_north" ;
> new_lat:long_name = "lat" ;
> float new_lon(time, yc, xc) ;
> new_lon:units = "degrees_east" ;
> new_lon:long_name = "lon" ;
> int time(time) ;
> time:units = "seconds since 2013-185 00:15" ;
>
> // global attributes:
> :history = "Mon Oct 6 18:26:36 2014: ncrcat
> goes13_4_2013_185_0015_subset.nc ............
> goes13_4_2013_185_2345_subset.nc test.nc\n",
> "Mon Oct 6 18:24:58 2014: ncatted -O -a
> units,time,c,c,seconds since 2013-185 00:15 out.nc\n",
> "Mon Oct 6 18:24:58 2014: ncap2 -O -v -s
> time=array(0,0,$time) out.nc\n",
> "Mon Oct 6 18:24:58 2014: ncrename -O -d record,time out.nc"
> ;
> :nco_openmp_thread_number = 1 ;
> }
>
> ----------------------------------------------------------------------------------------------------------------------
>
> Here is the map plotting code
>
> -----------------------------------------------------------------------------------------------------------------------
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
>
> ;*********************************
> ; read variable
> ;*********************************
>
> f = addfile("test.nc","r")
> d = f->new_temp ; float data(time, yc, xc) ;
> ; data:type = "IR" ;
> printVarSummary(d)
> ;*********************************
> ; Fix the variable so it has recognizable missing data
> ;*********************************
> new_lat = f->new_lat
> new_lon = f->new_lon
>
> ;*********************************
> ; create plot
> ;*********************************
> pltType = "pdf" ; "ps", "eps", "pdf", "png"
> pltDir = "./"
>
> wks = gsn_open_wks(pltType, "test")
> gsn_define_colormap(wks,"BlAqGrYeOrReVi200"); choose a color map
>
> res = True
> res at cnFillOn = True ; turn on color
> res at cnFillMode = "RasterFill" ; cell mode
> res at cnLinesOn = False ; Turn off contour lines
> res at gsnSpreadColors = True ; use full colormap
> res at gsnAddCyclic = False ; data not cyclic
> res at gsnMaximize = True ; ps, pdf, pdf
> res at pmTickMarkDisplayMode = "Always" ; use NCL default
> res at lbLabelAutoStride = True ; let NCL decide spacing
> res at mpMinLatF = 23.0 ; ; region to zoom in on
> res at mpMaxLatF = 33.00 ;
> res at mpMinLonF = -115.200 ;
> res at mpMaxLonF = -102.20 ;
> res at mpFillOn = False
> res at mpOutlineBoundarySets = "National" ; turn on country boundaries
> res at trGridType = "TriangularMesh" ; Necessary b/c lat, lon
> res at lbLabelStride = 5.0 ; every other label bar label
>
> plot = gsn_csm_contour_map_ce(wks,d(111,:,:), res)
>
> ----------------------------------------------------------------------------------------------------
>
> Also, I am getting these warnings,
>
> 0) check_for_y_lat_coord: Warning: Data either does not contain a valid
> latitude coordinate array or doesn't contain one at all.
> (0) A valid latitude coordinate array should have a 'units' attribute
> equal to one of the following values:
> (0) 'degrees_north' 'degrees-north' 'degree_north' 'degrees north'
> 'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg north'
> (0) check_for_lon_coord: Warning: Data either does not contain a valid
> longitude coordinate array or doesn't contain one at all.
> (0) A valid longitude coordinate array should have a 'units' attribute
> equal to one of the following values:
> (0) 'degrees_east' 'degrees-east' 'degree_east' 'degrees east'
> 'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE' 'deg east'
>
> Any ideas?
>
> thanks in advance,
> Dave
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20141007/8a5fb1ae/attachment.html
More information about the ncl-talk
mailing list