Project

General

Profile

lon/lat gridfile to rotated poles

Added by Mara Antonella over 2 years ago

Hi everyone,

how I can convert a file with lon/lat grid type to rotated poles? Practically, I want the attributes "xdimname = rlon" and "ydimname = rlat" in my file.

I attached a .nc file with the format I want (final.nc)
and a .nc file with the format that I already have in file (ens_mean_final.nc).
All in all, I want the two files to look similar when it comes to grid descriptions.

Note that between the two files xvals and yvals, I want to keep the values of ens_mean_final.nc

Thanks a lot I hope it was not too complicated.


Replies (11)

RE: lon/lat gridfile to rotated poles - Added by Karin Meier-Fleischer over 2 years ago

Hi Mara,

you can use the final.nc file to interpolate the data from ens_mean_final.nc to its grid.

cdo remapnn,final.nc ens_mean_final.nc ens_remapped.nc

-Karin

RE: lon/lat gridfile to rotated poles - Added by Mara Antonella over 2 years ago

Thanks for your response,
Here is my script but when I run it, it returns "cdo (Abort): Unprocessed Input, could not process all Operators/Files"

#!/bin/bash

#/home/draxis/anaconda3/condabin/conda init bash

#source /home/draxis/anaconda3/condabin/conda/activate /home/draxis/anaconda3/envs/nexus_env

export path_merged=/mnt/data/historical_colombia/prec/merged
export path_ex=/mnt/data/europe_historical/prec/merged_danube

cdo remapnn, ${path_ex}/final.nc ${path_merged}/ens_mean_final.nc ${path_merged}/ens_remapped.nc

Do you have any idea what I am doing wrong?
Thank you!

RE: lon/lat gridfile to rotated poles - Added by Karin Meier-Fleischer over 2 years ago

It seems that you have a blank character between 'remapnn,' and '${path_ex}'.

Try

cdo remapnn,${path_ex}/final.nc ${path_merged}/ens_mean_final.nc ${path_merged}/ens_remapped.nc

RE: lon/lat gridfile to rotated poles - Added by Mara Antonella over 2 years ago

Yes that's right thank you. However, it doesn't solve my problem. I want the format of the file "final.nc", but with different coordinates because is a different domain. "final.nc" is for Europe and the file that I want to recreate (ens_mean_final.nc) is for S. America. Any idea? Thank you !

RE: lon/lat gridfile to rotated poles - Added by Mara Antonella over 2 years ago

Maybe something with the attribute "proj_params" ?

RE: lon/lat gridfile to rotated poles - Added by Karin Meier-Fleischer over 2 years ago

Why do you want to interpolate the input file?
To which excact grid do you want to interpolate your data?
For a rotated grid you need the position of the rotated North or South pole.

RE: lon/lat gridfile to rotated poles - Added by Mara Antonella over 2 years ago

I have a dataset of precipitation for a part of South America and when I plot the results they seem odd. Maximum precipitation is where should be minimum and minimum precipitation when it should be maximum according to the climatology of the area and the topography. This is the problem I try to solve. The only difference that I noticed in relation to other datasets that I had worked with is that there is no rotated poles in the details of the dataset, but of course it could be something different. Do you have any clue? Thank you in advance. I attached again the "odd" file of precipitation.

RE: lon/lat gridfile to rotated poles - Added by Mara Antonella over 2 years ago

Also here is the process that I made on the original data:

#!/bin/bash

#/home/draxis/anaconda3/condabin/conda init bash

#source /home/draxis/anaconda3/condabin/conda/activate /home/draxis/anaconda3/envs/nexus_env

export path_merged=/mnt/data/historical_colombia/prec/merged

export path_prec1=/mnt/data/historical_colombia/prec/ccc-inpe

cdo mergetime ${path_prec1}/cc_pr_hist_1.nc ${path_prec1}/cc_pr_hist_2.nc ${path_prec1}/cc_pr_hist_3.nc ${path_prec1}/cc_pr_hist_4.nc ${path_merged}/cc_hist_out.nc

export path_prec2=/mnt/data/historical_colombia/prec/mohc-inpe

cdo mergetime ${path_prec2}/mohc_pr_hist_1.nc ${path_prec2}/mohc_pr_hist_2.nc ${path_prec2}/mohc_pr_hist_3.nc ${path_prec2}/mohc_pr_hist_4.nc ${path_merged}/mohc_merged_out.nc

  1. # #-----------------------------------------------------ensemble mean

cdo ensmean ${path_merged}/cc_hist_out.nc ${path_merged}/mohc_merged_out.nc ${path_merged}/ensmean_hist.nc

#----------------------------------------------------cut files

cdo sellonlatbox,-76.69,-74,3.3,3.81 ${path_merged}/ensmean_hist.nc ${path_merged}/ens_hist_cut.nc

#----------------------------------------------------from flux to mm

cdo mulc,86400 ${path_merged}/ens_hist_cut.nc ${path_merged}/hist_mm.nc

#---------------------------------------------------data(year,lat,lon)

cdo yearsum ${path_merged}/hist_mm.nc ${path_merged}/hist_y_l_l.nc

#--------------------------------------------------------mean for 1986-2005
cdo timmean ${path_merged}/hist_y_l_l.nc ${path_merged}/ens_mean_final.nc

RE: lon/lat gridfile to rotated poles - Added by Karin Meier-Fleischer over 2 years ago

Sorry, but here you have to ask the producer of the data files. (Btw both ens_mean_final.nc files contain data for slightly different areas close to Cali, Colombia.)

RE: lon/lat gridfile to rotated poles - Added by Mara Antonella over 2 years ago

thank you very much Karin.

    (1-11/11)