# Re: four dimensions not three

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed Jan 26 2011 - 06:57:18 MST

The following is lifted from examples at
http://www.ncl.ucar.edu/Applications/

===

x = f->X ; 4D

dimx = dimsizes(x)
ntim = dimx(0)
klev = dimx(1)

wks = gsn_open_wks("ps" ,"donna") ; open a ps file
gsn_define_colormap(wks,"BlAqGrYeOrRe") ; choose colormap

res = True ; plot mods desired
res@cnFillOn = True ; turn on color fill
res@cnLinesOn = False ; turn of contour lines
res@gsnSpreadColors = True ; use full range of color map
res@lbLabelAutoStride = True
;;res@pmTickMarkDisplayMode = "Always"; use NCL default lat/lon labels
;;res@mpMinLatF = min(x&lat) ; range to zoom in on
;;res@mpMaxLatF = max(x&lat)
;;res@mpMinLonF = min(x&lon)
;;res@mpMaxLonF = min(x&lon)

do nt=0,ntim-1
do kl=0,klev-1
;;res@gsnCenterString = depth(kl)
plot = gsn_csm_contour_map_ce(wks,(nt,kl,:,:), res)
end do
end do

On 1/26/11 6:46 AM, donna Cote wrote:
> (Thanks for the reply Dennis!) Ok, now when I want to plot or map out
> this 4D data (like with gsn_csm_contour_map), I will end up only
> plotting 3D at a time. Is that right? I'm thinking I can "map" out the
> Lat, Lon, and Depth for Salinity (at a time step at a time, here it's
> each hour). So my question turns into: how do I use gsn_csm_contour_map
> with four "things" to plot instead of three?
>
> -Donna
>
> On 1/25/11 1:43 PM, Dennis Shea wrote:
>>
>> elev = fi->Elevation ; ( Time, Latitude, Longitude )
>> printVarSummary(elev)
>>
>> or
>>
>> elev = fi->Elevation(0,:,:) ; ( Latitude, Longitude )
>> printVarSummary(elev)
>>
>> ===
>> http://www.ncl.ucar.edu/Applications/regrid.shtml
>> Example 13
>>
>> Good luck
>>
>> On 01/25/2011 11:20 AM, donna Cote wrote:
>>> Howdy all, I have a set of data to store in a PostGIS database and to
>>> use to create images. I've looked at a bathymetry example which I
>>> grabbed from www.arsc.eu/~kate/grids/grid_cdf.ncl as well as the
>>> native_5.ncl example on the NCL web site. I have attached a sample
>>> topography.gif and its associated topography.nc (separate from the
>>> ias_2010060112.nc file which is 37Mb).
>>>
>>> Now, I'm rusty with my ncl and could use some help and/or pointers. I'm
>>> sure someone has already worked with data like this. I'm stuck on the
>>> lines in the example native_5.ncl script which are:
>>> field1 = file1->\$FIELDNAME1\$(TIME1,::-1,:)
>>>
>>> A summary of this data looks like this:
>>>
>>> filename: ias_2010060112.nc
>>> variable type dimension long_name units
>>> --------------------------------------------------------------
>>> Time integer 1D Elapse Time hour
>>> (Notes: start 2010-06-01 00:00:00 FORM YYYY-MM-DD hh:mm:ss)
>>> Longitude float 1D Longitude deg E
>>> Latitude float 1D Latitude deg N
>>> Depth float 1D Depth m
>>> Elevation float 3D Surface Elevation m
>>> dimensions: Time, Latitude, Longitude
>>> Temperature float 4D Potential Temperature deg C
>>> dimensions: Time, Depth, Latitude, Longitude
>>> Salinity float 4D Salinity ppt
>>> dimensions: Time, Depth, Latitude, Longitude
>>> U-Velocity float 4D U-component Velocity m/s
>>> dimensions: Time, Depth, Latitude, Longitude
>>> V-Velocity float 4D V-component Velocity m/s
>>> dimensions: Time, Depth, Latitude, Longitude
>>> Bottom_U-Velcity float 3D U-Velocity 100m above bottom m/s
>>> dimensions: Time, Latitude, Longitude
>>> Bottom_V-Velcity float 3D V-Velocity 100m above bottom m/s
>>> dimensions: Time, Latitude, Longitude
>>> MLD float 3D Surface Mixed-Layer Depth m
>>> dimensions: Time, Latitude, Longitude
>>>
>>>
>>> I have a filedump here:
>>>
>>> \$ ncl_filedump nrl_iasnfs_2010060112.nc
>>> University Corporation for Atmospheric Research
>>> NCAR Command Language Version 5.1.1
>>> The use of this software is governed by a License Agreement.
>>> See http://www.ncl.ucar.edu/ for more details.
>>> Variable: f (file variable)
>>>
>>> filename: nrl_iasnfs_2010060112
>>> path: nrl_iasnfs_2010060112.nc
>>> file global attributes:
>>> source : NRL_IASNFS/Ko
>>> title : GOMEX_Forecast_Daily_Average
>>> dimensions:
>>> Time = 1
>>> Longitude = 401
>>> Latitude = 261
>>> Depth = 22
>>> variables:
>>> integer Time ( Time )
>>> long_name : Elapse Time
>>> units : hour
>>> FORTRAN_format : i8
>>> start : 2010-06-01 00:00:00
>>> FORM : YYYY-MM-DD hh:mm:ss
>>>
>>> float Longitude ( Longitude )
>>> long_name : Longitude
>>> units : deg E
>>> FORTRAN_format : f8.3
>>>
>>> float Latitude ( Latitude )
>>> long_name : Latitude
>>> units : deg N
>>> FORTRAN_format : f8.3
>>>
>>> float Depth ( Depth )
>>> long_name : Depth
>>> units : m
>>> FORTRAN_format : f8.3
>>>
>>> float Elevation ( Time, Latitude, Longitude )
>>> long_name : Surface Elevation
>>> units : m
>>> FORTRAN_format : f8.3
>>> _FillValue : -99
>>>
>>> float Temperature ( Time, Depth, Latitude, Longitude )
>>> long_name : Potential Temperature
>>> units : deg C
>>> FORTRAN_format : f8.3
>>> _FillValue : -99
>>>
>>> float Salinity ( Time, Depth, Latitude, Longitude )
>>> long_name : Salinity
>>> units : ppt
>>> FORTRAN_format : f8.3
>>> _FillValue : -99
>>>
>>> float U-Velocity ( Time, Depth, Latitude, Longitude )
>>> long_name : U-component Velocity
>>> units : m/s
>>> FORTRAN_format : f8.3
>>> _FillValue : -99
>>>
>>> float V-Velocity ( Time, Depth, Latitude, Longitude )
>>> long_name : V-component Velocity
>>> units : m/s
>>> FORTRAN_format : f8.3
>>> _FillValue : -99
>>>
>>> float Bottom_U-Velcity ( Time, Latitude, Longitude )
>>> long_name : U-Velocity 100m above bottom
>>> units : m/s
>>> FORTRAN_format : f8.3
>>> _FillValue : -99
>>>
>>> float Bottom_V-Velcity ( Time, Latitude, Longitude )
>>> long_name : V-Velocity 100m above bottom
>>> units : m/s
>>> FORTRAN_format : f8.3
>>> _FillValue : -99
>>>
>>> float MLD ( Time, Latitude, Longitude )
>>> long_name : Surface Mixed-Layer Depth
>>> units : m
>>> FORTRAN_format : f8.1
>>> _FillValue : -99
>>>
>>> \$
>>>
>>>
>>>
>>> _______________________________________________
>>> 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
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Jan 26 06:57:24 2011

This archive was generated by hypermail 2.1.8 : Mon Jan 31 2011 - 10:38:24 MST