Scheduled Downtime
On Tuesday 24 October 2023 @ 5pm MT the forums will be in read only mode in preparation for the downtime. On Wednesday 25 October 2023 @ 5am MT, this website will be down for maintenance and expected to return online later in the morning.
Normal Operations
The forums are back online with normal operations. If you notice any issues or errors related to the forums, please reach out to help@ucar.edu

Very quick question about Paleotoolkit: gridkmt_nc2bin.f90

minminfu

Member
Hi NCAR paleo friends,

Recently I am using the NCAR paleotoolkit to create a binary KMT file from a .nc one.

I used this code:


However, when I look at Line 37, this code seems to skip one horizontal row of the .nc file when writing to a binary file. The record length is also shortened accordingly at Ln.39. This seems a bit odd, but perhaps there is a simple reason for this. Could somebody explain? Just want to make sure that everything is built correctly on my end.

Cheers,
Minmin
 

minminfu

Member
A bit of further context. I tried using "gridkmt_nc2bin" utility to convert my binary file back into an NC, and it added an extra row. So if I am starting with a netcdf file without an extra row to begin with, perhaps I should modify gridkmt_nc2bin.f90 to not skip any rows?
 

macarew

Sophia Macarewich
New Member
Hello Minmin,

I believe that the extra row is added to the southern edge of the netCDF file for plotting purposes. I have an older version of a file that converts the KMT binary to netCDF (see /glade/work/macarew/paleo_setup/ocn/mk_ocn_grid/LPIA5/grid_bin2nc.f90) that states the following:

! Horizontal grid points
! To display the horizontal grid correctly we need the coordinates
! of the points at the 'northeast' corner of every T-cell. This is
! sufficient for the east-west plotting because the coordinates
! wrap around the globe. Along the 'southern' edge, however, we
! need an extra row of coordinates. These could be estimated from
! the HTE/HTN values of the cells, but we read them from a pre-existing
! binary file produced for the purpose of plotting.
! inquire(iolength=io_record_length) plot_array(1:dim1, 0:dim2)
!D print *, ' Record length for plot file ', io_record_length

I'm not sure if this is exactly the case in this script you are referring to, but you should be able to add one row to the southern edge of your KMT netCDF and the script will remove that extra southern row and convert it to binary.

Hope that helps,
Sophia
 
Top