-1

I would like to divide a given variable prob from a file of future climate AK2100.nc with the same variable from the file of contemporary time AK.nc. I tried this

cdo div AK2100.nc AK.nc division-AK2100.nc

But it divided all the three variables, including the lat and lon. How can I specifically target the variable of interest prob and only divide these two similar variables but keep the spatial aspect?

Thomas
  • 441
  • 3
  • 16
  • that's bizarre, it shouldn't do that if the lat and lon are defined as dimensions and the file follows CF conventions... any chance we can see the file, perhaps provide a link? – ClimateUnboxed Jan 08 '21 at 13:41
  • @AdrianTompkins, I am not sure how I could share the file. The `lat` and `lon` are defined as dimensions, and the `probability` defined as a variable. But, once executed I get that it has `processed 2 variables over 2 timesteps` – Thomas Jan 08 '21 at 13:53
  • aha! that just means 1 variable from the first file and 1 from the second! ;-) if you look at the output with ncview it will be fine and on the same grid. – ClimateUnboxed Jan 08 '21 at 13:55
  • Sounds about right @AdrianTompkins. I can't imagine the code in CDO would go that wrong that it says it's processing 2 variables when it's processing 3 – Robert Wilson Jan 08 '21 at 13:57
  • @thomas, did you check the output from the standard CDO command you posted with ncview? I presume it was fine, can you confirm? – ClimateUnboxed Jan 11 '21 at 11:43

2 Answers2

0

Try

cdo  -div -selname,prob AK2100.nc AK.nc division-AK2100.nc
Robert Wilson
  • 3,192
  • 11
  • 19
0

Try ncbo

ncbo -v prob -y divide AK2100.nc AK.nc out.nc
Charlie Zender
  • 5,929
  • 14
  • 19