Re: plotting correct depth/lat - not points

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Tue May 27 2014 - 15:42:59 MDT

Michael,

This doesn't really look like the output from "ncdump". What command did you type to get this output?

Anyway, part of the issue is that you are doing a calculation on the variable, and storing this to a new variable. This causes all of the metadata, except for the missing value "_FillValue" attribute, to be stripped off the new variable.

The second problem is that you are calling gsn_csm_contour, which only generates contours. If you want contours over a map, you need to call gsn_csm_contour_map.

My suggestion is to do the calculation and store it back in "amoc", and then plot "amoc" instead of "a":

  amoc8 = addfile ("/directory/amoc_08.nc", "r")
  amoc = amoc8->AMOC3
  amoc = (amoc*(1E-6))/1025
. . .

  plot = gsn_csm_contour_map(wks,amoc,res)

If you continue to have problems, then as Karin and Dennis suggested, we need to have more information before we can help. You can do this by inserting these two lines:

print(amoc8) ; prints contents of file, like "ncdump -h"
printVarSummary(amoc) ; prints information about variable

My guess is that you may have to provide some additional lat/lon information before it will be plotted correctly on a map. The above two statements should help us determine what you need.

--Mary

On May 27, 2014, at 8:16 AM, Michael Hemming <michael.hemming@mpimet.mpg.de> wrote:

> Netcdf information (it's from MPIOM)
>
> File format: netCDF
> -1 : Institut Source Ttype Levels Num Gridsize Num Dtype : Parameter name
> 1 : unknown unknown constant 21 1 180 1 F64 : AMOC3
> Grid coordinates :
> 1 : lonlat > size : dim = 180 nx = 0 ny = 180
> LAT_2 : first = -89.5 last = 89.5 inc = 1 degrees_north
> Vertical coordinates :
> 1 : depth_below_sea m : 0 14 26 41 59 80 105 135 175 235 315 415 535 685
> 865 1075 1315 1585 1885 2235 2635
> bounds : -7-7 7-20 20-33.5 33.5-50 50-69.5 69.5-92.5 92.5-120
> 120-155 155-205 205-275 275-365 365-475 475-610
> 610-775 775-970 970-1195 1195-1450 1450-1735 1735-2060
> 2060-2435 2435-2835
> cdo sinfon: Processed 1 variable ( 0.00s )
>
>
> My script:
>
>
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
>
> amoc8 = addfile ("/directory/amoc_08.nc", "r")
> amoc = amoc8->AMOC3
>
> a = (amoc*(1E-6))/1025
>
> wks = gsn_open_wks("x11", "AMOC_plot")
> gsn_define_colormap(wks,"B1WhRe")
>
> res = True
> res@tiMainString = "Atlantic Ocean Meridional Overturning Streamfunction [Sv]"
> res@gsnSpreadColors = True
> res@cnFillOn = True
> res@cnLinesOn = False
> res@trYReverse = True
> ;printVarSummary(amoc8)
>
>
> plot = gsn_csm_contour(wks,a,res)
>
>
> I have also tried using 'lat2d','getfilevaratts' and '@long_name' commands but they didn't seem to work...
>
>
> thanks!
> Michael
>
>
> On 27/05/2014 16:07, Karin Meier-Fleischer wrote:
>> Hi Michael,
>>
>> could you be more specific and send a 'ncdump -h' output from your data file (if it is not to long)
>> and your NCL script. It is impossible to say something which we don't know and can't see.
>>
>> Bye,
>> Karin
>>
>> Am 27.05.2014 um 15:40 schrieb Michael Hemming <michael.hemming@mpimet.mpg.de>:
>>
>>> Is it an attribute problem? (i.e. the fill value is missing?) I tried to use:
>>>
>>> a = getfilevaratts(data,"slp")
>>>
>>> but it gave:
>>>
>>> Variable: amoca
>>> Type: string
>>> Total Size: 8 bytes
>>> 1 values
>>> Number of Dimensions: 1
>>> Dimensions and sizes: [1]
>>> Coordinates:
>>> Number Of Attributes: 1
>>> _FillValue : missing
>>> (0) missing
>>>
>>>
>>>
>>> -------- Original Message --------
>>> Subject: Re: [ncl-talk] plotting correct depth/lat - not points
>>> Date: Mon, 26 May 2014 15:19:24 +0200
>>> From: Michael Hemming <michael.hemming@mpimet.mpg.de>
>>> To: ncl-talk@ucar.edu Talk <ncl-talk@ucar.edu>
>>>
>>> I printed the variable:
>>>
>>> Number of global attributes: 2
>>> Number of Dimension: 3
>>> Number of variables: 4
>>>
>>> res looks like:
>>>
>>> res = True
>>> res@tiMainString = "Sea water potential temperature (Deg C) with depth"
>>>
>>> res@gsnSpreadColors = True
>>> res@cnFillOn = True
>>> res@cnLinesOn = False
>>> res@trYReverse = True
>>>
>>> thanks,
>>> Michael
>>>
>>>
>>> On 26/05/2014 14:34, Dennis Shea wrote:
>>>> ferret must be getting information from somewhere.
>>>> There is too little information in your post to
>>>> provide an answer.
>>>>
>>>> ---
>>>>
>>>> What meta data is associated with the variable 'a' ?
>>>>
>>>> printVarSummary(a)
>>>>
>>>> What does 'res' look like?
>>>>
>>>> ---
>>>>
>>>>
>>>> On 5/26/14, 4:30 AM, Michael Hemming wrote:
>>>>> Hey everyone,
>>>>>
>>>>> I have a netcdf file that looks like this:
>>>>>
>>>>> AMOC: j x k = 180 x 21 = lat x depth (curvilinear grid)
>>>>>
>>>>> I want to create a contour plot that shows AMOC values with depth,
>>>>> however, when I try to do this, it plots lat as 1:180 and depth as 1:21.
>>>>> When using Ferret, I get the correct lat and depth values automatically
>>>>> shown.
>>>>>
>>>>> So my question is: how can I make ncl do what ferret does?
>>>>>
>>>>> after loading in the data and assigning the variable etc... I use:
>>>>>
>>>>>
>>>>> /wks = gsn_open_wks("x11", "AMOC_plot")//
>>>>> //gsn_define_colormap(wks,"B1WhRe")//
>>>>> ////
>>>>> //plot = gsn_csm_contour(wks,a,res)/
>>>>>
>>>>>
>>>>>
>>>>> thanks,
>>>>> Michael
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> 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
>>
>> _______________________________________________________________________
>> Dipl. Geophys. Karin Meier-Fleischer
>> Application Support, Visualization
>>
>> Deutsches Klimarechenzentrum GmbH E-Mail:
>> meier-fleischer@dkrz.de
>>
>> Bundesstrasse 45a Internet: http://www.dkrz.de/
>> 20146 Hamburg Phone: +49 (0)40 460094 126
>> Germany Fax: +49 (0)40 460094 270
>>
>> Geschäftsführer: Prof. Dr. Thomas Ludwig
>> Sitz der Gesellschaft: Hamburg
>> Amtsgericht Hamburg HRB 39784
>>
>>
>>
>
> _______________________________________________
> 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 May 27 15:43:13 2014

This archive was generated by hypermail 2.1.8 : Tue May 27 2014 - 15:45:08 MDT