Re: How to fix this image

From: Ipshita Majhi <ipmajhi_at_nyahnyahspammersnyahnyah>
Date: Tue Jul 22 2014 - 13:00:28 MDT

Hi Karen,
Thank you for the information it helped me a lot. I have the plot in place
. I need to now put boxes with defined latitude and longitude and extract
the snow cover extent data. Do you know how to do it

Variable:sce
Type:byte
Total Size:7744 bytes
               :7744 bytes
Number of dimensions :2
Dimesions and sizes: [rows | 88]X [cols | 88]
Coordinates :
Number of attributes:9
time:7
long_name:NOAA/NCDC Climate Date Record of snow cover extent
standard_name:surface_snow_
binary_mask
grid_mapping:coord_system
coordinates:longitude latitude time snow_cover_threshold
valid range: (0,1)
flag_values : (0,1)
flag_meanings:no_snow snow_covered
_FillValue: -9

*************
Variable:lat
Type:double
Total Size : 61952 bytes
                  7744 values
Number of Dimensions :2
Dimensions and sizes: [rows | 88] X [cols | 88]
Coordinates:
Number of Attributes:5
standard_name: latitude
long_name: latitude of cell center in half mesh grid, based on NOAA NMC
Limited Area Fine Mesh Grid
Units : degree_north
valid_range : (0,90)
_FillValue: -999

************
Variable: lon
Type : double
Total size: 61952 bytes
                7744 values
Number of Dimensions: 2
Dimensions and sizes :[rows | 88] X [ cols | 88]
Coordinates:
Number of Attributes :5
standard_name: longitude
long_name: longitude of cell center in half mesh grid, base on NOAA NMC
Limited Area Fine Mesh grid unites degrees_east
valid_range(-180,180)
_FillValue:: -999


On Tue, Jul 22, 2014 at 12:38 AM, Karin Meier-Fleischer <
meier-fleischer@dkrz.de> wrote:

> Hi Ipshita,
>
> if I'm understanding your problem right it is a latitude/longitude proble=
m
> that you get your data displayed in a square region instead of plotting
> each grid box at the correct lat/lon position.
> I don't really understand some parts of your script because it is
> difficult to help without knowing your data. So, please send a
> printVarSummary(sce), but I tried to get into your script and made some
> corrections.
>
> ;*******************************************
> 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"
>
> a =addfile("~/Documents/Snow_cover_IMS/nhsce_v01r01_19661004_20140602.n=
c
> ","r")
> sce=a->snow_cover_extent(0,:,:)
>
> lat=a->latitude ;-- if you want the complete array you
> don't have to use (:,:)
>
> print(lat(:,1))
>
> lon=a->longitude ;-- if you want the complete array you
> don't have to use (:,:)
>
>
> ;print(sce)
> ;print("Hello")
> ;printVarSummary(sce)
> ;printVarSummary(lat)
> ;printVarSummary(lon)
>
> ;;; delete_VarAtts(sce, -1) ;-- why are you deleting all variable
> attributes??
>
> ;Attaching variables
> ;;sce!0="lat2d" ;-- no
> ;;sce!1="lon2d" ;-- no
>
>
> sce@lat2d=lat
> sce@lon2d=lon
>
> printVarSummary(sce)
>
> ; Plotting code
>
> wks = gsn_open_wks("ps","sce_ims")
> gsn_define_colormap(wks,"default")
>
> res = True
> res@cnFillOn = True
> res@cnLinesOn = False
> res@cnLineLabelsOn = False
> res@cnFillMode = "rasterfill"
> res@cnMissingValFillColor = 28 ; "gray"
> ;
> ; Since the data is categorical, values between the categories need to be
> ; excluded. Use Explicit level selection to accomplish this.
> ;
> res@cnLevelSelectionMode = "explicitlevels"
> res@cnLevels = (/ 0.99,1.99, 2.99, 3.99, 4.99 /)
> res@cnFillColors = (/ 1, 4, 19, 6, 0, 1 /) ; (/"black", "blue", "green=
",
> "yellow", "white", "black" /)
> res@lbLabelAlignment = "boxcenters"
> res@lbLabelStrings = (/ "water", "land", "ice", "snow" /)
> ;
> ; First draw the plot without projecting into map coordinates.
> ; This has the drawback that only index values are used as tick marks
> ; but it is fast
> ;
> res@gsnPolar = "NH" ; specify the hemisphere
> plot = gsn_csm_contour_map_polar(wks,sce,res) ; create the plot
> ;*******************************************
>
> Hope this will help,
> Karin
>
>
> Am 21.07.14 20:57, schrieb Ipshita Majhi:
>
> I have the Print Var summary. I was wondering how to remove the black
> background. I want put boxes around the arctic extract the data specified
> by those boxes based on those latitude and longitude
>
>
>
> On Sat, Jul 19, 2014 at 8:40 AM, Alan Brammer <abrammer@albany.edu> wrote=
:
>
>> If your file is the same as the one I just pulled from the below
>> location. Then snow_cover_extent apparently only has 2 values (0 or 1) =
for
>> no_snow or snow_covered.
>>
>>
>> ftp://cdr.ncdc.noaa.gov/cdr/snowcover/nhsce_v01r01_19661004_20140630.nc
>>
>>
>> Check a ncl_filedump of the file and you’ll possibly see the be=
low:
>>
>> byte snow_cover_extent ( time, rows, cols )
>> long_name : NOAA/NCDC Climate Data Record of snow cover extent
>> standard_name : surface_snow_binary_mask
>> grid_mapping : coord_system
>> coordinates : longitude latitude time snow_cover_threshold
>> valid_range : ( 0, 1 )
>> flag_values : ( 0, 1 )
>> flag_meanings : no_snow snow_covered
>> _FillValue : -9
>>
>>
>>
>> If the contour levels wasn’t the issue, reply to the list with =
more
>> specifics.
>>
>>
>>
>> Alan.
>>
>>
>>
>> ##############################
>> Alan Brammer,
>> PhD Student,
>>
>> Department of Atmospheric and Environmental Sciences,
>> University at Albany, State University of New York, Albany, NY, 12222
>> abrammer@albany.edu
>> ##############################
>>
>> On Jul 18, 2014, at 8:04 PM, Ipshita Majhi <ipmajhi@alaska.edu> wrote:
>>
>> I have plotted snow cover data and I have attached lat and lon to it
>> and when I plot I get this image
>>
>> Here is my 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"
>>
>> a =addfile("~/Documents/Snow_cover_IMS/nhsce_v01r01_19661004_20140602.=
nc
>> ","r")
>> sce=a->snow_cover_extent(0,:,:)
>>
>> lat=a->latitude(:,:)
>>
>> print(lat(:,1))
>>
>> lon=a->longitude(:,:)
>> ;print(sce)
>> ;print("Hello")
>> ;printVarSummary(sce)
>> ;printVarSummary(lat)
>> ;printVarSummary(lon)
>>
>> delete_VarAtts(sce, -1)
>>
>> ;Attaching variables
>> sce!0="lat2d"
>> sce!1="lon2d"
>>
>> sce@lat2d=lat
>> sce@lon2d=lon
>>
>>
>>
>> printVarSummary(sce)
>>
>>
>> ; Plotting code
>>
>> wks = gsn_open_wks("ps","sce_ims")
>> gsn_define_colormap(wks,"default")
>>
>>
>> res = True
>> res@cnFillOn = True
>> res@cnLinesOn = False
>> res@cnLineLabelsOn = False
>> res@cnFillMode = "rasterfill"
>> res@cnMissingValFillColor = 28 ; "gray"
>>
>> ;
>> ; Since the data is categorical, values between the categories need to b=
e
>> ; excluded. Use Explicit level selection to accomplish this.
>> ;
>>
>> res@cnLevelSelectionMode = "explicitlevels"
>> res@cnLevels = (/ 0.99,1.99, 2.99, 3.99, 4.99 /)
>> res@cnFillColors = (/ 1, 4, 19, 6, 0, 1 /) ; (/"black", "blue", "green=
",
>> "yellow", "white", "black" /)
>> res@lbLabelAlignment = "boxcenters"
>> res@lbLabelStrings = (/ "water", "land", "ice", "snow" /)
>>
>> ;
>> ; First draw the plot without projecting into map coordinates.
>> ; This has the drawback that only index values are used as tick marks
>> ; but it is fast
>> ;
>> res@gsnPolar = "NH" ; specify the hemispher=
e
>> plot = gsn_csm_contour_map_polar(wks,sce,res) ; create the plot
>>
>>
>> What is missing?
>>
>> <sce_ims.ps>_______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>

Received on Tue Jul 22 07:00:35 2014

This archive was generated by hypermail 2.1.8 : Wed Jul 23 2014 - 15:33:46 MDT