[ncl-talk] error in printing latitude and longitude

Karin Meier-Fleischer meier-fleischer at dkrz.de
Fri Feb 16 00:00:42 MST 2018


Hi,

your xlat and xlon are 2-dimensional. Try

print(sprintf("%8.4f",xlat(:,0))   +" " \
      +sprintf("%8.4f",xlat(0,:))   +" " \
      +sprintf("%8.4f",xlon(:,0))   +" " \
      +sprintf("%8.4f",xlon(0,:)) +" " \
      +sprintf("%5.1f",mtmp(0,:,:)) +" " \
      +sprintf("%5.2f",evop(0,:,:)))

-Karin

Am 16.02.18 um 02:52 schrieb jagan TNAU:
> Hello,
>
> Using the following scripts I want to print latitude and longitude 
> along with variables.
> ;----------------------------------------------------------------------
> check.ncl
> ; Writting ERA netcdf to ASCII
> ;----------------------------------------------------------------------
> ; This script uses "sprintf" and extract data from file
> ;----------------------------------------------------------------------
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> begin
> ;*************************
> ; read in data
> ;*************************
>   srf = addfile("1980_jan.nc <http://1980_jan.nc>","r")
>
>   prec = srf->tp
>   sshs = srf->sund
>   ssrn = srf->ssr
>   evpn = srf->e
>   temp = srf->t2m
>   dwpt = srf->d2m
>   sst  = srf->sst
>   u10m = srf->u10
>   time = srf->time
>   xlat = srf->latitude
>   xlon = srf->longitude
>   mtmp = (((temp*0.000232882282352021) + (292.749517347921)) - 273.15) 
> ; temp in C
>   evop = (((evpn*9.12010062706439e-08) + (0.00290678973604684)) * 
> (1000)) ; evaporation in mm
>
>    print(sprintf("%8.4f",xlat(:,:)) +" " \
>           +sprintf("%8.4f",xlon(:,:)) +" " \
>           +sprintf("%5.1f",mtmp(0,:,:)) +" " \
>           +sprintf("%5.2f",evop(0,:,:)))
> end
> ;------------------------------------------------------
>
> The following is the Error
>
> fatal:Number of subscripts do not match number of dimensions of 
> variable,(2) Subscripts used, (1) Subscripts expected
>
>
> I used to print latitude and longitude using different netcdf file.
>
>
> The variable got printed and I am unable to print lat and lon. The 
> attached netcdf file was used.
>
>
> Can someone to help me to solve
>
>
> -- 
> With regards
>
> Dr.R.Jagannathan
> Professor & Former Dean
> Tamil Nadu Agricultural University
> Coimbatore - 641 003 India
>
> PHONE:  Mob: +91 94438 89891
>
> DO NOT PRINT THIS E-MAIL UNLESS NECESSARY. THE ENVIRONMENT CONCERNS US 
> ALL.
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

-- 
Dipl. Geophys. Karin Meier-Fleischer
Visualization, NCL, CDO
Application Support

Deutsches Klimarechenzentrum GmbH (DKRZ)
Bundesstrasse 45a - D20146 Hamburg - Germany

Phone:    +49 (0)40 460094 126
Fax:      +49 (0)40 460094 270
E-Mail:   meier-fleischer at dkrz.de
URL:      www.dkrz.de

Geschäftsführer: Prof. Dr. Thomas Ludwig
Sitz der Gesellschaft: Hamburg
Amtsgericht Hamburg HRB 39784

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180216/d949c2b6/attachment.html>


More information about the ncl-talk mailing list