longitude/latitude problems in the output file after using linint2_Wrap

From: Montane Caminal, Francesc <fmontane_at_nyahnyahspammersnyahnyah>
Date: Wed Feb 20 2013 - 14:28:04 MST

Hello,

I reversed the latitude of my original file to use the $B!H(Blinint2_Wrap$B!I(B function because this function wants the grid to be south-to-north (see script below). However, after creating a new output file with the interpolated values to the new spatial resolution (from 0.5x0.5 to 1x1), something strange happened to the coordinates in the new file, and it seems like longitude and latitude were switched or similar (see attached pic of the spatial pattern of the output data).
Attached is my original netcdf file and the NCL script that I used (see below).
Could anyone please help me to find where the error lies?
Did I forget to include any additional line to avoid the problem with the coordinates in the output file? I guess I do not need to reverse the latitude again before creating the output file.

Any help will be very appreciated!
Thanks,

Francesc

INTERPOLATED VALUES IN THE NEW FILE:

[cid:ad875915-2df7-47fd-a8d4-cf5069e8e578]

SCRIPT:

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"

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"

begin

print("reading the variables")

setfileoption("nc","MissingToFillValue",False)

a = addfile ("/home/ecolab/CABLE_forcing1/cruncep_tair_2010_1time.nc", "r")

temp=a->y

printVarSummary(temp)

temp@_FillValue = -9.99999979021477e+33

temp@missing_value = temp@_FillValue

temp = temp (::-1,:)

printVarSummary(temp)

;create a sequence for the new values of lat

newlat=fspan(-89.50,89.50,180)

;create a sequence for the new values of lon

newlon=fspan(-179.50,179.50,360)

newlat@units = "degrees_east"

newlon@units = "degrees_north"

$B!!(B

print("new values for long and lat created")

$B!!(B

newtemp=linint2_Wrap(temp&lon,temp&lat,temp,True,newlon,newlat,0)

printVarSummary(newtemp)

print("newtemp: min="+min(newtemp)+" max="+max(newtemp))

newtemp!0 = "lat"

newtemp!1 = "lon"

newtemp&lat = newlat

newtemp&lon = newlon

$B!!(B

fout=addfile("cruncep_tair_1x1_2010_1time.nc","c")

fout@title="Air temperature in K and interpolated into 1x1 spatial resolution for 1 time"

fout->y=newtemp

$B!!(B

end

_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk

Received on Wed Feb 20 14:28:21 2013

This archive was generated by hypermail 2.1.8 : Thu Feb 21 2013 - 11:26:43 MST